Skip to content

Commit

Permalink
feat(job): set KILLED status to cancelled jobserrored
Browse files Browse the repository at this point in the history
  • Loading branch information
pl-buiquang committed Jan 31, 2025
1 parent 9910aa2 commit 86fea9f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/scala/fr/aphp/id/eds/requester/jobs/JobManager.scala
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class JobManager() {
result: Either[Throwable, JobBaseResult]): Unit = {
val callbackResult = result match {
case Left(wrapped) =>
Map("request_job_status" -> JobExecutionStatus.ERROR,
Map("request_job_status" -> jobs(jobId).status,
"message" -> wrapped.getMessage.replaceAll("[^\\x20-\\x7E]", ""))
case Right(value) => {
Map("request_job_status" -> value.status) ++ value.data ++ Map("extra" -> value.extra)
Expand Down Expand Up @@ -120,7 +120,13 @@ class JobManager() {
val formattedResult = buildResult(result, jobMode, jobExecutor)
val (status, execution) =
result match {
case Left(wrappedError) => (JobExecutionStatus.ERROR, Future.failed(wrappedError.getCause))
case Left(wrappedError) => {
if (wrappedError.getMessage.contains("cancelled part of cancelled job group")) {
(JobExecutionStatus.KILLED, Future.failed(wrappedError.getCause))
} else {
(JobExecutionStatus.ERROR, Future.failed(wrappedError.getCause))
}
}
case Right(value) => (JobExecutionStatus.FINISHED, Future.successful(value))
}
jobs(jobId) = JobInfo(status,
Expand Down

0 comments on commit 86fea9f

Please sign in to comment.