com.netflix.conductor.common.metadata.tasks.Task.setEndTime()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中com.netflix.conductor.common.metadata.tasks.Task.setEndTime()方法的一些代码示例,展示了Task.setEndTime()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Task.setEndTime()方法的具体详情如下:
包路径:com.netflix.conductor.common.metadata.tasks.Task
类名称:Task
方法名:setEndTime

Task.setEndTime介绍

暂无

代码示例

代码示例来源:origin: Netflix/conductor

@Override
public void updateTask(Task task) {
  try {
    task.setUpdateTime(System.currentTimeMillis());
    if (task.getStatus().isTerminal() && task.getEndTime() == 0) {
      task.setEndTime(System.currentTimeMillis());
    }
    // TODO: calculate the shard number the task belongs to
    String taskPayload = toJson(task);
    recordCassandraDaoRequests("updateTask", task.getTaskType(), task.getWorkflowType());
    recordCassandraDaoPayloadSize("updateTask", taskPayload.length(), task.getTaskType(), task.getWorkflowType());
    session.execute(insertTaskStatement.bind(UUID.fromString(task.getWorkflowInstanceId()), DEFAULT_SHARD_ID, task.getTaskId(), taskPayload));
  } catch (Exception e) {
    Monitors.error(CLASS_NAME, "updateTask");
    String errorMsg = String.format("Error updating task: %s in workflow: %s", task.getTaskId(), task.getWorkflowInstanceId());
    LOGGER.error(errorMsg, e);
    throw new ApplicationException(ApplicationException.Code.BACKEND_ERROR, errorMsg, e);
  }
}

代码示例来源:origin: Netflix/conductor

/**
 * This method creates a FORK task and adds the list of dynamic fork tasks keyed by "forkedTaskDefs" and
 * their names keyed by "forkedTasks" into {@link Task#getInputData()}
 *
 * @param taskToSchedule    A {@link WorkflowTask} representing {@link TaskType#FORK_JOIN_DYNAMIC}
 * @param workflowInstance: A instance of the {@link Workflow} which represents the workflow being executed.
 * @param taskId:           The string representation of {@link java.util.UUID} which will be set as the taskId.
 * @param dynForkTasks:     The list of dynamic forked tasks, the reference names of these tasks will be added to the forkDynamicTask
 * @return A new instance of {@link Task} representing a {@link SystemTaskType#FORK}
 */
@VisibleForTesting
Task createDynamicForkTask(WorkflowTask taskToSchedule, Workflow workflowInstance, String taskId, List<WorkflowTask> dynForkTasks) {
  Task forkDynamicTask = new Task();
  forkDynamicTask.setTaskType(SystemTaskType.FORK.name());
  forkDynamicTask.setTaskDefName(SystemTaskType.FORK.name());
  forkDynamicTask.setReferenceTaskName(taskToSchedule.getTaskReferenceName());
  forkDynamicTask.setWorkflowInstanceId(workflowInstance.getWorkflowId());
  forkDynamicTask.setCorrelationId(workflowInstance.getCorrelationId());
  forkDynamicTask.setScheduledTime(System.currentTimeMillis());
  forkDynamicTask.setEndTime(System.currentTimeMillis());
  List<String> forkedTaskNames = dynForkTasks.stream()
      .map(WorkflowTask::getTaskReferenceName)
      .collect(Collectors.toList());
  forkDynamicTask.getInputData().put("forkedTasks", forkedTaskNames);
  forkDynamicTask.getInputData().put("forkedTaskDefs", dynForkTasks);    //TODO: Remove this parameter in the later releases
  forkDynamicTask.setTaskId(taskId);
  forkDynamicTask.setStatus(Task.Status.COMPLETED);
  forkDynamicTask.setWorkflowTask(taskToSchedule);
  return forkDynamicTask;
}

代码示例来源:origin: Netflix/conductor

private void updateTask(Connection connection, Task task) {
  task.setUpdateTime(System.currentTimeMillis());
  if (task.getStatus() != null && task.getStatus().isTerminal() && task.getEndTime() == 0) {
    task.setEndTime(System.currentTimeMillis());
  }
  Optional<TaskDef> taskDefinition = task.getTaskDefinition();
  if (taskDefinition.isPresent() && taskDefinition.get().concurrencyLimit() > 0) {
    boolean inProgress = task.getStatus() != null && task.getStatus().equals(Task.Status.IN_PROGRESS);
    updateInProgressStatus(connection, task, inProgress);
  }
  insertOrUpdateTaskData(connection, task);
  if (task.getStatus() != null && task.getStatus().isTerminal()) {
    removeTaskInProgress(connection, task);
  }
  addWorkflowToTaskMapping(connection, task);
}

