Search in sources :

Example 1 with Status

use of org.apache.mesos.Protos.Status in project incubator-myriad by apache.

the class MyriadDriver method stop.

/**
 * Stops the underlying Mesos SchedulerDriver. If the failover flag is set to
 * false, Myriad will not reconnect to Mesos. Consequently, Mesos will unregister
 * the Myriad framework and shutdown all the Myriad tasks and executors. If failover
 * is set to true, all Myriad executors and tasks will remain running for a defined
 * period of time, allowing the MyriadScheduler to reconnect to Mesos.
 *
 * @param failover    Whether framework failover is expected.
 *
 * @return            The state of the driver after the call.
 *
 * @see Status
 */
public Status stop(boolean failover) {
    LOGGER.info("Stopping driver");
    Status status = driver.stop(failover);
    LOGGER.info("Driver stopped with status: {}", status);
    return status;
}
Also used : Status(org.apache.mesos.Protos.Status)

Example 2 with Status

use of org.apache.mesos.Protos.Status in project incubator-myriad by apache.

the class MyriadDriver method abort.

/**
 * Aborts the underlying Mesos SchedulerDriver so that no more callbacks
 * can be made to the MyriadScheduler. Note from Mesos documentation:
 * The semantics of abort and stop have deliberately been separated so that
 * code can detect an aborted driver and instantiate and start another driver
 * if desired (from within the same process).
 *
 * @return The state of the driver after the call.
 *
 * @see Status
 */
public Status abort() {
    LOGGER.info("Aborting driver");
    Status status = driver.abort();
    LOGGER.info("Aborted driver with status: {}", status);
    return status;
}
Also used : Status(org.apache.mesos.Protos.Status)

Example 3 with Status

use of org.apache.mesos.Protos.Status in project incubator-myriad by apache.

the class MyriadDriver method kill.

/**
 * Kills the specified task via the underlying Mesos SchedulerDriver.
 * Important note from the Mesos documentation: "attempting to kill a
 * task is currently not reliable. If, for example, a scheduler fails over
 * while it was attempting to kill a task it will need to retry in
 * the future Likewise, if unregistered / disconnected, the request
 * will be dropped (these semantics may be changed in the future)."
 *
 * @param taskId  The ID of the task to be killed.
 *
 * @return        The state of the driver after the call.
 *
 * @see Status
 */
public Status kill(final TaskID taskId) {
    Status status = driver.killTask(taskId);
    LOGGER.info("Task {} kill initiated with Driver status  {}", taskId, status);
    return status;
}
Also used : Status(org.apache.mesos.Protos.Status)

Example 4 with Status

use of org.apache.mesos.Protos.Status in project incubator-myriad by apache.

the class MyriadDriverTest method testAbort.

@Test
public void testAbort() throws Exception {
    MyriadDriver driver = new MyriadDriver(new MockSchedulerDriver());
    Status status = driver.abort();
    assertEquals(Protos.Status.DRIVER_ABORTED_VALUE, status.getNumber());
}
Also used : Status(org.apache.mesos.Protos.Status) Test(org.junit.Test)

Example 5 with Status

use of org.apache.mesos.Protos.Status in project incubator-myriad by apache.

the class MyriadDriverTest method testStart.

@Test
public void testStart() throws Exception {
    MyriadDriver driver = new MyriadDriver(new MockSchedulerDriver());
    Status status = driver.start();
    assertEquals(Protos.Status.DRIVER_RUNNING_VALUE, status.getNumber());
}
Also used : Status(org.apache.mesos.Protos.Status) Test(org.junit.Test)

Aggregations

Status (org.apache.mesos.Protos.Status)15 Test (org.junit.Test)3 SettableFuture (com.google.common.util.concurrent.SettableFuture)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 TaskStatus (org.apache.mesos.Protos.TaskStatus)2 ListeningExecutorService (com.google.common.util.concurrent.ListeningExecutorService)1 RemoteMessageEnvelope (com.groupon.mesos.scheduler.SchedulerMessageEnvelope.RemoteMessageEnvelope)1 SingularityExecutorTask (com.hubspot.singularity.executor.task.SingularityExecutorTask)1 UnregisterFrameworkMessage (mesos.internal.Messages.UnregisterFrameworkMessage)1 TaskID (org.apache.mesos.Protos.TaskID)1 MyriadBadConfigurationException (org.apache.myriad.configuration.MyriadBadConfigurationException)1 NodeTask (org.apache.myriad.state.NodeTask)1