use of com.hazelcast.mapreduce.impl.task.JobProcessInformationImpl in project hazelcast by hazelcast.
the class PostPonePartitionProcessing method run.
@Override
public void run() throws Exception {
MapReduceService mapReduceService = getService();
JobSupervisor supervisor = mapReduceService.getJobSupervisor(getName(), getJobId());
if (supervisor == null) {
result = new RequestPartitionResult(NO_SUPERVISOR, -1);
return;
}
JobProcessInformationImpl processInformation = supervisor.getJobProcessInformation();
while (true) {
JobPartitionState[] partitionStates = processInformation.getPartitionStates();
JobPartitionState oldPartitionState = partitionStates[partitionId];
if (oldPartitionState == null || !getCallerAddress().equals(oldPartitionState.getOwner())) {
result = new RequestPartitionResult(CHECK_STATE_FAILED, partitionId);
return;
}
if (processInformation.updatePartitionState(partitionId, oldPartitionState, null)) {
result = new RequestPartitionResult(SUCCESSFUL, partitionId);
return;
}
}
}
use of com.hazelcast.mapreduce.impl.task.JobProcessInformationImpl in project hazelcast by hazelcast.
the class RequestPartitionMapping method run.
@Override
public void run() throws Exception {
MapReduceService mapReduceService = getService();
JobSupervisor supervisor = mapReduceService.getJobSupervisor(getName(), getJobId());
if (supervisor == null) {
result = new RequestPartitionResult(NO_SUPERVISOR, -1);
return;
}
IPartitionService ps = getNodeEngine().getPartitionService();
List<Integer> memberPartitions = ps.getMemberPartitions(getCallerAddress());
JobProcessInformationImpl processInformation = supervisor.getJobProcessInformation();
while (true) {
int selectedPartition = searchMemberPartitionToProcess(processInformation, memberPartitions);
if (selectedPartition == -1) {
// All partitions seem to be assigned so give up
result = new RequestPartitionResult(NO_MORE_PARTITIONS, -1);
return;
}
JobPartitionState.State nextState = stateChange(getCallerAddress(), selectedPartition, WAITING, processInformation, supervisor.getConfiguration());
if (nextState == MAPPING) {
result = new RequestPartitionResult(SUCCESSFUL, selectedPartition);
return;
}
}
}
use of com.hazelcast.mapreduce.impl.task.JobProcessInformationImpl in project hazelcast by hazelcast.
the class RequestPartitionReducing method run.
@Override
public void run() throws Exception {
MapReduceService mapReduceService = getService();
JobSupervisor supervisor = mapReduceService.getJobSupervisor(getName(), getJobId());
if (supervisor == null) {
result = new RequestPartitionResult(NO_SUPERVISOR, -1);
return;
}
JobProcessInformationImpl processInformation = supervisor.getJobProcessInformation();
JobPartitionState.State nextState = stateChange(getCallerAddress(), partitionId, MAPPING, processInformation, supervisor.getConfiguration());
if (nextState != null) {
result = new RequestPartitionResult(SUCCESSFUL, partitionId);
return;
}
result = new RequestPartitionResult(CHECK_STATE_FAILED, -1);
}
use of com.hazelcast.mapreduce.impl.task.JobProcessInformationImpl in project hazelcast by hazelcast.
the class ProcessStatsUpdateOperation method run.
@Override
public void run() throws Exception {
MapReduceService mapReduceService = getService();
JobSupervisor supervisor = mapReduceService.getJobSupervisor(getName(), getJobId());
if (supervisor != null) {
JobProcessInformationImpl processInformation = supervisor.getJobProcessInformation();
processInformation.addProcessedRecords(processedRecords);
}
}
use of com.hazelcast.mapreduce.impl.task.JobProcessInformationImpl in project hazelcast by hazelcast.
the class RequestPartitionProcessed method run.
@Override
public void run() throws Exception {
MapReduceService mapReduceService = getService();
JobSupervisor supervisor = mapReduceService.getJobSupervisor(getName(), getJobId());
if (supervisor == null) {
result = new RequestPartitionResult(NO_SUPERVISOR, -1);
return;
}
JobProcessInformationImpl processInformation = supervisor.getJobProcessInformation();
JobPartitionState.State nextState = stateChange(getCallerAddress(), partitionId, currentState, processInformation, supervisor.getConfiguration());
if (nextState == PROCESSED) {
result = new RequestPartitionResult(SUCCESSFUL, partitionId);
return;
}
result = new RequestPartitionResult(CHECK_STATE_FAILED, -1);
}
Aggregations