use of com.hazelcast.mapreduce.impl.MapReduceService in project hazelcast by hazelcast.
the class MapReduceJobProcessInformationMessageTask method call.
@Override
protected Object call() throws Exception {
MapReduceService mapReduceService = getService(MapReduceService.SERVICE_NAME);
JobSupervisor supervisor = mapReduceService.getJobSupervisor(parameters.name, parameters.jobId);
if (supervisor != null && supervisor.getJobProcessInformation() != null) {
JobProcessInformation current = supervisor.getJobProcessInformation();
List<JobPartitionState> jobPartitionStates = Arrays.asList(current.getPartitionStates());
return MapReduceJobProcessInformationCodec.encodeResponse(jobPartitionStates, current.getProcessedRecords());
}
throw new IllegalStateException("Information not found for map reduce with name : " + parameters.name + ", job id : " + parameters.jobId);
}
use of com.hazelcast.mapreduce.impl.MapReduceService 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.MapReduceService in project hazelcast by hazelcast.
the class KeyValueSourceFacade method notifyProcessStats.
private void notifyProcessStats() {
if (processedRecords > 0) {
try {
MapReduceService mapReduceService = supervisor.getMapReduceService();
String name = supervisor.getConfiguration().getName();
String jobId = supervisor.getConfiguration().getJobId();
Address jobOwner = supervisor.getJobOwner();
mapReduceService.processRequest(jobOwner, new ProcessStatsUpdateOperation(name, jobId, processedRecords));
} catch (Exception ignore) {
// Don't care if wasn't executed properly
logger.finest("ProcessedRecords update couldn't be executed", ignore);
}
}
}
use of com.hazelcast.mapreduce.impl.MapReduceService in project hazelcast by hazelcast.
the class ReducerTask method processProcessedState.
private void processProcessedState(ReducerChunk<Key, Chunk> reducerChunk) {
// If partitionId is set this was the last chunk for this partition
if (reducerChunk.partitionId != -1) {
MapReduceService mapReduceService = supervisor.getMapReduceService();
ReducingFinishedNotification notification = new ReducingFinishedNotification(mapReduceService.getLocalAddress(), name, jobId, reducerChunk.partitionId);
mapReduceService.sendNotification(reducerChunk.sender, notification);
}
}
use of com.hazelcast.mapreduce.impl.MapReduceService in project hazelcast by hazelcast.
the class CancelJobSupervisorOperation method run.
@Override
public void run() throws Exception {
MapReduceService mapReduceService = getService();
mapReduceService.registerJobSupervisorCancellation(getName(), getJobId(), jobOwner);
JobSupervisor supervisor = mapReduceService.getJobSupervisor(getName(), getJobId());
if (supervisor != null) {
supervisor.cancel();
}
}
Aggregations