use of com.hazelcast.mapreduce.impl.task.TrackableJobFuture in project hazelcast by hazelcast.
the class StartProcessingJobOperation method run.
@Override
public void run() throws Exception {
MapReduceService mapReduceService = getService();
if (mapReduceService.unregisterJobSupervisorCancellation(name, jobId)) {
// Supervisor was cancelled prior to creation
AbstractJobTracker jobTracker = (AbstractJobTracker) mapReduceService.getJobTracker(name);
TrackableJobFuture future = jobTracker.unregisterTrackableJob(jobId);
if (future != null) {
Exception exception = new CancellationException("Operation was cancelled by the user");
future.setResult(exception);
}
return;
}
JobSupervisor supervisor = mapReduceService.getJobSupervisor(name, jobId);
if (supervisor == null) {
return;
}
// Create actual mapping operation
MappingPhase mappingPhase = new KeyValueSourceMappingPhase(keys, predicate);
supervisor.startTasks(mappingPhase);
}
use of com.hazelcast.mapreduce.impl.task.TrackableJobFuture in project hazelcast by hazelcast.
the class KeyValueJobOperation method run.
@Override
public void run() throws Exception {
MapReduceService mapReduceService = getService();
Address jobOwner = getCallerAddress();
if (jobOwner == null) {
jobOwner = getNodeEngine().getThisAddress();
}
// Inject managed context
injectManagedContext(mapper, combinerFactory, reducerFactory, keyValueSource);
// Build immutable configuration
JobTaskConfiguration config = new JobTaskConfiguration(jobOwner, getNodeEngine(), chunkSize, name, jobId, mapper, combinerFactory, reducerFactory, keyValueSource, communicateStats, topologyChangedStrategy);
JobSupervisor supervisor = mapReduceService.createJobSupervisor(config);
if (supervisor == null) {
// Supervisor was cancelled prior to creation
AbstractJobTracker jobTracker = (AbstractJobTracker) mapReduceService.getJobTracker(name);
TrackableJobFuture future = jobTracker.unregisterTrackableJob(jobId);
if (future != null) {
Exception exception = new CancellationException("Operation was cancelled by the user");
future.setResult(exception);
}
}
}
use of com.hazelcast.mapreduce.impl.task.TrackableJobFuture in project hazelcast by hazelcast.
the class AbstractMapReduceTask method processMessage.
@Override
protected void processMessage() {
MapReduceService mapReduceService = getService(MapReduceService.SERVICE_NAME);
NodeEngine nodeEngine = mapReduceService.getNodeEngine();
ClusterService clusterService = nodeEngine.getClusterService();
if (clusterService.getSize(MemberSelectors.DATA_MEMBER_SELECTOR) == 0) {
throw new IllegalStateException("Could not register map reduce job since there are no nodes owning a partition");
}
final String objectName = getDistributedObjectName();
AbstractJobTracker jobTracker = (AbstractJobTracker) mapReduceService.createDistributedObject(objectName);
TrackableJobFuture jobFuture = new TrackableJobFuture(objectName, getJobId(), jobTracker, nodeEngine, null);
if (jobTracker.registerTrackableJob(jobFuture)) {
startSupervisionTask(jobTracker);
jobFuture.andThen(this);
}
}
Aggregations