@Override public Date getEndTime() { return stepExecution.getEndTime(); }
/** * Test method for * {@link org.springframework.batch.core.JobExecution#getEndTime()}. */ @Test public void testGetEndTime() { assertNull(execution.getEndTime()); execution.setEndTime(new Date(0L)); assertEquals(0L, execution.getEndTime().getTime()); }
if(lastExecution == null || (curStepExecution.getEndTime() != null && curStepExecution.getEndTime().after(lastExecution.getEndTime()))) { lastExecution = curStepExecution;
/** * Modifications to saved entity do not affect the persisted object. */ @Test public void testPersistentCopy() { StepExecutionDao tested = new MapStepExecutionDao(); JobExecution jobExecution = new JobExecution(77L); StepExecution stepExecution = new StepExecution("stepName", jobExecution); assertNull(stepExecution.getEndTime()); tested.saveStepExecution(stepExecution); stepExecution.setEndTime(new Date()); StepExecution retrieved = tested.getStepExecution(jobExecution, stepExecution.getId()); assertNull(retrieved.getEndTime()); stepExecution.setEndTime(null); tested.updateStepExecution(stepExecution); stepExecution.setEndTime(new Date()); StepExecution stored = tested.getStepExecution(jobExecution, stepExecution.getId()); assertNull(stored.getEndTime()); }
private List<Object[]> buildStepExecutionParameters(StepExecution stepExecution) { Assert.isNull(stepExecution.getId(), "to-be-saved (not updated) StepExecution can't already have an id assigned"); Assert.isNull(stepExecution.getVersion(), "to-be-saved (not updated) StepExecution can't already have a version assigned"); validateStepExecution(stepExecution); stepExecution.setId(stepExecutionIncrementer.nextLongValue()); stepExecution.incrementVersion(); //Should be 0 List<Object[]> parameters = new ArrayList<>(); String exitDescription = truncateExitDescription(stepExecution.getExitStatus().getExitDescription()); Object[] parameterValues = new Object[] { stepExecution.getId(), stepExecution.getVersion(), stepExecution.getStepName(), stepExecution.getJobExecutionId(), stepExecution.getStartTime(), stepExecution.getEndTime(), stepExecution.getStatus().toString(), stepExecution.getCommitCount(), stepExecution.getReadCount(), stepExecution.getFilterCount(), stepExecution.getWriteCount(), stepExecution.getExitStatus().getExitCode(), exitDescription, stepExecution.getReadSkipCount(), stepExecution.getWriteSkipCount(), stepExecution.getProcessSkipCount(), stepExecution.getRollbackCount(), stepExecution.getLastUpdated() }; Integer[] parameterTypes = new Integer[] { Types.BIGINT, Types.INTEGER, Types.VARCHAR, Types.BIGINT, Types.TIMESTAMP, Types.TIMESTAMP, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.TIMESTAMP }; parameters.add(0, Arrays.copyOf(parameterValues,parameterValues.length)); parameters.add(1, Arrays.copyOf(parameterTypes,parameterTypes.length)); return parameters; }
Object[] parameters = new Object[] { stepExecution.getStartTime(), stepExecution.getEndTime(), stepExecution.getStatus().toString(), stepExecution.getCommitCount(), stepExecution.getReadCount(), stepExecution.getFilterCount(), stepExecution.getWriteCount(),
private void assertStepExecutionsAreEqual(StepExecution expected, StepExecution actual) { assertEquals(expected.getId(), actual.getId()); assertEquals(expected.getStartTime(), actual.getStartTime()); assertEquals(expected.getEndTime(), actual.getEndTime()); assertEquals(expected.getSkipCount(), actual.getSkipCount()); assertEquals(expected.getCommitCount(), actual.getCommitCount()); assertEquals(expected.getReadCount(), actual.getReadCount()); assertEquals(expected.getWriteCount(), actual.getWriteCount()); assertEquals(expected.getFilterCount(), actual.getFilterCount()); assertEquals(expected.getWriteSkipCount(), actual.getWriteSkipCount()); assertEquals(expected.getReadSkipCount(), actual.getReadSkipCount()); assertEquals(expected.getProcessSkipCount(), actual.getProcessSkipCount()); assertEquals(expected.getRollbackCount(), actual.getRollbackCount()); assertEquals(expected.getExitStatus(), actual.getExitStatus()); assertEquals(expected.getLastUpdated(), actual.getLastUpdated()); assertEquals(expected.getExitStatus(), actual.getExitStatus()); assertEquals(expected.getJobExecutionId(), actual.getJobExecutionId()); }
private void assertStepExecutionsAreEqual(StepExecution expected, StepExecution actual) { assertEquals(expected.getId(), actual.getId()); assertEquals(expected.getStartTime(), actual.getStartTime()); assertEquals(expected.getEndTime(), actual.getEndTime()); assertEquals(expected.getSkipCount(), actual.getSkipCount()); assertEquals(expected.getCommitCount(), actual.getCommitCount()); assertEquals(expected.getReadCount(), actual.getReadCount()); assertEquals(expected.getWriteCount(), actual.getWriteCount()); assertEquals(expected.getFilterCount(), actual.getFilterCount()); assertEquals(expected.getWriteSkipCount(), actual.getWriteSkipCount()); assertEquals(expected.getReadSkipCount(), actual.getReadSkipCount()); assertEquals(expected.getProcessSkipCount(), actual.getProcessSkipCount()); assertEquals(expected.getRollbackCount(), actual.getRollbackCount()); assertEquals(expected.getExitStatus(), actual.getExitStatus()); assertEquals(expected.getLastUpdated(), actual.getLastUpdated()); assertEquals(expected.getExitStatus(), actual.getExitStatus()); assertEquals(expected.getJobExecutionId(), actual.getJobExecutionId()); } }
@Override public Date getEndTime() { return stepExecution.getEndTime(); }
@Override public Date getEndTime() { return stepExecution.getEndTime(); }
@Override public Date getEndTime() { return stepExecution.getEndTime(); }
public double getLatestDuration() { StepExecution stepExecution = getLatestStepExecution(stepName); if (stepExecution==null) { return 0; } Date endTime = stepExecution.getEndTime(); return (endTime != null ? endTime.getTime() : System.currentTimeMillis()) - stepExecution.getStartTime().getTime(); }
public StepExecutionProgressInfo(StepExecution stepExecution, StepExecutionHistory stepExecutionHistory) { this.stepExecution = stepExecution; this.stepExecutionHistory = stepExecutionHistory; Date startTime = stepExecution.getStartTime(); Date endTime = stepExecution.getEndTime(); if (endTime == null) { endTime = new Date(); } else { isFinished = true; } if (startTime == null) { startTime = new Date(); } duration = endTime.getTime() - startTime.getTime(); percentageComplete = calculatePercentageComplete(); }
public StepExecutionProgress(StepExecution stepExecution, StepExecutionHistory stepExecutionHistory) { this.stepExecution = stepExecution; this.stepExecutionHistory = stepExecutionHistory; Date startTime = stepExecution.getStartTime(); Date endTime = stepExecution.getEndTime(); if (endTime == null) { endTime = new Date(); } else { isFinished = true; } if (startTime == null) { startTime = new Date(); } duration = endTime.getTime() - startTime.getTime(); percentageComplete = calculatePercentageComplete(); }
public StepExecutionProgress(StepExecution stepExecution, StepExecutionHistory stepExecutionHistory) { this.stepExecution = stepExecution; this.stepExecutionHistory = stepExecutionHistory; Date startTime = stepExecution.getStartTime(); Date endTime = stepExecution.getEndTime(); if (endTime == null) { endTime = new Date(); } else { isFinished = true; } if (startTime == null) { startTime = new Date(); } duration = endTime.getTime() - startTime.getTime(); percentageComplete = calculatePercentageComplete(); }
public StepExecutionProgressInfo(StepExecution stepExecution, StepExecutionHistory stepExecutionHistory) { this.stepExecution = stepExecution; this.stepExecutionHistory = stepExecutionHistory; Date startTime = stepExecution.getStartTime(); Date endTime = stepExecution.getEndTime(); if (endTime == null) { endTime = new Date(); } else { isFinished = true; } if (startTime == null) { startTime = new Date(); } duration = endTime.getTime() - startTime.getTime(); percentageComplete = calculatePercentageComplete(); }
private void writeJobExecutionStatus(JobExecution jobExecution, JobParameters jobParameters) { StepExecution step = jobExecution.getStepExecutions().toArray(new StepExecution[]{})[0]; String schemaName = jobParameters.getString("schemaName"); logger.info(String.format("Written %d ddls with user objects from total %d in schema %s", step.getWriteCount(), step.getReadCount(), schemaName)); logger.info(String.format("Skip processing %d user objects from total %d in schema %s", step.getFilterCount(), step.getReadCount(), schemaName)); long seconds = ((step.getEndTime().getTime()-step.getStartTime().getTime())/1000); logger.info(String.format("scheme2ddl of schema %s %s in %d seconds", schemaName, jobExecution.getStatus().toString().toLowerCase(), seconds)); }
private void executionTimeLog(JobExecution jobExecution) { if (!log.isDebugEnabled()) { return; } log.debug("Execution time {}(JobExecutionId:{} status:{}) in {} ms", jobExecution.getJobInstance().getJobName(), jobExecution.getJobInstance().getId(), jobExecution.getStatus(), jobExecution.getEndTime().getTime() - jobExecution.getStartTime().getTime()); jobExecution.getStepExecutions().forEach(s -> log.debug("Execution time {} in {} ms", s.getStepName(), s.getEndTime().getTime() - s.getStartTime().getTime()) ); }
@CliCommand(value = STEP_EXECUTION_LIST, help = "List step executions filtered by jobExecutionId") public Table stepExecutionList(@CliOption(key = { "id" }, help = "the job execution id to be used as a filter", mandatory = true) long id) { final PagedResources<StepExecutionResource> steps = jobOperations().stepExecutionList(id); TableModelBuilder<Object> modelBuilder = new TableModelBuilder<>(); modelBuilder.addRow().addValue("ID ").addValue("Step Name ").addValue("Job Exec Id ").addValue("Start Time ") .addValue("End Time ").addValue("Status "); for (StepExecutionResource step : steps) { modelBuilder.addRow().addValue(step.getStepExecution().getId()) .addValue(step.getStepExecution().getStepName()).addValue(id) .addValue(step.getStepExecution().getStartTime()).addValue(step.getStepExecution().getEndTime()) .addValue(step.getStepExecution().getStatus().name()); } TableBuilder builder = new TableBuilder(modelBuilder.build()); DataFlowTables.applyStyle(builder); return builder.build(); }
@CliCommand(value = STEP_EXECUTION_LIST, help = "List step executions filtered by jobExecutionId") public Table stepExecutionList(@CliOption(key = { "id" }, help = "the job execution id to be used as a filter", mandatory = true) long id) { final PagedResources<StepExecutionResource> steps = jobOperations().stepExecutionList(id); TableModelBuilder<Object> modelBuilder = new TableModelBuilder<>(); modelBuilder.addRow().addValue("ID ").addValue("Step Name ").addValue("Job Exec Id ").addValue("Start Time ") .addValue("End Time ").addValue("Status "); for (StepExecutionResource step : steps) { modelBuilder.addRow().addValue(step.getStepExecution().getId()) .addValue(step.getStepExecution().getStepName()).addValue(id) .addValue(step.getStepExecution().getStartTime()).addValue(step.getStepExecution().getEndTime()) .addValue(step.getStepExecution().getStatus().name()); } TableBuilder builder = new TableBuilder(modelBuilder.build()); DataFlowTables.applyStyle(builder); return builder.build(); }