Search in sources :

Example 1 with DefaultExecutedJob

use of com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedJob in project kylo by Teradata.

the class JobModelTransform method executedJob.

public static ExecutedJob executedJob(LatestFeedJobExecution jobExecution) {
    DefaultExecutedJob executedJob = new DefaultExecutedJob();
    executedJob.setExecutionId(jobExecution.getJobExecutionId());
    executedJob.setStartTime(jobExecution.getStartTime());
    executedJob.setEndTime(jobExecution.getEndTime());
    executedJob.setExitCode(jobExecution.getExitCode().name());
    executedJob.setExitStatus(jobExecution.getExitMessage());
    executedJob.setStatus(ExecutionStatus.valueOf(jobExecution.getStatus().name()));
    executedJob.setJobName(jobExecution.getFeedName());
    executedJob.setRunTime(ModelUtils.runTime(jobExecution.getStartTime(), jobExecution.getEndTime()));
    executedJob.setTimeSinceEndTime(ModelUtils.timeSince(jobExecution.getStartTime(), jobExecution.getEndTime()));
    executedJob.setInstanceId(jobExecution.getJobInstanceId());
    executedJob.setStream(jobExecution.isStream());
    executedJob.setFeedId(jobExecution.getFeedId());
    executedJob.setFeedName(jobExecution.getFeedName());
    return executedJob;
}
Also used : DefaultExecutedJob(com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedJob)

Example 2 with DefaultExecutedJob

use of com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedJob in project kylo by Teradata.

the class IntegrationTestBase method getJobs.

protected DefaultExecutedJob[] getJobs() {
    // http://localhost:8400/proxy/v1/jobs
    Response response = given(JobsRestController.BASE).when().get();
    response.then().statusCode(HTTP_OK);
    return JsonPath.from(response.asString()).getObject("data", DefaultExecutedJob[].class);
}
Also used : Response(com.jayway.restassured.response.Response) DefaultExecutedJob(com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedJob)

Example 3 with DefaultExecutedJob

use of com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedJob in project kylo by Teradata.

the class FeedWithConnectedReusableTemplateIT method assertExecutedJobs.

private void assertExecutedJobs(FeedMetadata feed) throws IOException {
    DefaultExecutedJob[] jobs = getJobs(feed.getCategoryAndFeedName().toLowerCase());
    DefaultExecutedJob ingest = Arrays.stream(jobs).findFirst().orElse(null);
    Assert.assertNotNull(ingest);
    Assert.assertEquals(ExecutionStatus.COMPLETED, ingest.getStatus());
    Assert.assertEquals(ExitStatus.COMPLETED.getExitCode(), ingest.getExitCode());
    LOG.info("Asserting user data jobs has expected number of steps");
    DefaultExecutedJob job = getJobWithSteps(ingest.getExecutionId());
    Assert.assertEquals(ingest.getExecutionId(), job.getExecutionId());
    List<ExecutedStep> steps = job.getExecutedSteps();
    Assert.assertEquals(8, steps.size());
    for (ExecutedStep step : steps) {
        Assert.assertEquals(ExitStatus.COMPLETED.getExitCode(), step.getExitCode());
    }
}
Also used : DefaultExecutedJob(com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedJob) ExecutedStep(com.thinkbiganalytics.jobrepo.query.model.ExecutedStep)

Example 4 with DefaultExecutedJob

use of com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedJob in project kylo by Teradata.

the class JobModelTransform method executedJob.

public static ExecutedJob executedJob(BatchJobExecution jobExecution) {
    DefaultExecutedJob job = (DefaultExecutedJob) executedJobSimple(jobExecution);
    Map<String, String> jobExecutionContext = jobExecution.getJobExecutionContextAsMap();
    if (jobExecutionContext != null) {
        job.setExecutionContext(new HashMap<>(jobExecutionContext));
    }
    OpsManagerFeed feed = jobExecution.getJobInstance().getFeed();
    if (feed != null) {
        job.setJobType(feed.getFeedType().name());
    }
    Map<String, String> jobParams = jobExecution.getJobParametersAsMap();
    if (jobParams != null) {
        job.setJobParameters(new HashMap<>(jobParams));
    }
    job.setExecutedSteps(executedSteps(jobExecution.getStepExecutions()));
    return job;
}
Also used : OpsManagerFeed(com.thinkbiganalytics.metadata.api.feed.OpsManagerFeed) DefaultExecutedJob(com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedJob)

Example 5 with DefaultExecutedJob

use of com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedJob in project kylo by Teradata.

the class JobModelTransform method executedJobSimple.

public static ExecutedJob executedJobSimple(BatchJobExecution jobExecution) {
    DefaultExecutedJob job = new DefaultExecutedJob();
    job.setExecutionId(jobExecution.getJobExecutionId());
    job.setStartTime(jobExecution.getStartTime());
    job.setEndTime(jobExecution.getEndTime());
    job.setCreateTime(jobExecution.getCreateTime());
    job.setExitCode(jobExecution.getExitCode().name());
    job.setExitStatus(jobExecution.getExitMessage());
    job.setStatus(ExecutionStatus.valueOf(jobExecution.getStatus().name()));
    job.setJobName(jobExecution.getJobInstance().getJobName());
    job.setRunTime(ModelUtils.runTime(jobExecution.getStartTime(), jobExecution.getEndTime()));
    job.setTimeSinceEndTime(ModelUtils.timeSince(jobExecution.getStartTime(), jobExecution.getEndTime()));
    job.setInstanceId(jobExecution.getJobInstance().getJobInstanceId());
    job.setStream(jobExecution.isStream());
    if (jobExecution.getJobInstance() != null && jobExecution.getJobInstance().getFeed() != null) {
        job.setFeedName(jobExecution.getJobInstance().getFeed().getName());
        job.setFeedId(jobExecution.getJobInstance().getFeed().getId().toString());
    }
    return job;
}
Also used : DefaultExecutedJob(com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedJob)

Aggregations

DefaultExecutedJob (com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedJob)7 Response (com.jayway.restassured.response.Response)2 ExecutedStep (com.thinkbiganalytics.jobrepo.query.model.ExecutedStep)2 OpsManagerFeed (com.thinkbiganalytics.metadata.api.feed.OpsManagerFeed)1