use of com.netflix.conductor.common.run.TaskSummary in project conductor by Netflix.
the class TestElasticSearchRestDAOV7 method shouldIndexTask.
@Test
public void shouldIndexTask() {
Workflow workflow = TestUtils.loadWorkflowSnapshot("workflow");
Task task = workflow.getTasks().get(0);
TaskSummary summary = new TaskSummary(task);
indexDAO.indexTask(task);
List<String> tasks = tryFindResults(() -> searchTasks(workflow));
assertEquals(summary.getTaskId(), tasks.get(0));
}
use of com.netflix.conductor.common.run.TaskSummary in project conductor by Netflix.
the class TestElasticSearchRestDAOV7 method shouldIndexTaskAsync.
@Test
public void shouldIndexTaskAsync() throws Exception {
Workflow workflow = TestUtils.loadWorkflowSnapshot("workflow");
Task task = workflow.getTasks().get(0);
TaskSummary summary = new TaskSummary(task);
indexDAO.asyncIndexTask(task).get();
List<String> tasks = tryFindResults(() -> searchTasks(workflow));
assertEquals(summary.getTaskId(), tasks.get(0));
}
use of com.netflix.conductor.common.run.TaskSummary in project conductor by Netflix.
the class ElasticSearchDAOV6 method indexTask.
@Override
public void indexTask(Task task) {
try {
long startTime = Instant.now().toEpochMilli();
String id = task.getTaskId();
TaskSummary summary = new TaskSummary(task);
byte[] doc = objectMapper.writeValueAsBytes(summary);
String docType = StringUtils.isBlank(docTypeOverride) ? TASK_DOC_TYPE : docTypeOverride;
UpdateRequest req = new UpdateRequest(taskIndexName, docType, id);
req.doc(doc, XContentType.JSON);
req.upsert(doc, XContentType.JSON);
indexObject(req, TASK_DOC_TYPE);
long endTime = Instant.now().toEpochMilli();
LOGGER.debug("Time taken {} for indexing task:{} in workflow: {}", endTime - startTime, task.getTaskId(), task.getWorkflowInstanceId());
Monitors.recordESIndexTime("index_task", TASK_DOC_TYPE, endTime - startTime);
Monitors.recordWorkerQueueSize("indexQueue", ((ThreadPoolExecutor) executorService).getQueue().size());
} catch (Exception e) {
LOGGER.error("Failed to index task: {}", task.getTaskId(), e);
}
}
use of com.netflix.conductor.common.run.TaskSummary in project conductor by Netflix.
the class ElasticSearchRestDAOV7 method indexTask.
@Override
public void indexTask(Task task) {
try {
long startTime = Instant.now().toEpochMilli();
String taskId = task.getTaskId();
TaskSummary summary = new TaskSummary(task);
indexObject(taskIndexName, TASK_DOC_TYPE, taskId, summary);
long endTime = Instant.now().toEpochMilli();
logger.debug("Time taken {} for indexing task:{} in workflow: {}", endTime - startTime, taskId, task.getWorkflowInstanceId());
Monitors.recordESIndexTime("index_task", TASK_DOC_TYPE, endTime - startTime);
Monitors.recordWorkerQueueSize("indexQueue", ((ThreadPoolExecutor) executorService).getQueue().size());
} catch (Exception e) {
logger.error("Failed to index task: {}", task.getTaskId(), e);
}
}
use of com.netflix.conductor.common.run.TaskSummary in project conductor by Netflix.
the class TestElasticSearchRestDAOV6 method shouldIndexTaskAsync.
@Test
public void shouldIndexTaskAsync() throws Exception {
Workflow workflow = TestUtils.loadWorkflowSnapshot("workflow");
Task task = workflow.getTasks().get(0);
TaskSummary summary = new TaskSummary(task);
indexDAO.asyncIndexTask(task).get();
List<String> tasks = tryFindResults(() -> searchTasks(workflow));
assertEquals(summary.getTaskId(), tasks.get(0));
}
Aggregations