scheduler/src/main/java/com/cognitree/kronos/scheduler/TaskService.java
/**
     * creates a task instance from workflow task.
     *
     * @param namespace          namespace of the task
     * @param workflowTask       task definition
     * @param jobId              id of the job task belongs to
     * @param workflowName       name of the workflow task belongs to
     * @param workflowProperties workflow properties to be updated in task
     * @return
     * @throws ServiceException
     * @throws ValidationException
     */
creates a task instance from workflow task.
creates a task instance from workflow task .
Task create(String namespace, WorkflowTask workflowTask, String jobId, String workflowName,
                Map<String, Object> workflowProperties)
            throws ServiceException, ValidationException {
        logger.info("Received request to create task from workflow task {} for job {}, workflow {} under namespace {}",
                workflowTask, jobId, workflowName, namespace);
        validateJob(namespace, jobId, workflowName);
        Task task = new Task();
        task.setName(UUID.randomUUID().toString());
        task.setJob(jobId);
        task.setWorkflow(workflowName);
        task.setName(workflowTask.getName());
        task.setNamespace(namespace);
        task.setType(workflowTask.getType());
        task.setPolicies(workflowTask.getPolicies());
        task.setMaxExecutionTimeInMs(workflowTask.getMaxExecutionTimeInMs());
        task.setDependsOn(workflowTask.getDependsOn());
        final Map<String, Object> taskProperties = modifyAndGetTaskProperties(workflowTask.getProperties(), workflowProperties);
        task.setProperties(taskProperties);
        task.setCreatedAt(System.currentTimeMillis());
        try {
            taskStore.store(task);
        } catch (StoreException e) {
            logger.error("unable to add task {}", task.getIdentity(), e);
            throw new ServiceException(e.getMessage(), e.getCause());
        }
        return task;
    }
Task create ( String namespace , WorkflowTask workflowTask , String jobId , String workflowName , Map < String , Object > workflowProperties ) throws ServiceException , ValidationException { logger . info ( "Received request to create task from workflow task {} for job {}, workflow {} under namespace {}" , workflowTask , jobId , workflowName , namespace ) ; validateJob ( namespace , jobId , workflowName ) ; Task task = new Task ( ) ; task . setName ( UUID . randomUUID ( ) . toString ( ) ) ; task . setJob ( jobId ) ; task . setWorkflow ( workflowName ) ; task . setName ( workflowTask . getName ( ) ) ; task . setNamespace ( namespace ) ; task . setType ( workflowTask . getType ( ) ) ; task . setPolicies ( workflowTask . getPolicies ( ) ) ; task . setMaxExecutionTimeInMs ( workflowTask . getMaxExecutionTimeInMs ( ) ) ; task . setDependsOn ( workflowTask . getDependsOn ( ) ) ; final Map < String , Object > taskProperties = modifyAndGetTaskProperties ( workflowTask . getProperties ( ) , workflowProperties ) ; task . setProperties ( taskProperties ) ; task . setCreatedAt ( System . currentTimeMillis ( ) ) ; try { taskStore . store ( task ) ; } catch ( StoreException e ) { logger . error ( "unable to add task {}" , task . getIdentity ( ) , e ) ; throw new ServiceException ( e . getMessage ( ) , e . getCause ( ) ) ; } return task ; }
creates a task instance from workflow task.
creates a task instance from workflow task .