Skip to content

Commit

Permalink
Planner: unit test enhanced for order, job and job step actions. Chec…
Browse files Browse the repository at this point in the history
…k of of job and job step states after order action added. Don't close h2 database automatically on exit.
  • Loading branch information
emelchinger committed Mar 15, 2024
1 parent eb31d71 commit fe5254a
Show file tree
Hide file tree
Showing 4 changed files with 396 additions and 118 deletions.
2 changes: 1 addition & 1 deletion logging/src/site/resources/logging.html

Large diffs are not rendered by default.

24 changes: 4 additions & 20 deletions planner/src/main/java/de/dlr/proseo/planner/util/JobStepUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -423,32 +423,16 @@ public PlannerResultMessage cancel(JobStep js) {
if (js != null) {
switch (js.getJobStepState()) {
case PLANNED:
case READY:
case WAITING_INPUT:
js.setJobStepState(de.dlr.proseo.model.JobStep.JobStepState.FAILED);
js.incrementVersion();
RepositoryService.getJobStepRepository().save(js);
em.merge(js);
answer.setMessage(PlannerMessage.JOBSTEP_CANCELED);
break;
case READY:
case WAITING_INPUT:
case RUNNING:
Boolean deleted = false;
KubeConfig kc = productionPlanner.getKubeConfig(js.getJob().getProcessingFacility().getName());
if (kc != null) {
KubeJob kj = kc.getKubeJob(ProductionPlanner.jobNamePrefix + js.getId());
if (kj != null) {
deleted = kc.deleteJob(kj.getJobName());
}
}
if (deleted) {
js.setJobStepState(de.dlr.proseo.model.JobStep.JobStepState.FAILED);
js.incrementVersion();
RepositoryService.getJobStepRepository().save(js);
em.merge(js);
answer.setMessage(PlannerMessage.JOBSTEP_CANCELED);
} else {
answer.setMessage(PlannerMessage.JOBSTEP_ALREADY_RUNNING);
}
answer.setMessage(PlannerMessage.JOBSTEP_ALREADY_RUNNING);
break;
case COMPLETED:
answer.setMessage(PlannerMessage.JOBSTEP_ALREADY_COMPLETED);
Expand Down Expand Up @@ -536,13 +520,13 @@ public PlannerResultMessage retry(JobStep js) {
if (js != null) {
switch (js.getJobStepState()) {
case PLANNED:
case WAITING_INPUT:
case READY:
case RUNNING:
case COMPLETED:
case CLOSED:
answer.setMessage(PlannerMessage.JOBSTEP_COULD_NOT_RETRY);
break;
case WAITING_INPUT:
case FAILED:
Product jsp = js.getOutputProduct();
if (jsp != null) {
Expand Down
Loading

0 comments on commit fe5254a

Please sign in to comment.