use of org.platformlayer.jobs.model.JobExecutionList in project platformlayer by platformlayer.
the class ListJobExecutions method runCommand.
@Override
public Object runCommand() throws PlatformLayerClientException {
PlatformLayerClient client = getPlatformLayerClient();
JobExecutionList runs;
if (jobId == null) {
runs = client.listJobExecutions();
} else {
runs = client.listJobExecutions(jobId);
}
return runs;
}
use of org.platformlayer.jobs.model.JobExecutionList in project platformlayer by platformlayer.
the class ListJobExecutions method formatRaw.
@Override
public void formatRaw(Object o, PrintWriter writer) {
JobExecutionList jobs = (JobExecutionList) o;
switch(getFormat()) {
case JSON:
JsonHelper<JobExecutionList> jsonHelper = JsonHelper.build(JobExecutionList.class);
boolean formatted = true;
try {
String json = jsonHelper.marshal(jobs, formatted);
writer.println(json);
return;
} catch (IOException e) {
throw new CliException("Error formatting for output", e);
}
}
Ansi ansi = new Ansi(writer);
for (JobExecutionData job : jobs) {
JobState state = job.state;
if (state != null) {
switch(job.state) {
case FAILED:
ansi.setColorRed();
break;
case SUCCESS:
ansi.setColorGreen();
break;
case RUNNING:
ansi.setColorBlue();
break;
default:
ansi.setColorBlue();
break;
}
} else {
ansi.setColorBlue();
}
writer.println(job.getJobId() + "/" + job.executionId);
}
ansi.reset();
}
use of org.platformlayer.jobs.model.JobExecutionList in project platformlayer by platformlayer.
the class JobResource method getRuns.
@GET
@Path("runs")
@Produces({ XML, JSON })
public JobExecutionList getRuns() throws OpsException {
List<JobExecutionData> jobList = jobRegistry.listExecutions(job.getJobKey());
JobExecutionList runs = JobExecutionList.create(jobList);
return runs;
}
use of org.platformlayer.jobs.model.JobExecutionList in project platformlayer by platformlayer.
the class JobsCollectionResource method getExecutions.
@GET
@Path("runs")
@Produces({ XML, JSON })
public JobExecutionList getExecutions() throws OpsException {
JobQuery jobQuery = JobQuery.build(getProject(), filterTarget);
JobExecutionList executions = jobRegistry.listRecentExecutions(jobQuery);
return executions;
}
Aggregations