Skip to content
Snippets Groups Projects
Verified Commit fd481eb0 authored by Dorian Koch's avatar Dorian Koch
Browse files

Do not delete jobs manually

parent aeefd324
No related branches found
No related tags found
No related merge requests found
...@@ -11,8 +11,3 @@ POSTGRES = { ...@@ -11,8 +11,3 @@ POSTGRES = {
"database": "videoag" "database": "videoag"
} }
''' '''
# Whether to immediately delete jobs after they have been processed
# Ideally everything that is needed will be extracted from the job and stored in the database, so this should be set to True
DELETE_JOBS_AFTER_SUCCESS = True
DELETE_JOBS_AFTER_FAILURE = False
...@@ -49,13 +49,9 @@ class WrappedJob(Event): ...@@ -49,13 +49,9 @@ class WrappedJob(Event):
if self.job_state == JobState.FINISHED: if self.job_state == JobState.FINISHED:
self.success(cstate) self.success(cstate)
self.jobData.update_state(cstate, JobState.FINISHED_AND_PROCESSED) self.jobData.update_state(cstate, JobState.FINISHED_AND_PROCESSED)
if cstate.config.get("DELETE_JOBS_AFTER_SUCCESS", True):
cstate.k8s.delete_job_by_id(self.job_id)
elif self.job_state == JobState.FAILED: elif self.job_state == JobState.FAILED:
self.failure(cstate) self.failure(cstate)
self.jobData.update_state(cstate, JobState.FAILED_AND_PROCESSED) self.jobData.update_state(cstate, JobState.FAILED_AND_PROCESSED)
if cstate.config.get("DELETE_JOBS_AFTER_FAILURE", True):
cstate.k8s.delete_job_by_id(self.job_id)
else: else:
raise Exception(f"Job is in unexpected state: {self.job_state}") raise Exception(f"Job is in unexpected state: {self.job_state}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment