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

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

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

Task.getCallbackAfterSeconds介绍

暂无

代码示例

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

/**
 * @return the queueWaitTime
 */
public long getQueueWaitTime() {
  if (this.startTime > 0 && this.scheduledTime > 0) {
    return this.startTime - scheduledTime - (getCallbackAfterSeconds() * 1000);
  }
  return 0L;
}

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

public void addTaskToQueue(Task task) {
  // put in queue
  String taskQueueName = QueueUtils.getQueueName(task);
  queueDAO.remove(taskQueueName, task.getTaskId());
  if (task.getCallbackAfterSeconds() > 0) {
    queueDAO.push(taskQueueName, task.getTaskId(), task.getCallbackAfterSeconds());
  } else {
    queueDAO.push(taskQueueName, task.getTaskId(), 0);
  }
  LOGGER.debug("Added task {} to queue {} with call back seconds {}", task, taskQueueName, task.getCallbackAfterSeconds());
}

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

private boolean requeue(Task pending) {
  long callback = pending.getCallbackAfterSeconds();
  if (callback < 0) {
    callback = 0;
  }
  queueDAO.remove(QueueUtils.getQueueName(pending), pending.getTaskId());
  long now = System.currentTimeMillis();
  callback = callback - ((now - pending.getUpdateTime())/1000);
  if(callback < 0) {
    callback = 0;
  }
  return queueDAO.pushIfNotExists(QueueUtils.getQueueName(pending), pending.getTaskId(), callback);
}

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

taskParams.put("taskId", task.getTaskId());
taskParams.put("reasonForIncompletion", task.getReasonForIncompletion());
taskParams.put("callbackAfterSeconds", task.getCallbackAfterSeconds());
taskParams.put("workerId", task.getWorkerId());
inputMap.put(task.getReferenceTaskName(), taskParams);

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

public TaskResult(Task task) {
  this.workflowInstanceId = task.getWorkflowInstanceId();
  this.taskId = task.getTaskId();
  this.reasonForIncompletion = task.getReasonForIncompletion();
  this.callbackAfterSeconds = task.getCallbackAfterSeconds();
  this.status = Status.valueOf(task.getStatus().name());
  this.workerId = task.getWorkerId();
  this.outputData = task.getOutputData();
  this.externalOutputPayloadStoragePath = task.getExternalOutputPayloadStoragePath();
}

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

isCallbackFromWorker() == task.isCallbackFromWorker() &&
getResponseTimeoutSeconds() == task.getResponseTimeoutSeconds() &&
getCallbackAfterSeconds() == task.getCallbackAfterSeconds() &&
getRateLimitPerFrequency() == task.getRateLimitPerFrequency() &&
getRateLimitFrequencyInSeconds() == task.getRateLimitFrequencyInSeconds() &&

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

private int requeuePendingTasks(Workflow workflow, long threshold) {
  int count = 0;
  List<Task> tasks = workflow.getTasks();
  for (Task pending : tasks) {
    if (SystemTaskType.is(pending.getTaskType())) {
      continue;
    }
    if (pending.getStatus().isTerminal()) {
      continue;
    }
    if (pending.getUpdateTime() < threshold) {
      logger.info("Requeuing Task: workflowId=" + workflow.getWorkflowId() + ", taskType=" + pending.getTaskType() + ", taskId="
          + pending.getTaskId());
      long callback = pending.getCallbackAfterSeconds();
      if (callback < 0) {
        callback = 0;
      }
      boolean pushed = queueDAO.pushIfNotExists(QueueUtils.getQueueName(pending), pending.getTaskId(), callback);
      if (pushed) {
        count++;
      }
    }
  }
  return count;
}

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

/**
 * @param workflowId the id of the workflow for which callbacks are to be reset
 * @throws ApplicationException if the workflow is in terminal state
 */
public void resetCallbacksForInProgressTasks(String workflowId) {
  Workflow workflow = executionDAOFacade.getWorkflowById(workflowId, true);
  if (workflow.getStatus().isTerminal()) {
    throw new ApplicationException(CONFLICT, "Workflow is in terminal state. Status =" + workflow.getStatus());
  }
  // Get tasks that are in progress and have callbackAfterSeconds > 0
  // and set the callbackAfterSeconds to 0;
  for (Task task : workflow.getTasks()) {
    if (task.getStatus().equals(IN_PROGRESS) &&
        task.getCallbackAfterSeconds() > 0) {
      if (queueDAO.setOffsetTime(QueueUtils.getQueueName(task), task.getTaskId(), 0)) {
        task.setCallbackAfterSeconds(0);
        executionDAOFacade.updateTask(task);
      }
    }
  }
}

代码示例来源: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

assertTrue(workflowExecutionService.ackTaskReceived(task.getTaskId()));
assertEquals(task.getTaskId(), taskId);
assertEquals(task.getCallbackAfterSeconds(), 0);

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

