Search in sources :

Example 1 with FlowExecution

use of models.FlowExecution in project dr-elephant by linkedin.

the class AutoTuningAPIHelper method insertDefaultJobExecution.

/**
 * Inserts default job execution in database
 * @param job Job
 * @param flowExecId Flow execution id
 * @param jobExecId Job execution id
 * @param flowExecUrl Flow execution url
 * @param jobExecUrl Job execution url
 * @return default job execution
 */
private TuningJobExecution insertDefaultJobExecution(JobDefinition job, String flowExecId, String jobExecId, String flowExecUrl, String jobExecUrl, FlowDefinition flowDefinition, TuningAlgorithm tuningAlgorithm) {
    logger.debug("Starting insertDefaultJobExecution");
    FlowExecution flowExecution = FlowExecution.find.where().eq(FlowExecution.TABLE.flowExecId, flowExecId).findUnique();
    if (flowExecution == null) {
        flowExecution = new FlowExecution();
        flowExecution.flowExecId = flowExecId;
        flowExecution.flowExecUrl = flowExecUrl;
        flowExecution.flowDefinition = flowDefinition;
        flowExecution.save();
    }
    JobExecution jobExecution = JobExecution.find.where().eq(JobExecution.TABLE.jobExecId, jobExecId).findUnique();
    if (jobExecution == null) {
        jobExecution = new JobExecution();
        jobExecution.job = job;
        jobExecution.executionState = ExecutionState.NOT_STARTED;
        jobExecution.jobExecId = jobExecId;
        jobExecution.jobExecUrl = jobExecUrl;
        jobExecution.flowExecution = flowExecution;
        jobExecution.save();
    }
    TuningJobExecution tuningJobExecution = new TuningJobExecution();
    tuningJobExecution.jobExecution = jobExecution;
    tuningJobExecution.tuningAlgorithm = tuningAlgorithm;
    tuningJobExecution.paramSetState = ParamSetStatus.CREATED;
    tuningJobExecution.isDefaultExecution = true;
    tuningJobExecution.save();
    logger.debug("Finishing insertDefaultJobExecution. Job Execution ID " + jobExecution.jobExecId);
    return tuningJobExecution;
}
Also used : TuningJobExecution(models.TuningJobExecution) JobExecution(models.JobExecution) FlowExecution(models.FlowExecution) TuningJobExecution(models.TuningJobExecution)

Example 2 with FlowExecution

use of models.FlowExecution in project dr-elephant by linkedin.

the class AutoTuningAPIHelper method updateJobExecutionParameter.

/**
 *This is to update job execution with IN_PROGRESS and parameter set with IN_PROGRESS. Also update flow_exec_id
 *, flowExecURL, JobExecID and jobExecURL
 * @param tuningJobExecution
 * @param tuningInput
 */
private void updateJobExecutionParameter(TuningJobExecution tuningJobExecution, TuningInput tuningInput) {
    FlowExecution flowExecution = FlowExecution.find.where().eq(FlowExecution.TABLE.flowExecId, tuningInput.getFlowExecId()).findUnique();
    if (flowExecution == null) {
        flowExecution = new FlowExecution();
        flowExecution.flowExecId = tuningInput.getFlowExecId();
        flowExecution.flowExecUrl = tuningInput.getFlowExecUrl();
        flowExecution.flowDefinition = tuningJobExecution.jobExecution.job.flowDefinition;
        flowExecution.save();
    }
    JobExecution jobExecution = tuningJobExecution.jobExecution;
    jobExecution.jobExecId = tuningInput.getJobExecId();
    jobExecution.jobExecUrl = tuningInput.getJobExecUrl();
    jobExecution.executionState = ExecutionState.IN_PROGRESS;
    jobExecution.flowExecution = flowExecution;
    logger.debug("Saving job execution" + jobExecution.jobExecId);
    jobExecution.save();
    tuningJobExecution.jobExecution = jobExecution;
    tuningJobExecution.paramSetState = ParamSetStatus.SENT;
    tuningJobExecution.save();
}
Also used : TuningJobExecution(models.TuningJobExecution) JobExecution(models.JobExecution) FlowExecution(models.FlowExecution)

Aggregations

FlowExecution (models.FlowExecution)2 JobExecution (models.JobExecution)2 TuningJobExecution (models.TuningJobExecution)2