Package com.hazelcast.mapreduce.impl.task

Examples of com.hazelcast.mapreduce.impl.task.JobSupervisor


            return null;
        }

        JobSupervisorKey key = new JobSupervisorKey(configuration.getName(), configuration.getJobId());
        boolean ownerNode = nodeEngine.getThisAddress().equals(configuration.getJobOwner());
        JobSupervisor jobSupervisor = new JobSupervisor(configuration, jobTracker, ownerNode, this);
        JobSupervisor oldSupervisor = jobSupervisors.putIfAbsent(key, jobSupervisor);
        return oldSupervisor != null ? oldSupervisor : jobSupervisor;
    }
View Full Code Here


    }

    public void dispatchEvent(MapReduceNotification notification) {
        String name = notification.getName();
        String jobId = notification.getJobId();
        JobSupervisor supervisor = getJobSupervisor(name, jobId);
        if (supervisor == null) {
            throw new NullPointerException("JobSupervisor name=" + name + ", jobId=" + jobId + " not found");
        }
        supervisor.onNotification(notification);
    }
View Full Code Here

    @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;
        }

        InternalPartitionService 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;
            }
View Full Code Here

    @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;
        }
View Full Code Here

        // 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);
View Full Code Here

    @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());
View Full Code Here

    @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);
        }
    }
View Full Code Here

    @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;
            }
        }

        for (Object key : keys) {
            Address address = supervisor.assignKeyReducerAddress(key);
            assignment.put(key, address);
        }
        this.result = new KeysAssignmentResult(SUCCESSFUL, assignment);
    }
View Full Code Here

    @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;
        }

        MemberAssigningJobProcessInformationImpl processInformation = getProcessInformation(supervisor);
        int memberId = processInformation.assignMemberId(getCallerAddress(), getCallerUuid(), supervisor.getConfiguration());

        if (memberId == -1) {
            result = new RequestPartitionResult(NO_MORE_PARTITIONS, -1);
            return;
        }
View Full Code Here

    @Override
    public void run()
            throws Exception {
        MapReduceService mapReduceService = getService();
        JobSupervisor supervisor = mapReduceService.getJobSupervisor(name, jobId);
        if (supervisor == null) {
            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;
        }

        MappingPhase mappingPhase = new KeyValueSourceMappingPhase(keys, predicate);
        supervisor.startTasks(mappingPhase);
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.mapreduce.impl.task.JobSupervisor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.