예제 #1
0
		/// <exception cref="System.IO.IOException"/>
		private void RecoverJobShuffleInfo(string jobIdStr, byte[] data)
		{
			JobID jobId;
			try
			{
				jobId = ((JobID)JobID.ForName(jobIdStr));
			}
			catch (ArgumentException e)
			{
				throw new IOException("Bad job ID " + jobIdStr + " in state store", e);
			}
			ShuffleHandlerRecoveryProtos.JobShuffleInfoProto proto = ShuffleHandlerRecoveryProtos.JobShuffleInfoProto
				.ParseFrom(data);
			string user = proto.GetUser();
			SecurityProtos.TokenProto tokenProto = proto.GetJobToken();
			Org.Apache.Hadoop.Security.Token.Token<JobTokenIdentifier> jobToken = new Org.Apache.Hadoop.Security.Token.Token
				<JobTokenIdentifier>(tokenProto.GetIdentifier().ToByteArray(), tokenProto.GetPassword
				().ToByteArray(), new Text(tokenProto.GetKind()), new Text(tokenProto.GetService
				()));
			AddJobToken(jobId, user, jobToken);
		}
예제 #2
0
		/// <exception cref="System.IO.IOException"/>
		private void RecordJobShuffleInfo(JobID jobId, string user, Org.Apache.Hadoop.Security.Token.Token
			<JobTokenIdentifier> jobToken)
		{
			if (stateDb != null)
			{
				SecurityProtos.TokenProto tokenProto = ((SecurityProtos.TokenProto)SecurityProtos.TokenProto
					.NewBuilder().SetIdentifier(ByteString.CopyFrom(jobToken.GetIdentifier())).SetPassword
					(ByteString.CopyFrom(jobToken.GetPassword())).SetKind(jobToken.GetKind().ToString
					()).SetService(jobToken.GetService().ToString()).Build());
				ShuffleHandlerRecoveryProtos.JobShuffleInfoProto proto = ((ShuffleHandlerRecoveryProtos.JobShuffleInfoProto
					)ShuffleHandlerRecoveryProtos.JobShuffleInfoProto.NewBuilder().SetUser(user).SetJobToken
					(tokenProto).Build());
				try
				{
					stateDb.Put(JniDBFactory.Bytes(jobId.ToString()), proto.ToByteArray());
				}
				catch (DBException e)
				{
					throw new IOException("Error storing " + jobId, e);
				}
			}
			AddJobToken(jobId, user, jobToken);
		}