flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From KurtYoung <...@git.apache.org>
Subject [GitHub] flink pull request #2550: [FLINK-4657] Implement HighAvailabilityServices ba...
Date Wed, 28 Sep 2016 02:51:45 GMT
Github user KurtYoung commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2550#discussion_r80835559
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobMaster.java
---
    @@ -467,6 +487,128 @@ public void registerAtResourceManager(final String address) {
     		//TODO:: register at the RM
     	}
     
    +	@RpcMethod
    +	public NextInputSplit requestNextInputSplit(final JobVertexID vertexID, final ExecutionAttemptID
executionAttempt) {
    +		final byte[] serializedInputSplit;
    +
    +		final Execution execution = executionGraph.getRegisteredExecutions().get(executionAttempt);
    +		if (execution == null) {
    +			log.error("Can not find Execution for attempt {}.", executionAttempt);
    +			return null;
    +		} else {
    +			final Slot slot = execution.getAssignedResource();
    +			final int taskId = execution.getVertex().getParallelSubtaskIndex();
    +			final String host = slot != null ? slot.getTaskManagerLocation().getHostname() : null;
    +
    +			final ExecutionJobVertex vertex = executionGraph.getJobVertex(vertexID);
    +			if (vertex != null) {
    +				final InputSplitAssigner splitAssigner = vertex.getSplitAssigner();
    +				if (splitAssigner != null) {
    +					final InputSplit nextInputSplit = splitAssigner.getNextInputSplit(host, taskId);
    +
    +					log.debug("Send next input split {}.", nextInputSplit);
    +					try {
    +						serializedInputSplit = InstantiationUtil.serializeObject(nextInputSplit);
    +					} catch (Exception ex) {
    +						log.error("Could not serialize the next input split of class {}.", nextInputSplit.getClass(),
ex);
    +						vertex.fail(new RuntimeException("Could not serialize the next input split of class
" +
    +							nextInputSplit.getClass() + ".", ex));
    +						return null;
    +					}
    +				} else {
    +					log.error("No InputSplitAssigner for vertex ID {}.", vertexID);
    +					return null;
    +				}
    +			} else {
    +				log.error("Cannot find execution vertex for vertex ID {}.", vertexID);
    +				return null;
    +			}
    +		}
    +		return new NextInputSplit(serializedInputSplit);
    +	}
    +
    +	@RpcMethod
    +	public PartitionState requestPartitionState(
    +		final ResultPartitionID partitionId,
    +		final ExecutionAttemptID taskExecutionId,
    +		final IntermediateDataSetID taskResultId)
    +	{
    +		final Execution execution = executionGraph.getRegisteredExecutions().get(partitionId.getProducerId());
    +		final ExecutionState state = execution != null ? execution.getState() : null;
    +		return new PartitionState(taskExecutionId, taskResultId, partitionId.getPartitionId(),
state);
    +	}
    +
    +	@RpcMethod
    +	public void jobStatusChanged(final JobStatus newJobStatus, long timestamp, final Throwable
error) {
    --- End diff --
    
    yes, you're right, will change this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message