Search in sources :

Example 1 with JobProcessInformationImpl

use of com.hazelcast.mapreduce.impl.task.JobProcessInformationImpl in project hazelcast by hazelcast.

the class PostPonePartitionProcessing 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();
    while (true) {
        JobPartitionState[] partitionStates = processInformation.getPartitionStates();
        JobPartitionState oldPartitionState = partitionStates[partitionId];
        if (oldPartitionState == null || !getCallerAddress().equals(oldPartitionState.getOwner())) {
            result = new RequestPartitionResult(CHECK_STATE_FAILED, partitionId);
            return;
        }
        if (processInformation.updatePartitionState(partitionId, oldPartitionState, null)) {
            result = new RequestPartitionResult(SUCCESSFUL, partitionId);
            return;
        }
    }
}
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 2 with JobProcessInformationImpl

use of com.hazelcast.mapreduce.impl.task.JobProcessInformationImpl in project hazelcast by hazelcast.

the class RequestPartitionMapping 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;
    }
    IPartitionService ps = getNodeEngine().getPartitionService();
    List<Integer> memberPartitions = ps.getMemberPartitions(getCallerAddress());
    JobProcessInformationImpl processInformation = supervisor.getJobProcessInformation();
    while (true) {
        int selectedPartition = searchMemberPartitionToProcess(processInformation, memberPartitions);
        if (selectedPartition == -1) {
            // All partitions seem to be assigned so give up
            result = new RequestPartitionResult(NO_MORE_PARTITIONS, -1);
            return;
        }
        JobPartitionState.State nextState = stateChange(getCallerAddress(), selectedPartition, WAITING, processInformation, supervisor.getConfiguration());
        if (nextState == MAPPING) {
            result = new RequestPartitionResult(SUCCESSFUL, selectedPartition);
            return;
        }
    }
}
Also used : JobPartitionState(com.hazelcast.mapreduce.JobPartitionState) IPartitionService(com.hazelcast.spi.partition.IPartitionService) MapReduceService(com.hazelcast.mapreduce.impl.MapReduceService) JobProcessInformationImpl(com.hazelcast.mapreduce.impl.task.JobProcessInformationImpl) JobSupervisor(com.hazelcast.mapreduce.impl.task.JobSupervisor)

Example 3 with JobProcessInformationImpl

use of com.hazelcast.mapreduce.impl.task.JobProcessInformationImpl 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 4 with JobProcessInformationImpl

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

Example 5 with JobProcessInformationImpl

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

Aggregations

MapReduceService (com.hazelcast.mapreduce.impl.MapReduceService)5 JobProcessInformationImpl (com.hazelcast.mapreduce.impl.task.JobProcessInformationImpl)5 JobSupervisor (com.hazelcast.mapreduce.impl.task.JobSupervisor)5 JobPartitionState (com.hazelcast.mapreduce.JobPartitionState)4 IPartitionService (com.hazelcast.spi.partition.IPartitionService)1