Skip to content

Commit b57a2e0

Browse files
committed
add partial status as valid status for completion (#3263)
1 parent 8e0dc5b commit b57a2e0

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/apps/job-launcher/server/src/common/constants/errors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export enum ErrorJob {
1313
JobParamsValidationFailed = 'Job parameters validation failed',
1414
InvalidEventType = 'Invalid event type',
1515
InvalidStatusCancellation = 'Job has an invalid status for cancellation',
16+
InvalidStatusCompletion = 'Job has an invalid status for completion',
1617
NotLaunched = 'Not launched',
1718
TaskDataNotFound = 'Task data not found',
1819
HCaptchaInvalidJobType = 'hCaptcha invalid job type',

packages/apps/job-launcher/server/src/modules/job/job.service.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,8 +1731,14 @@ export class JobService {
17311731
if (jobEntity.status === JobStatus.COMPLETED) {
17321732
return;
17331733
}
1734-
if (jobEntity.status !== JobStatus.LAUNCHED) {
1735-
throw new ControlledError(ErrorJob.NotLaunched, HttpStatus.CONFLICT);
1734+
if (
1735+
jobEntity.status !== JobStatus.LAUNCHED &&
1736+
jobEntity.status !== JobStatus.PARTIAL
1737+
) {
1738+
throw new ControlledError(
1739+
ErrorJob.InvalidStatusCompletion,
1740+
HttpStatus.CONFLICT,
1741+
);
17361742
}
17371743

17381744
jobEntity.status = JobStatus.COMPLETED;

0 commit comments

Comments
 (0)