Search in sources :

Example 11 with JobSupervisor

use of com.hazelcast.mapreduce.impl.task.JobSupervisor 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)

Example 12 with JobSupervisor

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

Example 13 with JobSupervisor

use of com.hazelcast.mapreduce.impl.task.JobSupervisor 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);
    }
}
Also used : TopologyChangedStrategy(com.hazelcast.mapreduce.TopologyChangedStrategy) Address(com.hazelcast.nio.Address) HashMap(java.util.HashMap) MapReduceService(com.hazelcast.mapreduce.impl.MapReduceService) NoDataMemberInClusterException(com.hazelcast.partition.NoDataMemberInClusterException) TopologyChangedException(com.hazelcast.mapreduce.TopologyChangedException) JobSupervisor(com.hazelcast.mapreduce.impl.task.JobSupervisor) IOException(java.io.IOException) TopologyChangedException(com.hazelcast.mapreduce.TopologyChangedException) NoDataMemberInClusterException(com.hazelcast.partition.NoDataMemberInClusterException)

Example 14 with JobSupervisor

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

Example 15 with JobSupervisor

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

Aggregations

JobSupervisor (com.hazelcast.mapreduce.impl.task.JobSupervisor)16 MapReduceService (com.hazelcast.mapreduce.impl.MapReduceService)14 JobPartitionState (com.hazelcast.mapreduce.JobPartitionState)5 JobProcessInformationImpl (com.hazelcast.mapreduce.impl.task.JobProcessInformationImpl)5 AbstractJobTracker (com.hazelcast.mapreduce.impl.AbstractJobTracker)3 Address (com.hazelcast.nio.Address)3 IOException (java.io.IOException)3 CancellationException (java.util.concurrent.CancellationException)3 TrackableJobFuture (com.hazelcast.mapreduce.impl.task.TrackableJobFuture)2 JobProcessInformation (com.hazelcast.mapreduce.JobProcessInformation)1 TopologyChangedException (com.hazelcast.mapreduce.TopologyChangedException)1 TopologyChangedStrategy (com.hazelcast.mapreduce.TopologyChangedStrategy)1 JobTaskConfiguration (com.hazelcast.mapreduce.impl.task.JobTaskConfiguration)1 KeyValueSourceMappingPhase (com.hazelcast.mapreduce.impl.task.KeyValueSourceMappingPhase)1 MappingPhase (com.hazelcast.mapreduce.impl.task.MappingPhase)1 MemberAssigningJobProcessInformationImpl (com.hazelcast.mapreduce.impl.task.MemberAssigningJobProcessInformationImpl)1 NoDataMemberInClusterException (com.hazelcast.partition.NoDataMemberInClusterException)1 IPartitionService (com.hazelcast.spi.partition.IPartitionService)1 HashMap (java.util.HashMap)1