Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.web
Commits
0332a1c2
Commit
0332a1c2
authored
6 years ago
by
Samuel GAIST
Browse files
Options
Downloads
Patches
Plain Diff
[backend][helpers] Simply block canceling and failure code
parent
ac559ecd
No related branches found
No related tags found
2 merge requests
!255
1.4.x
,
!253
Improve block state change
Pipeline
#24560
passed
6 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beat/web/backend/helpers.py
+5
-22
5 additions, 22 deletions
beat/web/backend/helpers.py
with
5 additions
and
22 deletions
beat/web/backend/helpers.py
+
5
−
22
View file @
0332a1c2
...
...
@@ -712,9 +712,7 @@ def update_job(job):
cached_file
.
update
(
Block
.
FAILED
)
# Update the block
job
.
block
.
status
=
Block
.
FAILED
job
.
block
.
end_date
=
job
.
end_date
job
.
block
.
save
()
job
.
block
.
set_failed
(
job
.
end_date
)
# Cancel all the remaining blocks of the experiment
splits_to_cancel
.
extend
(
cancel_all_blocks
(
job
.
block
.
experiment
))
...
...
@@ -728,9 +726,7 @@ def update_job(job):
mirror_job
.
end_date
=
job
.
end_date
mirror_job
.
save
()
mirror_job
.
block
.
status
=
Block
.
FAILED
mirror_job
.
block
.
end_date
=
job
.
end_date
mirror_job
.
block
.
save
()
mirror_job
.
block
.
set_failed
(
job
.
end_date
)
# Cancel all the remaining blocks of the experiment
splits_to_cancel
.
extend
(
cancel_all_blocks
(
mirror_job
.
block
.
experiment
))
...
...
@@ -795,9 +791,7 @@ def update_job(job):
cached_file
.
update
(
Block
.
CANCELLED
)
# Update the block
job
.
block
.
status
=
Block
.
CANCELLED
job
.
block
.
end_date
=
job
.
end_date
job
.
block
.
save
()
job
.
block
.
set_canceled
(
job
.
end_date
)
# Update the experiment
update_experiment
(
job
.
block
.
experiment
)
...
...
@@ -874,12 +868,7 @@ def cancel_all_blocks(experiment):
# (If possible) Mark the block as cancelled
if
block
.
job
.
splits
.
filter
(
status
=
JobSplit
.
CANCELLING
).
count
()
==
0
:
block
.
status
=
Block
.
CANCELLED
block
.
end_date
=
datetime
.
now
()
if
block
.
start_date
is
None
:
block
.
start_date
=
block
.
end_date
block
.
save
()
block
.
set_canceled
()
block
.
job
.
delete
()
...
...
@@ -888,15 +877,9 @@ def cancel_all_blocks(experiment):
.
filter
(
job__mirror
=
True
)
for
block
in
mirror_blocks_to_cancel
:
block
.
status
=
Block
.
CANCELLED
block
.
end_date
=
datetime
.
now
()
if
block
.
start_date
is
None
:
block
.
start_date
=
block
.
end_date
block
.
save
()
block
.
set_canceled
()
block
.
job
.
delete
()
return
splits_to_cancel
...
...
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