use of com.hazelcast.mapreduce.impl.MapReduceService in project hazelcast by hazelcast.
the class GetResultOperation method run.
@Override
public void run() throws Exception {
MapReduceService mapReduceService = getService();
JobSupervisor supervisor = mapReduceService.getJobSupervisor(getName(), getJobId());
if (supervisor != null) {
result = supervisor.getJobResults();
// This is the final call so cleanup on all nodes that are not job owners
if (!supervisor.isOwnerNode()) {
mapReduceService.destroyJobSupervisor(supervisor);
AbstractJobTracker jobTracker = (AbstractJobTracker) mapReduceService.getJobTracker(getName());
jobTracker.unregisterTrackableJob(getJobId());
jobTracker.unregisterMapCombineTask(getJobId());
jobTracker.unregisterReducerTask(getJobId());
}
}
}
use of com.hazelcast.mapreduce.impl.MapReduceService in project hazelcast by hazelcast.
the class KeysAssignmentOperation method run.
@Override
public void run() throws Exception {
MapReduceService mapReduceService = getService();
JobSupervisor supervisor = mapReduceService.getJobSupervisor(getName(), getJobId());
if (supervisor == null) {
this.result = new KeysAssignmentResult(NO_SUPERVISOR, null);
return;
}
Map<Object, Address> assignment = new HashMap<Object, Address>();
// Precheck if still all members are available
if (!supervisor.checkAssignedMembersAvailable()) {
TopologyChangedStrategy tcs = supervisor.getConfiguration().getTopologyChangedStrategy();
if (tcs == CANCEL_RUNNING_OPERATION) {
Exception exception = new TopologyChangedException();
supervisor.cancelAndNotify(exception);
this.result = new KeysAssignmentResult(CHECK_STATE_FAILED, assignment);
return;
// TODO Not yet fully supported
/* } else if (tcs == DISCARD_AND_RESTART) {
* supervisor.cancelNotifyAndRestart();
*/
} else {
Exception exception = new TopologyChangedException("Unknown or unsupported TopologyChangedStrategy");
supervisor.cancelAndNotify(exception);
this.result = new KeysAssignmentResult(CHECK_STATE_FAILED, assignment);
return;
}
}
try {
for (Object key : keys) {
Address address = supervisor.assignKeyReducerAddress(key);
assignment.put(key, address);
}
this.result = new KeysAssignmentResult(SUCCESSFUL, assignment);
} catch (NoDataMemberInClusterException e) {
supervisor.cancelAndNotify(e);
this.result = new KeysAssignmentResult(CHECK_STATE_FAILED, assignment);
}
}
use of com.hazelcast.mapreduce.impl.MapReduceService in project hazelcast by hazelcast.
the class NotifyRemoteExceptionOperation method run.
@Override
public void run() throws Exception {
MapReduceService mapReduceService = getService();
JobSupervisor supervisor = mapReduceService.getJobSupervisor(getName(), getJobId());
if (supervisor != null) {
supervisor.notifyRemoteException(getCallerAddress(), throwable);
}
}
use of com.hazelcast.mapreduce.impl.MapReduceService 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.MapReduceService 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