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

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

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

Task.getRetryCount介绍

暂无

代码示例

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

private static String taskKey(Task task) {
  return task.getReferenceTaskName() + "_" + task.getRetryCount();
}

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

@VisibleForTesting
List<Task> dedupAndAddTasks(Workflow workflow, List<Task> tasks) {
  List<String> tasksInWorkflow = workflow.getTasks().stream()
      .map(task -> task.getReferenceTaskName() + "_" + task.getRetryCount())
      .collect(Collectors.toList());
  List<Task> dedupedTasks = tasks.stream()
      .filter(task -> !tasksInWorkflow.contains(task.getReferenceTaskName() + "_" + task.getRetryCount()))
      .collect(Collectors.toList());
  workflow.getTasks().addAll(dedupedTasks);
  return dedupedTasks;
}

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

taskParams.put("retryCount", task.getRetryCount());
taskParams.put("correlationId", task.getCorrelationId());
taskParams.put("pollCount", task.getPollCount());

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

@Override
public List<Task> createTasks(List<Task> tasks) {
  List<Task> tasksCreated = new LinkedList<>();
  for (Task task : tasks) {
    validate(task);
    recordRedisDaoRequests("createTask", task.getTaskType(), task.getWorkflowType());
    String taskKey = task.getReferenceTaskName() + "" + task.getRetryCount();
    Long added = dynoClient.hset(nsKey(SCHEDULED_TASKS, task.getWorkflowInstanceId()), taskKey, task.getTaskId());
    if (added < 1) {
      logger.debug("Task already scheduled, skipping the run " + task.getTaskId() + ", ref=" + task.getReferenceTaskName() + ", key=" + taskKey);
      continue;
    }
    task.setScheduledTime(System.currentTimeMillis());
    correlateTaskToWorkflowInDS(task.getTaskId(), task.getWorkflowInstanceId());
    logger.debug("Scheduled task added to WORKFLOW_TO_TASKS workflowId: {}, taskId: {}, taskType: {} during createTasks",
        task.getWorkflowInstanceId(), task.getTaskId(), task.getTaskType());
    String inProgressTaskKey = nsKey(IN_PROGRESS_TASKS, task.getTaskDefName());
    dynoClient.sadd(inProgressTaskKey, task.getTaskId());
    logger.debug("Scheduled task added to IN_PROGRESS_TASKS with inProgressTaskKey: {}, workflowId: {}, taskId: {}, taskType: {} during createTasks",
        inProgressTaskKey, task.getWorkflowInstanceId(), task.getTaskId(), task.getTaskType());
    updateTask(task);
    tasksCreated.add(task);
  }
  return tasksCreated;
}

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

if (o == null || getClass() != o.getClass()) return false;
Task task = (Task) o;
return getRetryCount() == task.getRetryCount() &&
    getSeq() == task.getSeq() &&
    getPollCount() == task.getPollCount() &&

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

/**
 * Reschedule a task
 *
 * @param task failed or cancelled task
 * @return new instance of a task with "SCHEDULED" status
 */
private Task taskToBeRescheduled(Task task) {
  Task taskToBeRetried = task.copy();
  taskToBeRetried.setTaskId(IDGenerator.generate());
  taskToBeRetried.setRetriedTaskId(task.getTaskId());
  taskToBeRetried.setStatus(SCHEDULED);
  taskToBeRetried.setRetryCount(task.getRetryCount() + 1);
  taskToBeRetried.setRetried(false);
  taskToBeRetried.setPollCount(0);
  taskToBeRetried.setCallbackAfterSeconds(0);
  task.setRetried(true);
  return taskToBeRetried;
}

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

