Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
job_controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
videoag
job_controller
Commits
f54dd511
Verified
Commit
f54dd511
authored
9 months ago
by
Dorian Koch
Browse files
Options
Downloads
Patches
Plain Diff
Don't immediately delete everything after processing
parent
a607687e
Branches
Branches containing commit
Tags
v1.0.2
Tags containing commit
No related merge requests found
Pipeline
#6475
passed
9 months ago
Stage: deploy
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
config/job_controller_config.py
+5
-0
5 additions, 0 deletions
config/job_controller_config.py
src/jobs/wrapped_job.py
+5
-2
5 additions, 2 deletions
src/jobs/wrapped_job.py
with
10 additions
and
2 deletions
config/job_controller_config.py
+
5
−
0
View file @
f54dd511
...
@@ -11,3 +11,8 @@ POSTGRES = {
...
@@ -11,3 +11,8 @@ 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
This diff is collapsed.
Click to expand it.
src/jobs/wrapped_job.py
+
5
−
2
View file @
f54dd511
...
@@ -40,13 +40,16 @@ class WrappedJob(Event):
...
@@ -40,13 +40,16 @@ 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
}
"
)
# delete from k8s
cstate
.
k8s
.
delete_job_by_id
(
self
.
job_id
)
# update state to processed
# update state to processed
if
self
.
job_state
==
JobState
.
FINISHED_AND_PROCESSED
or
self
.
job_state
==
JobState
.
FAILED_AND_PROCESSED
:
if
self
.
job_state
==
JobState
.
FINISHED_AND_PROCESSED
or
self
.
job_state
==
JobState
.
FAILED_AND_PROCESSED
:
return
EventResult
.
DONE
return
EventResult
.
DONE
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment