当前位置: 首页>>代码示例>>Java>>正文


Java Status类代码示例

本文整理汇总了Java中org.apache.mesos.Protos.Status的典型用法代码示例。如果您正苦于以下问题:Java Status类的具体用法?Java Status怎么用?Java Status使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Status类属于org.apache.mesos.Protos包,在下文中一共展示了Status类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: killAndRecord

import org.apache.mesos.Protos.Status; //导入依赖的package包/类
public Protos.Status killAndRecord(SingularityTaskId taskId, Optional<RequestCleanupType> requestCleanupType, Optional<TaskCleanupType> taskCleanupType, Optional<Long> originalTimestamp, Optional<Integer> retries) {
  driverLock.lock();

  try {
    Preconditions.checkState(canKillTask());

    currentStatus = driver.kill(taskId);

    taskManager.saveKilledRecord(new SingularityKilledTaskIdRecord(taskId, System.currentTimeMillis(), originalTimestamp.or(System.currentTimeMillis()), requestCleanupType, taskCleanupType, retries.or(-1) + 1));

    Preconditions.checkState(currentStatus == Status.DRIVER_RUNNING);
  } finally {
    driverLock.unlock();
  }

  return currentStatus;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:18,代码来源:SingularityDriverManager.java

示例2: stopDriver

import org.apache.mesos.Protos.Status; //导入依赖的package包/类
/**
 * Stop driver, executor, and tasks if false, otherwise just the driver.
 *
 * @return driver status
 */
public Status stopDriver(boolean failover) {
  this.driverLock.lock();
  try {
    if (isRunning()) {
      if (failover) {
        LOGGER.info("Stopping driver ...");
      } else {
        LOGGER.info("Stopping driver and terminating tasks...");
      }
      this.driverStatus = this.driver.stop(failover);
      LOGGER.info("Stopped driver with status: {}", this.driverStatus);
    }
  } finally {
    this.driverLock.unlock();
  }
  return driverStatus;
}
 
开发者ID:apache,项目名称:incubator-myriad,代码行数:23,代码来源:MyriadDriverManager.java

示例3: kill

import org.apache.mesos.Protos.Status; //导入依赖的package包/类
public Status kill(final TaskID taskId) {
  LOGGER.info("Killing task {}", taskId);
  this.driverLock.lock();
  try {
    if (isRunning()) {
      this.driverStatus = driver.kill(taskId);
      LOGGER.info("Task {} killed with status: {}", taskId, this.driverStatus);
    } else {
      LOGGER.warn("Cannot kill task, driver is not running");
    }
  } finally {
    this.driverLock.unlock();
  }

  return driverStatus;
}
 
开发者ID:apache,项目名称:incubator-myriad,代码行数:17,代码来源:MyriadDriverManager.java

示例4: handleNonPendingTask

import org.apache.mesos.Protos.Status; //导入依赖的package包/类
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);
  }
}
 
开发者ID:apache,项目名称:incubator-myriad,代码行数:19,代码来源:TaskTerminator.java

示例5: abort

import org.apache.mesos.Protos.Status; //导入依赖的package包/类
@Override
public Status abort()
{
    if (!context.isStateMachine(DRIVER_RUNNING)) {
        return context.getStateMachine();
    }

    if (context.isConnected()) {
        final DeactivateFrameworkMessage message = DeactivateFrameworkMessage.newBuilder().setFrameworkId(context.getFrameworkId()).build();
        eventBus.post(new RemoteMessageEnvelope(context.getDriverUPID(), context.getMasterUPID(), message));
    }

    context.setStateMachine(DRIVER_ABORTED);

    return context.getStateMachine();
}
 
开发者ID:groupon,项目名称:jesos,代码行数:17,代码来源:InternalSchedulerDriver.java

示例6: killTask

import org.apache.mesos.Protos.Status; //导入依赖的package包/类
@Override
public Status killTask(final TaskID taskId)
{
    checkNotNull(taskId, "taskId is null");

    if (!context.isStateMachine(DRIVER_RUNNING)) {
        return context.getStateMachine();
    }

    final KillTaskMessage message = KillTaskMessage.newBuilder()
        .setFrameworkId(context.getFrameworkId())
        .setTaskId(taskId)
        .build();
    eventBus.post(new RemoteMessageEnvelope(context.getDriverUPID(), context.getMasterUPID(), message));

    return context.getStateMachine();
}
 
开发者ID:groupon,项目名称:jesos,代码行数:18,代码来源:InternalSchedulerDriver.java

示例7: launchTasks

import org.apache.mesos.Protos.Status; //导入依赖的package包/类
@Override
public Status launchTasks(final OfferID offerId, final Collection<TaskInfo> tasks)
{
    checkNotNull(offerId, "offerId is null");
    checkNotNull(tasks, "tasks is null");

    if (!context.isStateMachine(DRIVER_RUNNING)) {
        return context.getStateMachine();
    }

    final LaunchTasksMessage message = LaunchTasksMessage.newBuilder()
        .setFrameworkId(context.getFrameworkId())
        .addOfferIds(offerId)
        .addAllTasks(tasks)
        .setFilters(Filters.newBuilder().build())
        .build();

    doLaunchTasks(message);
    return context.getStateMachine();
}
 
开发者ID:groupon,项目名称:jesos,代码行数:21,代码来源:InternalSchedulerDriver.java

示例8: declineOffer