@VisibleForTesting
Task retry(TaskDef taskDefinition, WorkflowTask workflowTask, Task task, Workflow workflow) throws TerminateWorkflowException {
  int retryCount = task.getRetryCount();
      break;
    case EXPONENTIAL_BACKOFF:
      startDelay = taskDefinition.getRetryDelaySeconds() * (1 + task.getRetryCount());
      break;
  rescheduled.setStartDelayInSeconds(startDelay);
  rescheduled.setCallbackAfterSeconds(startDelay);
  rescheduled.setRetryCount(task.getRetryCount() + 1);
  rescheduled.setRetried(false);
  rescheduled.setTaskId(IDGenerator.generate());

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

assertEquals(tasks.size() - 1, created.size());    //1 less
Set<String> srcIds = tasks.stream().map(t -> t.getReferenceTaskName() + "." + t.getRetryCount()).collect(Collectors.toSet());
Set<String> createdIds = created.stream().map(t -> t.getReferenceTaskName() + "." + t.getRetryCount()).collect(Collectors.toSet());

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

@Override
  public int hashCode() {
    return Objects.hash(getTaskType(), getStatus(), getInputData(), getReferenceTaskName(), getRetryCount(), getSeq(), getCorrelationId(), getPollCount(), getTaskDefName(), getScheduledTime(), getStartTime(), getEndTime(), getUpdateTime(), getStartDelayInSeconds(), getRetriedTaskId(), isRetried(), isExecuted(), isCallbackFromWorker(), getResponseTimeoutSeconds(), getWorkflowInstanceId(), getWorkflowType(), getTaskId(), getReasonForIncompletion(), getCallbackAfterSeconds(), getWorkerId(), getOutputData(), getWorkflowTask(), getDomain(), getInputMessage(), getOutputMessage(), getRateLimitPerFrequency(), getRateLimitFrequencyInSeconds(), getExternalInputPayloadStoragePath(), getExternalOutputPayloadStoragePath());
  }
}

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

@Override
public boolean removeTask(String taskId) {
  Task task = getTask(taskId);
  if(task == null) {
    logger.warn("No such task found by id {}", taskId);
    return false;
  }
  String taskKey = task.getReferenceTaskName() + "" + task.getRetryCount();
  dynoClient.hdel(nsKey(SCHEDULED_TASKS, task.getWorkflowInstanceId()), taskKey);
  dynoClient.srem(nsKey(IN_PROGRESS_TASKS, task.getTaskDefName()), task.getTaskId());
  dynoClient.srem(nsKey(WORKFLOW_TO_TASKS, task.getWorkflowInstanceId()), task.getTaskId());
  dynoClient.srem(nsKey(TASKS_IN_PROGRESS_STATUS, task.getTaskDefName()), task.getTaskId());
  dynoClient.del(nsKey(TASK, task.getTaskId()));
  dynoClient.zrem(nsKey(TASK_LIMIT_BUCKET, task.getTaskDefName()), task.getTaskId());
  recordRedisDaoRequests("removeTask", task.getTaskType(), task.getWorkflowType());
  return true;
}

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

assertEquals("NON TRANSIENT ERROR OCCURRED: An integration point required to complete the task is down", es.getReasonForIncompletion());
assertEquals(1, junit_task_1.getRetryCount()); //Configured retries at the task definition level
assertEquals(0, t1.getRetryCount()); //Actual retries done on the task
assertEquals(true, es.getOutput().containsKey("o1"));
assertEquals("p1 value", es.getOutput().get("o1"));

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

