Search in sources :

Example 1 with WorkflowTaskResult

use of com.graphaware.nlp.dsl.result.WorkflowTaskResult in project neo4j-nlp by graphaware.

the class WorkflowTaskProcedure method start.

@Procedure(name = "ga.nlp.workflow.task.start", mode = Mode.WRITE)
@Description("Start a Task")
public Stream<WorkflowTaskResult> start(@Name(value = "name") String name) {
    try {
        WorkflowTask workflowTask = getWorkflowManager().getWorkflowTask(name);
        if (workflowTask == null) {
            throw new RuntimeException("Pipeline task not found");
        }
        TaskManager.getInstance().execute(workflowTask);
        return Stream.of(new WorkflowTaskResult(workflowTask));
    } catch (Exception e) {
        LOG.error("ERROR in WorkflowTaskProcedure", e);
        throw new RuntimeException(e);
    }
}
Also used : WorkflowTask(com.graphaware.nlp.workflow.task.WorkflowTask) WorkflowTaskResult(com.graphaware.nlp.dsl.result.WorkflowTaskResult) Description(org.neo4j.procedure.Description) Procedure(org.neo4j.procedure.Procedure)

Aggregations

WorkflowTaskResult (com.graphaware.nlp.dsl.result.WorkflowTaskResult)1 WorkflowTask (com.graphaware.nlp.workflow.task.WorkflowTask)1 Description (org.neo4j.procedure.Description)1 Procedure (org.neo4j.procedure.Procedure)1