import org.apache.mesos.Protos.Status; //导入依赖的package包/类
@Override
public Status declineOffer(final OfferID offerId, final Filters filters)
{
    checkNotNull(offerId, "offerId is null");
    checkNotNull(filters, "filters is null");

    if (!context.isStateMachine(DRIVER_RUNNING)) {
        return context.getStateMachine();
    }

    final LaunchTasksMessage message = LaunchTasksMessage.newBuilder()
        .setFrameworkId(context.getFrameworkId())
        .addOfferIds(offerId)
        .setFilters(filters)
        .build();

    doLaunchTasks(message);
    return context.getStateMachine();
}
 
开发者ID:groupon,项目名称:jesos,代码行数:20,代码来源:InternalSchedulerDriver.java

示例9: requestResources

import org.apache.mesos.Protos.Status; //导入依赖的package包/类
@Override
public Status requestResources(final Collection<Protos.Request> requests)
{
    checkNotNull(requests, "requests is null");

    if (!context.isStateMachine(DRIVER_RUNNING)) {
        return context.getStateMachine();
    }

    final ResourceRequestMessage message = ResourceRequestMessage.newBuilder()
        .setFrameworkId(context.getFrameworkId())
        .addAllRequests(requests)
        .build();
    eventBus.post(new RemoteMessageEnvelope(context.getDriverUPID(), context.getMasterUPID(), message));

    return context.getStateMachine();
}
 
开发者ID:groupon,项目名称:jesos,代码行数:18,代码来源:InternalSchedulerDriver.java

示例10: acknowledgeStatusUpdate

import org.apache.mesos.Protos.Status; //导入依赖的package包/类
@Override
public Status acknowledgeStatusUpdate(final TaskStatus taskStatus)
{
    checkNotNull(taskStatus, "taskStatus is null");
    checkState(!implicitAcknowledges, "Can not call acknowledgeStatusUpdate with implicitAcknowledges turned off");

    if (!context.isStateMachine(DRIVER_RUNNING)) {
        return context.getStateMachine();
    }

    final StatusUpdateAcknowledgementMessage message = StatusUpdateAcknowledgementMessage.newBuilder()
        .setFrameworkId(context.getFrameworkId())
        .setSlaveId(taskStatus.getSlaveId())
        .setTaskId(taskStatus.getTaskId())
        .setUuid(taskStatus.getUuid())
        .build();

    eventBus.post(new RemoteMessageEnvelope(context.getDriverUPID(), context.getMasterUPID(), message));

    return context.getStateMachine();
}
 
开发者ID:groupon,项目名称:jesos,代码行数:22,代码来源:InternalSchedulerDriver.java

示例11: stop

import org.apache.mesos.Protos.Status; //导入依赖的package包/类
@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);

    // If the driver was aborted, preserve that
    // state on the return.
    if (status != DRIVER_ABORTED) {
        status = DRIVER_STOPPED;
    }

    return status;
}
 
开发者ID:groupon,项目名称:jesos,代码行数:27,代码来源:InternalExecutorDriver.java

示例12: sendFrameworkMessage

import org.apache.mesos.Protos.Status; //导入依赖的package包/类
@Override
public Status sendFrameworkMessage(final byte[] data)
{
    checkNotNull(data, "data is null");

    if (!context.isStateMachine(DRIVER_RUNNING)) {
        return context.getStateMachine();
    }

    final ExecutorToFrameworkMessage message = ExecutorToFrameworkMessage.newBuilder()
        .setSlaveId(context.getSlaveId())
        .setFrameworkId(context.getFrameworkId())
        .setExecutorId(context.getExecutorId())
        .setData(ByteString.copyFrom(data))
        .build();

    eventBus.post(new RemoteMessageEnvelope(context.getDriverUPID(), context.getSlaveUPID(), message));

    return context.getStateMachine();
}
 
开发者ID:groupon,项目名称:jesos,代码行数:21,代码来源:InternalExecutorDriver.java

示例13: kill

import org.apache.mesos.Protos.Status; //导入依赖的package包/类
public Status kill(final TaskID taskId) {
	LOGGER.info("Killing task {}", taskId);
	this.driverLock.lock();
	try {
		if (isRunning()) {
			this.driverStatus = driver.kill(taskId);
			LOGGER.info("Task {} killed with status: {}", taskId,
					this.driverStatus);
		} else {
			LOGGER.warn("Cannot kill task, driver is not running");
		}
	} finally {
		this.driverLock.unlock();
	}

	return driverStatus;
}
 
开发者ID:eBay,项目名称:myriad,代码行数:18,代码来源:MyriadDriverManager.java

示例14: SingularityDriverManager

import org.apache.mesos.Protos.Status; //导入依赖的package包/类
@Inject
public SingularityDriverManager(SingularityDriver driver, TaskManager taskManager) {
  this.taskManager = taskManager;

  this.driverLock = new ReentrantLock();

  this.currentStatus = Protos.Status.DRIVER_NOT_STARTED;
  this.driver = driver;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:10,代码来源:SingularityDriverManager.java

示例15: startMesos

import org.apache.mesos.Protos.Status; //导入依赖的package包/类
public Protos.Status startMesos() {
  driverLock.lock();

  try {
    Preconditions.checkState(isStartable());

    currentStatus = driver.start();
  } finally {
    driverLock.unlock();
  }

  return currentStatus;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:14,代码来源:SingularityDriverManager.java


注:本文中的org.apache.mesos.Protos.Status类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。