本文整理了Java中com.netflix.conductor.common.metadata.tasks.Task.setStatus()
方法的一些代码示例,展示了Task.setStatus()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Task.setStatus()
方法的具体详情如下:
包路径:com.netflix.conductor.common.metadata.tasks.Task
类名称:Task
方法名:setStatus
暂无
代码示例来源:origin: Netflix/conductor
@Override
public void cancel(Workflow workflow, Task task, WorkflowExecutor executor) {
task.setStatus(Status.CANCELED);
}
}
代码示例来源:origin: Netflix/conductor
@Override
public boolean execute(Workflow workflow, Task task, WorkflowExecutor provider) {
task.setStatus(Status.COMPLETED);
return true;
}
}
代码示例来源:origin: Netflix/conductor
@Override
public void start(Workflow workflow, Task task, WorkflowExecutor executor) {
task.setStatus(Status.IN_PROGRESS);
}
代码示例来源:origin: Netflix/conductor
@Override
public void cancel(Workflow workflow, Task task, WorkflowExecutor executor) {
task.setStatus(Status.CANCELED);
}
代码示例来源:origin: Netflix/conductor
@Override
public void start(Workflow workflow, Task task, WorkflowExecutor executor) {
Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
task.setStatus(Status.COMPLETED);
}
代码示例来源:origin: Netflix/conductor
@VisibleForTesting
void failTask(Task task, PayloadType payloadType, String errorMsg) {
logger.error(errorMsg);
task.setReasonForIncompletion(errorMsg);
task.setStatus(Task.Status.FAILED_WITH_TERMINAL_ERROR);
if (payloadType == PayloadType.TASK_INPUT) {
task.setInputData(null);
} else {
task.setOutputData(null);
}
throw new TerminateWorkflowException(errorMsg, Workflow.WorkflowStatus.FAILED, task);
}
代码示例来源:origin: Netflix/conductor
@Override
public void start(Workflow workflow, Task task, WorkflowExecutor executor) {
httpTaskExecuted.set(true);
task.setStatus(Status.COMPLETED);
super.start(workflow, task, executor);
}
};
代码示例来源:origin: Netflix/conductor
@Override
public void start(Workflow workflow, Task task, WorkflowExecutor executor) {
http2TaskExecuted.set(true);
task.setStatus(Status.COMPLETED);
super.start(workflow, task, executor);
}
};
代码示例来源:origin: Netflix/conductor
private void timeoutTask(TaskDef taskDef, Task task) {
String reason = "responseTimeout: " + taskDef.getResponseTimeoutSeconds() + " exceeded for the taskId: " + task.getTaskId() + " with Task Definition: " + task.getTaskDefName();
LOGGER.debug(reason);
task.setStatus(TIMED_OUT);
task.setReasonForIncompletion(reason);
}
代码示例来源:origin: Netflix/conductor
@Test
public void testGetInProgressTasks() throws Exception {
Task task = new Task();
task.setTaskType("SIMPLE");
task.setWorkerId("123");
task.setDomain("test");
task.setStatus(Task.Status.IN_PROGRESS);
List<Task> listOfTasks = new ArrayList<>();
listOfTasks.add(task);
when(mockTaskService.getTasks(anyString(), anyString(), anyInt())).thenReturn(listOfTasks);
assertEquals(listOfTasks, taskResource.getTasks("SIMPLE", "123", 123));
}
代码示例来源:origin: Netflix/conductor
@Test
public void testGetPendingTaskForWorkflow() {
Task task = new Task();
task.setTaskType("SIMPLE");
task.setWorkerId("123");
task.setDomain("test");
task.setStatus(Task.Status.IN_PROGRESS);
when(mockTaskService.getPendingTaskForWorkflow(anyString(), anyString())).thenReturn(task);
assertEquals(task, taskResource.getPendingTaskForWorkflow("SIMPLE", "123"));
}
代码示例来源:origin: Netflix/conductor
@Test
public void testGetTask() throws Exception {
Task task = new Task();
task.setTaskType("SIMPLE");
task.setWorkerId("123");
task.setDomain("test");
task.setStatus(Task.Status.IN_PROGRESS);
when(mockTaskService.getTask(anyString())).thenReturn(task);
assertEquals(task, taskResource.getTask("123"));
}
代码示例来源:origin: Netflix/conductor
@Test
public void search() {
Task task = new Task();
task.setTaskType("SIMPLE");
task.setWorkerId("123");
task.setDomain("test");
task.setStatus(Task.Status.IN_PROGRESS);
TaskSummary taskSummary = new TaskSummary(task);
ArrayList<TaskSummary> listOfTaskSummary = new ArrayList<TaskSummary>() {{
add(taskSummary);
}};
SearchResult<TaskSummary> searchResult = new SearchResult<TaskSummary>(100, listOfTaskSummary);
listOfTaskSummary.add(taskSummary);
when(mockTaskService.search(anyInt(), anyInt(), anyString(), anyString(), anyString())).thenReturn(searchResult);
assertEquals(searchResult, taskResource.search(0,100,"asc", "*", "*"));
}
}
代码示例来源:origin: Netflix/conductor
@Test
public void test() {
Task task = new Task();
task.setStatus(Status.FAILED);
assertEquals(Status.FAILED, task.getStatus());
Set<String> resultStatues = Arrays.asList(TaskResult.Status.values()).stream()
.map(status -> status.name())
.collect(Collectors.toSet());
for (Status status : Status.values()) {
if (resultStatues.contains(status.name())) {
TaskResult.Status trStatus = TaskResult.Status.valueOf(status.name());
assertEquals(status.name(), trStatus.name());
task = new Task();
task.setStatus(status);
assertEquals(status, task.getStatus());
}
}
}
代码示例来源: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
@Test
public void testExecute() {
Task task = new Task();
Input input = new Input();
input.setUri("http://localhost:7009/json");
input.setMethod("GET");
task.getInputData().put(HttpTask.REQUEST_PARAMETER_NAME, input);
task.setStatus(Status.SCHEDULED);
task.setScheduledTime(0);
boolean executed = httpTask.execute(workflow, task, workflowExecutor);
assertFalse(executed);
}
代码示例来源:origin: Netflix/conductor
@Test
public void testIsResponsedTimeOut() {
TaskDef taskDef = new TaskDef();
taskDef.setName("test_rt");
taskDef.setResponseTimeoutSeconds(10);
Task task = new Task();
task.setTaskDefName("test_rt");
task.setStatus(Status.IN_PROGRESS);
task.setTaskId("aa");
task.setUpdateTime(System.currentTimeMillis() - TimeUnit.SECONDS.toMillis(11));
boolean flag = deciderService.isResponseTimedOut(taskDef, task);
assertNotNull(task);
assertTrue(flag);
}
代码示例来源:origin: Netflix/conductor
@Test
public void testGetTaskByRef() {
Workflow workflow = new Workflow();
Task t1 = new Task();
t1.setReferenceTaskName("ref");
t1.setSeq(0);
t1.setStatus(Status.TIMED_OUT);
Task t2 = new Task();
t2.setReferenceTaskName("ref");
t2.setSeq(1);
t2.setStatus(Status.FAILED);
Task t3 = new Task();
t3.setReferenceTaskName("ref");
t3.setSeq(2);
t3.setStatus(Status.COMPLETED);
workflow.getTasks().add(t1);
workflow.getTasks().add(t2);
workflow.getTasks().add(t3);
Task task = workflow.getTaskByRefName("ref");
assertNotNull(task);
assertEquals(Status.COMPLETED, task.getStatus());
assertEquals(t3.getSeq(), task.getSeq());
}
代码示例来源:origin: Netflix/conductor
@Test
public void testTaskDefinitionIfAvailable() {
Task task = new Task();
task.setStatus(Status.FAILED);
assertEquals(Status.FAILED, task.getStatus());
assertNull(task.getWorkflowTask());
assertFalse(task.getTaskDefinition().isPresent());
WorkflowTask workflowTask = new WorkflowTask();
TaskDef taskDefinition = new TaskDef();
workflowTask.setTaskDefinition(taskDefinition);
task.setWorkflowTask(workflowTask);
assertTrue(task.getTaskDefinition().isPresent());
assertEquals(taskDefinition, task.getTaskDefinition().get());
}
}
代码示例来源:origin: Netflix/conductor
@Test
public void testFailure() {
Task task = new Task();
Input input = new Input();
input.setUri("http://localhost:7009/failure");
input.setMethod("GET");
task.getInputData().put(HttpTask.REQUEST_PARAMETER_NAME, input);
httpTask.start(workflow, task, workflowExecutor);
assertEquals("Task output: " + task.getOutputData(), Task.Status.FAILED, task.getStatus());
assertEquals(ERROR_RESPONSE, task.getReasonForIncompletion());
task.setStatus(Status.SCHEDULED);
task.getInputData().remove(HttpTask.REQUEST_PARAMETER_NAME);
httpTask.start(workflow, task, workflowExecutor);
assertEquals(Task.Status.FAILED, task.getStatus());
assertEquals(HttpTask.MISSING_REQUEST, task.getReasonForIncompletion());
}
内容来源于网络,如有侵权,请联系作者删除!