Search in sources :

Example 11 with MapReduceService

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);
}
Also used : JobProcessInformation(com.hazelcast.mapreduce.JobProcessInformation) JobPartitionState(com.hazelcast.mapreduce.JobPartitionState) MapReduceService(com.hazelcast.mapreduce.impl.MapReduceService) JobSupervisor(com.hazelcast.mapreduce.impl.task.JobSupervisor)

Example 12 with MapReduceService

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);
}
Also used : JobPartitionState(com.hazelcast.mapreduce.JobPartitionState) MapReduceService(com.hazelcast.mapreduce.impl.MapReduceService) JobProcessInformationImpl(com.hazelcast.mapreduce.impl.task.JobProcessInformationImpl) JobSupervisor(com.hazelcast.mapreduce.impl.task.JobSupervisor)

Example 13 with MapReduceService

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);
        }
    }
}
Also used : ProcessStatsUpdateOperation(com.hazelcast.mapreduce.impl.operation.ProcessStatsUpdateOperation) Address(com.hazelcast.nio.Address) MapReduceService(com.hazelcast.mapreduce.impl.MapReduceService) IOException(java.io.IOException)

Example 14 with MapReduceService

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);
    }
}
Also used : ReducingFinishedNotification(com.hazelcast.mapreduce.impl.notification.ReducingFinishedNotification) MapReduceService(com.hazelcast.mapreduce.impl.MapReduceService)

Example 15 with MapReduceService

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();
    }
}
Also used : MapReduceService(com.hazelcast.mapreduce.impl.MapReduceService) JobSupervisor(com.hazelcast.mapreduce.impl.task.JobSupervisor)

Aggregations

MapReduceService (com.hazelcast.mapreduce.impl.MapReduceService)20 JobSupervisor (com.hazelcast.mapreduce.impl.task.JobSupervisor)14 JobPartitionState (com.hazelcast.mapreduce.JobPartitionState)5 AbstractJobTracker (com.hazelcast.mapreduce.impl.AbstractJobTracker)5 JobProcessInformationImpl (com.hazelcast.mapreduce.impl.task.JobProcessInformationImpl)5 Address (com.hazelcast.nio.Address)5 IOException (java.io.IOException)4 TrackableJobFuture (com.hazelcast.mapreduce.impl.task.TrackableJobFuture)3 CancellationException (java.util.concurrent.CancellationException)3 ClusterService (com.hazelcast.internal.cluster.ClusterService)2 TopologyChangedStrategy (com.hazelcast.mapreduce.TopologyChangedStrategy)2 HashMap (java.util.HashMap)2 JobTrackerConfig (com.hazelcast.config.JobTrackerConfig)1 Member (com.hazelcast.core.Member)1 CombinerFactory (com.hazelcast.mapreduce.CombinerFactory)1 JobProcessInformation (com.hazelcast.mapreduce.JobProcessInformation)1 KeyPredicate (com.hazelcast.mapreduce.KeyPredicate)1 KeyValueSource (com.hazelcast.mapreduce.KeyValueSource)1 Mapper (com.hazelcast.mapreduce.Mapper)1 ReducerFactory (com.hazelcast.mapreduce.ReducerFactory)1