use of org.apache.mesos.Protos.Status in project incubator-myriad by apache.
the class MyriadOperations method shutdownFramework.
/**
* Shutdown framework means the Mesos driver is stopped taking down the executors and associated tasks
*/
public void shutdownFramework() {
LOGGER.info("Received request to shutdown Myriad Framework..");
Status driverStatus = driverManager.getDriverStatus();
if (Status.DRIVER_RUNNING != driverStatus) {
LOGGER.warn("Driver is not running. Status: " + driverStatus);
} else {
// Stop the driver, tasks, and executor.
driverStatus = driverManager.stopDriver(false);
LOGGER.info("Myriad driver was shutdown with status " + driverStatus);
}
try {
myriadWebServer.stop();
LOGGER.info("Myriad webserver was shutdown successfully");
} catch (Exception e) {
LOGGER.info("Failed to shutdown Myriad webserver: " + e.getMessage());
}
if (myriadStateStore != null) {
try {
myriadStateStore.removeMyriadState();
LOGGER.info("Myriad State store was removed successfully.");
} catch (Exception e) {
LOGGER.info("Failed to remove Myriad state store: " + e.getMessage());
}
}
}
use of org.apache.mesos.Protos.Status in project incubator-myriad by apache.
the class TaskTerminator method handleNonPendingTask.
private void handleNonPendingTask(TaskID taskId) {
/*
* Kill the task and decline additional offers for it, but hold off removing from SchedulerState.
* Removal of the killable task must be done following invocation of statusUpdate callback method
* which constitutes acknowledgement from Mesos that the kill task request succeeded.
*/
Status status = this.driverManager.kill(taskId);
NodeTask task = schedulerState.getTask(taskId);
if (task != null) {
offerLifeCycleManager.declineOutstandingOffers(task.getHostname());
}
if (status.equals(Status.DRIVER_RUNNING)) {
LOGGER.info("Kill request for {} was submitted to a running SchedulerDriver", taskId);
} else {
LOGGER.warn("Kill task request for {} submitted to non-running SchedulerDriver, may fail", taskId);
}
}
use of org.apache.mesos.Protos.Status in project jesos by groupon.
the class InternalExecutorDriver method stop.
@Override
public Status stop() {
Status status = context.getStateMachine();
if (!context.isStateMachine(DRIVER_RUNNING, DRIVER_ABORTED)) {
return status;
}
try {
closer.close();
} catch (final IOException e) {
LOG.warn(e, "While stopping");
}
context.setStateMachine(DRIVER_STOPPED);
// state on the return.
if (status != DRIVER_ABORTED) {
status = DRIVER_STOPPED;
}
return status;
}
use of org.apache.mesos.Protos.Status in project jesos by groupon.
the class InternalSchedulerDriver method stop.
@Override
public Status stop(final boolean failover) {
Status status = context.getStateMachine();
if (!context.isStateMachine(DRIVER_RUNNING, DRIVER_ABORTED)) {
return status;
}
if (context.isConnected() && !failover) {
final UnregisterFrameworkMessage message = UnregisterFrameworkMessage.newBuilder().setFrameworkId(context.getFrameworkId()).build();
eventBus.post(new RemoteMessageEnvelope(context.getDriverUPID(), context.getMasterUPID(), message));
}
try {
closer.close();
} catch (final IOException e) {
LOG.warn(e, "While stopping");
}
context.setStateMachine(DRIVER_STOPPED);
// state on the return.
if (status != DRIVER_ABORTED) {
status = DRIVER_STOPPED;
}
return status;
}
use of org.apache.mesos.Protos.Status in project jesos by groupon.
the class SchedulerDriverContext method setStateMachine.
//
// State machine management
//
synchronized void setStateMachine(final Status status) {
final Status oldStatus = stateMachine.getAndSet(status);
if (status != oldStatus) {
// Fire all the futures waiting for a status change.
final List<SettableFuture<Status>> settableFutures = new ArrayList<>(stateMachineFutures.size());
stateMachineFutures.drainTo(settableFutures);
for (final SettableFuture<Status> future : settableFutures) {
future.set(status);
}
}
}
Aggregations