to.setReasonForIncompletion( from.getReasonForIncompletion() );
to.setCallbackAfterSeconds( from.getCallbackAfterSeconds() );
if (from.getWorkerId() != null) {
  to.setWorkerId( from.getWorkerId() );

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

/**
 * @return the queueWaitTime
 */
public long getQueueWaitTime() {
  if (this.startTime > 0 && this.scheduledTime > 0) {
    return this.startTime - scheduledTime - (getCallbackAfterSeconds() * 1000);
  }
  return 0L;
}

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

public void addTaskToQueue(Task task) {
  // put in queue
  String taskQueueName = QueueUtils.getQueueName(task);
  queueDAO.remove(taskQueueName, task.getTaskId());
  if (task.getCallbackAfterSeconds() > 0) {
    queueDAO.push(taskQueueName, task.getTaskId(), task.getCallbackAfterSeconds());
  } else {
    queueDAO.push(taskQueueName, task.getTaskId(), 0);
  }
  LOGGER.debug("Added task {} to queue {} with call back seconds {}", task, taskQueueName, task.getCallbackAfterSeconds());
}

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

private boolean requeue(Task pending) {
  long callback = pending.getCallbackAfterSeconds();
  if (callback < 0) {
    callback = 0;
  }
  queueDAO.remove(QueueUtils.getQueueName(pending), pending.getTaskId());
  long now = System.currentTimeMillis();
  callback = callback - ((now - pending.getUpdateTime())/1000);
  if(callback < 0) {
    callback = 0;
  }
  return queueDAO.pushIfNotExists(QueueUtils.getQueueName(pending), pending.getTaskId(), callback);
}

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

taskParams.put("taskId", task.getTaskId());
taskParams.put("reasonForIncompletion", task.getReasonForIncompletion());
taskParams.put("callbackAfterSeconds", task.getCallbackAfterSeconds());
taskParams.put("workerId", task.getWorkerId());
inputMap.put(task.getReferenceTaskName(), taskParams);

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

public TaskResult(Task task) {
  this.workflowInstanceId = task.getWorkflowInstanceId();
  this.taskId = task.getTaskId();
  this.reasonForIncompletion = task.getReasonForIncompletion();
  this.callbackAfterSeconds = task.getCallbackAfterSeconds();
  this.status = Status.valueOf(task.getStatus().name());
  this.workerId = task.getWorkerId();
  this.outputData = task.getOutputData();
  this.externalOutputPayloadStoragePath = task.getExternalOutputPayloadStoragePath();
}

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

isCallbackFromWorker() == task.isCallbackFromWorker() &&
getResponseTimeoutSeconds() == task.getResponseTimeoutSeconds() &&
getCallbackAfterSeconds() == task.getCallbackAfterSeconds() &&
getRateLimitPerFrequency() == task.getRateLimitPerFrequency() &&
getRateLimitFrequencyInSeconds() == task.getRateLimitFrequencyInSeconds() &&

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

private int requeuePendingTasks(Workflow workflow, long threshold) {
  int count = 0;
  List<Task> tasks = workflow.getTasks();
  for (Task pending : tasks) {
    if (SystemTaskType.is(pending.getTaskType())) {
      continue;
    }
    if (pending.getStatus().isTerminal()) {
      continue;
    }
    if (pending.getUpdateTime() < threshold) {
      logger.info("Requeuing Task: workflowId=" + workflow.getWorkflowId() + ", taskType=" + pending.getTaskType() + ", taskId="
          + pending.getTaskId());
      long callback = pending.getCallbackAfterSeconds();
      if (callback < 0) {
        callback = 0;
      }
      boolean pushed = queueDAO.pushIfNotExists(QueueUtils.getQueueName(pending), pending.getTaskId(), callback);
      if (pushed) {
        count++;
      }
    }
  }
  return count;
}

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

/**
 * @param workflowId the id of the workflow for which callbacks are to be reset
 * @throws ApplicationException if the workflow is in terminal state
 */
public void resetCallbacksForInProgressTasks(String workflowId) {
  Workflow workflow = executionDAOFacade.getWorkflowById(workflowId, true);
  if (workflow.getStatus().isTerminal()) {
    throw new ApplicationException(CONFLICT, "Workflow is in terminal state. Status =" + workflow.getStatus());
  }
  // Get tasks that are in progress and have callbackAfterSeconds > 0
  // and set the callbackAfterSeconds to 0;
  for (Task task : workflow.getTasks()) {
    if (task.getStatus().equals(IN_PROGRESS) &&
        task.getCallbackAfterSeconds() > 0) {
      if (queueDAO.setOffsetTime(QueueUtils.getQueueName(task), task.getTaskId(), 0)) {
        task.setCallbackAfterSeconds(0);
        executionDAOFacade.updateTask(task);
      }
    }
  }
}

代码示例来源: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类方法