代码示例来源:origin: Netflix/conductor

forkTask.setCorrelationId(workflowInstance.getCorrelationId());
forkTask.setScheduledTime(System.currentTimeMillis());
forkTask.setEndTime(System.currentTimeMillis());
forkTask.setInputData(taskInput);
forkTask.setTaskId(taskId);

代码示例来源:origin: Netflix/conductor

task.setUpdateTime(System.currentTimeMillis());
if (task.getStatus() != null && task.getStatus().isTerminal() && task.getEndTime() == 0) {
  task.setEndTime(System.currentTimeMillis());

代码示例来源:origin: Netflix/conductor

to.setScheduledTime( from.getScheduledTime() );
to.setStartTime( from.getStartTime() );
to.setEndTime( from.getEndTime() );
to.setUpdateTime( from.getUpdateTime() );
to.setStartDelayInSeconds( from.getStartDelayInSeconds() );

代码示例来源:origin: Netflix/conductor

task.setEndTime(System.currentTimeMillis());

代码示例来源:origin: com.netflix.conductor/conductor-core

/**
 * This method creates a FORK task and adds the list of dynamic fork tasks keyed by "forkedTaskDefs" and
 * their names keyed by "forkedTasks" into {@link Task#getInputData()}
 *
 * @param taskToSchedule    A {@link WorkflowTask} representing {@link TaskType#FORK_JOIN_DYNAMIC}
 * @param workflowInstance: A instance of the {@link Workflow} which represents the workflow being executed.
 * @param taskId:           The string representation of {@link java.util.UUID} which will be set as the taskId.
 * @param dynForkTasks:     The list of dynamic forked tasks, the reference names of these tasks will be added to the forkDynamicTask
 * @return A new instance of {@link Task} representing a {@link SystemTaskType#FORK}
 */
@VisibleForTesting
Task createDynamicForkTask(WorkflowTask taskToSchedule, Workflow workflowInstance, String taskId, List<WorkflowTask> dynForkTasks) {
  Task forkDynamicTask = new Task();
  forkDynamicTask.setTaskType(SystemTaskType.FORK.name());
  forkDynamicTask.setTaskDefName(SystemTaskType.FORK.name());
  forkDynamicTask.setReferenceTaskName(taskToSchedule.getTaskReferenceName());
  forkDynamicTask.setWorkflowInstanceId(workflowInstance.getWorkflowId());
  forkDynamicTask.setCorrelationId(workflowInstance.getCorrelationId());
  forkDynamicTask.setScheduledTime(System.currentTimeMillis());
  forkDynamicTask.setEndTime(System.currentTimeMillis());
  List<String> forkedTaskNames = dynForkTasks.stream()
      .map(WorkflowTask::getTaskReferenceName)
      .collect(Collectors.toList());
  forkDynamicTask.getInputData().put("forkedTasks", forkedTaskNames);
  forkDynamicTask.getInputData().put("forkedTaskDefs", dynForkTasks);    //TODO: Remove this parameter in the later releases
  forkDynamicTask.setTaskId(taskId);
  forkDynamicTask.setStatus(Task.Status.COMPLETED);
  forkDynamicTask.setWorkflowTask(taskToSchedule);
  return forkDynamicTask;
}

代码示例来源:origin: com.netflix.conductor/conductor-core

forkTask.setCorrelationId(workflowInstance.getCorrelationId());
forkTask.setScheduledTime(System.currentTimeMillis());
forkTask.setEndTime(System.currentTimeMillis());
forkTask.setInputData(taskInput);
forkTask.setTaskId(taskId);

代码示例来源:origin: com.netflix.conductor/conductor-redis-persistence

task.setUpdateTime(System.currentTimeMillis());
if (task.getStatus() != null && task.getStatus().isTerminal() && task.getEndTime() == 0) {
  task.setEndTime(System.currentTimeMillis());

代码示例来源:origin: com.netflix.conductor/conductor-grpc

to.setScheduledTime( from.getScheduledTime() );
to.setStartTime( from.getStartTime() );
to.setEndTime( from.getEndTime() );
to.setUpdateTime( from.getUpdateTime() );
to.setStartDelayInSeconds( from.getStartDelayInSeconds() );

代码示例来源:origin: com.netflix.conductor/conductor-core

task.setEndTime(System.currentTimeMillis());

相关文章

Task类方法