Skip to content

Commit

Permalink
tasks: throw error in the sync task run
Browse files Browse the repository at this point in the history
  • Loading branch information
yashlamba authored and alejandromumo committed Jun 4, 2024
1 parent c11c7a2 commit 894fd96
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions invenio_jobs/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ def execute_run(self, run_id, kwargs=None):
update_run(run, status=RunStatusEnum.RUNNING, started_at=datetime.now(timezone.utc))

try:
result = task.apply(kwargs=kwargs)
except Exception as e:
result = task.apply(kwargs=kwargs, throw=True)
except SystemExit as e:
update_run(
run,
status=RunStatusEnum.FAILED,
status=RunStatusEnum.CANCELLED,
finished_at=datetime.now(timezone.utc),
)
return
except SystemExit as e:
raise e
except Exception as e:
update_run(
run,
status=RunStatusEnum.CANCELLED,
status=RunStatusEnum.FAILED,
finished_at=datetime.now(timezone.utc),
)
raise e
return

update_run(
run,
Expand Down

0 comments on commit 894fd96

Please sign in to comment.