Search in sources :

Example 1 with VirtualMachineTaskStatus

use of io.mantisrx.server.worker.mesos.VirtualMachineTaskStatus in project mantis by Netflix.

the class RunningWorker method signalCompleted.

public void signalCompleted() {
    logger.info("JobId: " + jobId + ", stage: " + stageNum + " workerIndex: " + workerIndex + " workerNumber: " + workerNum + "," + " signaling completed");
    jobStatus.onNext(new Status(jobId, stageNum, workerIndex, workerNum, TYPE.INFO, getWorkerStringPrefix(stageNum, workerIndex, workerNum) + " completed", MantisJobState.Completed));
    // send complete status
    jobStatus.onCompleted();
    // send completed status to vm service
    vmTaskStatusObserver.onNext(new VirtualMachineTaskStatus(new WorkerId(jobId, workerIndex, workerNum).getId(), VirtualMachineTaskStatus.TYPE.COMPLETED, jobName + ", " + getWorkerStringPrefix(stageNum, workerIndex, workerNum) + " completed"));
}
Also used : VirtualMachineTaskStatus(io.mantisrx.server.worker.mesos.VirtualMachineTaskStatus) Status(io.mantisrx.server.core.Status) VirtualMachineTaskStatus(io.mantisrx.server.worker.mesos.VirtualMachineTaskStatus) WorkerId(io.mantisrx.server.core.domain.WorkerId)

Example 2 with VirtualMachineTaskStatus

use of io.mantisrx.server.worker.mesos.VirtualMachineTaskStatus in project mantis by Netflix.

the class RunningWorker method signalStartedInitiated.

public void signalStartedInitiated() {
    logger.info("JobId: " + jobId + ", stage: " + stageNum + " workerIndex: " + workerIndex + " workerNumber: " + workerNum + "," + " signaling started initiated");
    vmTaskStatusObserver.onNext(new VirtualMachineTaskStatus(new WorkerId(jobId, workerIndex, workerNum).getId(), VirtualMachineTaskStatus.TYPE.STARTED, jobName + ", " + getWorkerStringPrefix(stageNum, workerIndex, workerNum) + " started"));
    // indicate start success
    requestSubject.onNext(true);
    requestSubject.onCompleted();
    jobStatus.onNext(new Status(jobId, stageNum, workerIndex, workerNum, TYPE.DEBUG, "Beginning job execution " + workerIndex, MantisJobState.StartInitiated));
}
Also used : VirtualMachineTaskStatus(io.mantisrx.server.worker.mesos.VirtualMachineTaskStatus) Status(io.mantisrx.server.core.Status) VirtualMachineTaskStatus(io.mantisrx.server.worker.mesos.VirtualMachineTaskStatus) WorkerId(io.mantisrx.server.core.domain.WorkerId)

Example 3 with VirtualMachineTaskStatus

use of io.mantisrx.server.worker.mesos.VirtualMachineTaskStatus in project mantis by Netflix.

the class VirtualMachineWorkerServiceLocalImpl method start.

@Override
public void start() {
    logger.info("Starting VirtualMachineWorkerServiceLocalImpl");
    Schedulers.newThread().createWorker().schedule(new Action0() {

        @Override
        public void call() {
            try {
                WrappedExecuteStageRequest request = null;
                request = createExecuteStageRequest();
                setupRequestFailureHandler(request.getRequest().getTimeoutToReportStart(), request.getRequestSubject(), new Action0() {

                    @Override
                    public void call() {
                        logger.error("launch error");
                    }
                });
                logger.info("onNext'ing WrappedExecuteStageRequest: {}", request.toString());
                executeStageRequestObserver.onNext(request);
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }
        }
    }, 2, TimeUnit.SECONDS);
    // subscribe to vm task updates on current thread
    vmTaskStatusObservable.subscribe(new Action1<VirtualMachineTaskStatus>() {

        @Override
        public void call(VirtualMachineTaskStatus vmTaskStatus) {
            TYPE type = vmTaskStatus.getType();
            if (type == TYPE.COMPLETED) {
                logger.info("Got COMPLETED state for " + vmTaskStatus.getTaskId());
            } else if (type == TYPE.STARTED) {
                logger.info("Would send RUNNING state to mesos, worker started for " + vmTaskStatus.getTaskId());
            }
        }
    });
}
Also used : Action0(rx.functions.Action0) MalformedURLException(java.net.MalformedURLException) VirtualMachineTaskStatus(io.mantisrx.server.worker.mesos.VirtualMachineTaskStatus) TYPE(io.mantisrx.server.worker.mesos.VirtualMachineTaskStatus.TYPE)

Aggregations

VirtualMachineTaskStatus (io.mantisrx.server.worker.mesos.VirtualMachineTaskStatus)3 Status (io.mantisrx.server.core.Status)2 WorkerId (io.mantisrx.server.core.domain.WorkerId)2 TYPE (io.mantisrx.server.worker.mesos.VirtualMachineTaskStatus.TYPE)1 MalformedURLException (java.net.MalformedURLException)1 Action0 (rx.functions.Action0)1