to.setReferenceTaskName( from.getReferenceTaskName() );
to.setRetryCount( from.getRetryCount() );
to.setSeq( from.getSeq() );
if (from.getCorrelationId() != null) {

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

@VisibleForTesting
List<Task> dedupAndAddTasks(Workflow workflow, List<Task> tasks) {
  List<String> tasksInWorkflow = workflow.getTasks().stream()
      .map(task -> task.getReferenceTaskName() + "_" + task.getRetryCount())
      .collect(Collectors.toList());
  List<Task> dedupedTasks = tasks.stream()
      .filter(task -> !tasksInWorkflow.contains(task.getReferenceTaskName() + "_" + task.getRetryCount()))
      .collect(Collectors.toList());
  workflow.getTasks().addAll(dedupedTasks);
  return dedupedTasks;
}

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

taskParams.put("retryCount", task.getRetryCount());
taskParams.put("correlationId", task.getCorrelationId());
taskParams.put("pollCount", task.getPollCount());

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

@Override
public List<Task> createTasks(List<Task> tasks) {
  List<Task> tasksCreated = new LinkedList<>();
  for (Task task : tasks) {
    validate(task);
    recordRedisDaoRequests("createTask", task.getTaskType(), task.getWorkflowType());
    String taskKey = task.getReferenceTaskName() + "" + task.getRetryCount();
    Long added = dynoClient.hset(nsKey(SCHEDULED_TASKS, task.getWorkflowInstanceId()), taskKey, task.getTaskId());
    if (added < 1) {
      logger.debug("Task already scheduled, skipping the run " + task.getTaskId() + ", ref=" + task.getReferenceTaskName() + ", key=" + taskKey);
      continue;
    }
    task.setScheduledTime(System.currentTimeMillis());
    correlateTaskToWorkflowInDS(task.getTaskId(), task.getWorkflowInstanceId());
    logger.debug("Scheduled task added to WORKFLOW_TO_TASKS workflowId: {}, taskId: {}, taskType: {} during createTasks",
        task.getWorkflowInstanceId(), task.getTaskId(), task.getTaskType());
    String inProgressTaskKey = nsKey(IN_PROGRESS_TASKS, task.getTaskDefName());
    dynoClient.sadd(inProgressTaskKey, task.getTaskId());
    logger.debug("Scheduled task added to IN_PROGRESS_TASKS with inProgressTaskKey: {}, workflowId: {}, taskId: {}, taskType: {} during createTasks",
        inProgressTaskKey, task.getWorkflowInstanceId(), task.getTaskId(), task.getTaskType());
    updateTask(task);
    tasksCreated.add(task);
  }
  return tasksCreated;
}

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

if (o == null || getClass() != o.getClass()) return false;
Task task = (Task) o;
return getRetryCount() == task.getRetryCount() &&
    getSeq() == task.getSeq() &&
    getPollCount() == task.getPollCount() &&

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

/**
 * Reschedule a task
 *
 * @param task failed or cancelled task
 * @return new instance of a task with "SCHEDULED" status
 */
private Task taskToBeRescheduled(Task task) {
  Task taskToBeRetried = task.copy();
  taskToBeRetried.setTaskId(IDGenerator.generate());
  taskToBeRetried.setRetriedTaskId(task.getTaskId());
  taskToBeRetried.setStatus(SCHEDULED);
  taskToBeRetried.setRetryCount(task.getRetryCount() + 1);
  taskToBeRetried.setRetried(false);
  taskToBeRetried.setPollCount(0);
  taskToBeRetried.setCallbackAfterSeconds(0);
  task.setRetried(true);
  return taskToBeRetried;
}

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

@VisibleForTesting
Task retry(TaskDef taskDefinition, WorkflowTask workflowTask, Task task, Workflow workflow) throws TerminateWorkflowException {
  int retryCount = task.getRetryCount();
      break;
    case EXPONENTIAL_BACKOFF:
      startDelay = taskDefinition.getRetryDelaySeconds() * (1 + task.getRetryCount());
      break;
  rescheduled.setStartDelayInSeconds(startDelay);
  rescheduled.setCallbackAfterSeconds(startDelay);
  rescheduled.setRetryCount(task.getRetryCount() + 1);
  rescheduled.setRetried(false);
  rescheduled.setTaskId(IDGenerator.generate());

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

@Override
public boolean removeTask(String taskId) {
  Task task = getTask(taskId);
  if(task == null) {
    logger.warn("No such task found by id {}", taskId);
    return false;
  }
  String taskKey = task.getReferenceTaskName() + "" + task.getRetryCount();
  dynoClient.hdel(nsKey(SCHEDULED_TASKS, task.getWorkflowInstanceId()), taskKey);
  dynoClient.srem(nsKey(IN_PROGRESS_TASKS, task.getTaskDefName()), task.getTaskId());
  dynoClient.srem(nsKey(WORKFLOW_TO_TASKS, task.getWorkflowInstanceId()), task.getTaskId());
  dynoClient.srem(nsKey(TASKS_IN_PROGRESS_STATUS, task.getTaskDefName()), task.getTaskId());
  dynoClient.del(nsKey(TASK, task.getTaskId()));
  dynoClient.zrem(nsKey(TASK_LIMIT_BUCKET, task.getTaskDefName()), task.getTaskId());
  recordRedisDaoRequests("removeTask", task.getTaskType(), task.getWorkflowType());
  return true;
}

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

@Override
  public int hashCode() {
    return Objects.hash(getTaskType(), getStatus(), getInputData(), getReferenceTaskName(), getRetryCount(), getSeq(), getCorrelationId(), getPollCount(), getTaskDefName(), getScheduledTime(), getStartTime(), getEndTime(), getUpdateTime(), getStartDelayInSeconds(), getRetriedTaskId(), isRetried(), isExecuted(), isCallbackFromWorker(), getResponseTimeoutSeconds(), getWorkflowInstanceId(), getWorkflowType(), getTaskId(), getReasonForIncompletion(), getCallbackAfterSeconds(), getWorkerId(), getOutputData(), getWorkflowTask(), getDomain(), getInputMessage(), getOutputMessage(), getRateLimitPerFrequency(), getRateLimitFrequencyInSeconds(), getExternalInputPayloadStoragePath(), getExternalOutputPayloadStoragePath());
  }
}

相关文章

Task类方法