Search in sources :

Example 1 with JobShuffleInfoProto

use of org.apache.hadoop.mapred.proto.ShuffleHandlerRecoveryProtos.JobShuffleInfoProto in project hadoop by apache.

the class ShuffleHandler method recordJobShuffleInfo.

private void recordJobShuffleInfo(JobID jobId, String user, Token<JobTokenIdentifier> jobToken) throws IOException {
    if (stateDb != null) {
        TokenProto tokenProto = TokenProto.newBuilder().setIdentifier(ByteString.copyFrom(jobToken.getIdentifier())).setPassword(ByteString.copyFrom(jobToken.getPassword())).setKind(jobToken.getKind().toString()).setService(jobToken.getService().toString()).build();
        JobShuffleInfoProto proto = JobShuffleInfoProto.newBuilder().setUser(user).setJobToken(tokenProto).build();
        try {
            stateDb.put(bytes(jobId.toString()), proto.toByteArray());
        } catch (DBException e) {
            throw new IOException("Error storing " + jobId, e);
        }
    }
    addJobToken(jobId, user, jobToken);
}
Also used : DBException(org.iq80.leveldb.DBException) JobShuffleInfoProto(org.apache.hadoop.mapred.proto.ShuffleHandlerRecoveryProtos.JobShuffleInfoProto) TokenProto(org.apache.hadoop.security.proto.SecurityProtos.TokenProto) IOException(java.io.IOException)

Example 2 with JobShuffleInfoProto

use of org.apache.hadoop.mapred.proto.ShuffleHandlerRecoveryProtos.JobShuffleInfoProto in project hadoop by apache.

the class ShuffleHandler method recoverJobShuffleInfo.

private void recoverJobShuffleInfo(String jobIdStr, byte[] data) throws IOException {
    JobID jobId;
    try {
        jobId = JobID.forName(jobIdStr);
    } catch (IllegalArgumentException e) {
        throw new IOException("Bad job ID " + jobIdStr + " in state store", e);
    }
    JobShuffleInfoProto proto = JobShuffleInfoProto.parseFrom(data);
    String user = proto.getUser();
    TokenProto tokenProto = proto.getJobToken();
    Token<JobTokenIdentifier> jobToken = new Token<JobTokenIdentifier>(tokenProto.getIdentifier().toByteArray(), tokenProto.getPassword().toByteArray(), new Text(tokenProto.getKind()), new Text(tokenProto.getService()));
    addJobToken(jobId, user, jobToken);
}
Also used : JobShuffleInfoProto(org.apache.hadoop.mapred.proto.ShuffleHandlerRecoveryProtos.JobShuffleInfoProto) TokenProto(org.apache.hadoop.security.proto.SecurityProtos.TokenProto) JobTokenIdentifier(org.apache.hadoop.mapreduce.security.token.JobTokenIdentifier) Token(org.apache.hadoop.security.token.Token) Text(org.apache.hadoop.io.Text) IOException(java.io.IOException) JniDBFactory.asString(org.fusesource.leveldbjni.JniDBFactory.asString) ByteString(com.google.protobuf.ByteString)

Aggregations

IOException (java.io.IOException)2 JobShuffleInfoProto (org.apache.hadoop.mapred.proto.ShuffleHandlerRecoveryProtos.JobShuffleInfoProto)2 TokenProto (org.apache.hadoop.security.proto.SecurityProtos.TokenProto)2 ByteString (com.google.protobuf.ByteString)1 Text (org.apache.hadoop.io.Text)1 JobTokenIdentifier (org.apache.hadoop.mapreduce.security.token.JobTokenIdentifier)1 Token (org.apache.hadoop.security.token.Token)1 JniDBFactory.asString (org.fusesource.leveldbjni.JniDBFactory.asString)1 DBException (org.iq80.leveldb.DBException)1