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
GitLab 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
53eae502
Verified
Commit
53eae502
authored
10 months ago
by
Dorian Koch
Browse files
Options
Downloads
Patches
Plain Diff
Fix sorter id, catch exceptions
parent
2855edc6
Loading
Loading
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/job_controller/actions/run_sorter.py
+23
-17
23 additions, 17 deletions
src/job_controller/actions/run_sorter.py
with
23 additions
and
17 deletions
src/job_controller/actions/run_sorter.py
+
23
−
17
View file @
53eae502
...
...
@@ -13,16 +13,20 @@ class RunSorter(GeneratorRecurringEvent):
self
.
interval
=
interval
def
generator
(
self
,
cstate
:
ControllerState
)
->
Generator
[
datetime
.
timedelta
|
datetime
.
datetime
,
None
,
None
]:
self
.
idx
=
datetime
.
datetime
.
now
().
timestamp
()
self
.
idx
=
int
(
datetime
.
datetime
.
now
().
timestamp
()
)
while
True
:
try
:
# wrap the entire thing in a try catch because this should never fail
sorter_job_data
=
JobData
(
f
"
jc-internal-sorter-
{
self
.
idx
}
"
,
job_type
=
"
sorter
"
,
job_state
=
JobState
.
SPAWNING
)
cstate
.
job_api
.
create_job
(
sorter_job_data
)
# put in database, but it wont be picked up by find_ready_jobs because it's already in spawning state
# put in database, but it wont be picked up by find_ready_jobs because it's already in spawning state
cstate
.
job_api
.
create_job
(
sorter_job_data
)
wrapped
=
cstate
.
wrap_job
(
sorter_job_data
)
spawnJobEvt
=
SpawnJob
(
wrapped
)
cstate
.
event_queue
.
put
(
spawnJobEvt
)
while
not
spawnJobEvt
.
done
:
# wait for spawn job to be done
yield
spawnJobEvt
.
due_at
# because the event queue is stable, we will be queued after the spawnjob event executes
print
(
"
Sorter job spawned
"
)
watchJobEvt
=
spawnJobEvt
.
watch_job_evt
if
watchJobEvt
is
None
:
print
(
"
Spawning sorter job failed!
"
)
...
...
@@ -31,4 +35,6 @@ class RunSorter(GeneratorRecurringEvent):
yield
watchJobEvt
.
due_at
# spawn job is done
print
(
"
Sorter job done
"
)
except
Exception
as
e
:
print
(
f
"
Error in RunSorter:
{
e
}
"
)
yield
self
.
interval
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