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
3223d661
Commit
3223d661
authored
8 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
[experiments] Small fixes
parent
3628ff37
No related branches found
No related tags found
1 merge request
!194
Scheduler
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beat/web/experiments/models.py
+21
-14
21 additions, 14 deletions
beat/web/experiments/models.py
with
21 additions
and
14 deletions
beat/web/experiments/models.py
+
21
−
14
View file @
3223d661
...
...
@@ -601,8 +601,8 @@ class Experiment(Shareable):
def
job_splits
(
self
,
status
=
None
):
from
..backend.models
import
JobSplit
retval
=
JobSplit
.
objects
.
filter
(
job__block__in
=
self
.
blocks
)
if
stat
e
is
not
None
:
retval
=
JobSplit
.
objects
.
filter
(
job__block__in
=
self
.
blocks
.
all
()
)
if
stat
us
is
not
None
:
retval
=
retval
.
filter
(
status
=
status
)
return
retval
...
...
@@ -642,6 +642,9 @@ class Experiment(Shareable):
),
)
def
get_admin_change_url
(
self
):
return
reverse
(
'
admin:experiments_experiment_change
'
,
args
=
(
self
.
id
,))
def
completion
(
self
):
if
self
.
start_date
is
None
:
return
0
...
...
@@ -744,18 +747,18 @@ class Experiment(Shareable):
# Process main state and state from job results
if
Block
.
FAILED
in
block_statuses
or
Block
.
CANCELLED
in
block_statuses
:
self
.
stat
e
=
Experiment
.
FAILED
self
.
stat
us
=
Experiment
.
FAILED
elif
(
Block
.
PROCESSING
in
block_statuses
)
or
\
((
Block
.
NOT_CACHED
in
block_statuses
or
\
Block
.
SKIPPED
in
block_states
)
and
Block
.
CACHED
in
block_statuses
):
self
.
stat
e
=
Experiment
.
RUNNING
self
.
stat
us
=
Experiment
.
RUNNING
elif
Block
.
NOT_CACHED
not
in
block_statuses
:
self
.
stat
e
=
Experiment
.
DONE
self
.
stat
us
=
Experiment
.
DONE
else
:
self
.
stat
e
=
Experiment
.
SCHEDULED
self
.
stat
us
=
Experiment
.
SCHEDULED
self
.
save
()
...
...
@@ -776,7 +779,7 @@ class Experiment(Shareable):
'''
# lock self - avoids concurrent update from scheduler/worker subsystem
Experiment
.
objects
.
select_for_update
(
pk
=
self
.
pk
)
Experiment
.
objects
.
select_for_update
(
).
filter
(
pk
=
self
.
pk
)
if
self
.
status
!=
Experiment
.
PENDING
:
return
...
...
@@ -797,9 +800,9 @@ class Experiment(Shareable):
'''
# lock self - avoids concurrent update from scheduler/worker subsystem
Experiment
.
objects
.
select_for_update
(
pk
=
self
.
pk
)
Experiment
.
objects
.
select_for_update
(
).
filter
(
pk
=
self
.
pk
)
if
self
.
status
!=
(
Experiment
.
SCHEDULED
,
Experiment
.
RUNNING
):
return
if
self
.
status
not
in
(
Experiment
.
SCHEDULED
,
Experiment
.
RUNNING
):
return
for
b
in
self
.
blocks
.
all
():
b
.
_cancel
()
...
...
@@ -955,7 +958,7 @@ class Block(models.Model):
'''
# lock self - avoids concurrent update from scheduler/worker subsystem
Block
.
objects
.
select_for_update
(
pk
=
self
.
pk
)
Block
.
objects
.
select_for_update
(
).
filter
(
pk
=
self
.
pk
)
if
self
.
status
!=
Block
.
NOT_CACHED
:
return
...
...
@@ -976,7 +979,7 @@ class Block(models.Model):
def
done
(
self
):
'''
Says whether the block has finished or not
'''
return
self
.
stat
e
not
in
(
Block
.
NOT_CACHED
,
Block
.
PROCESSING
)
return
self
.
stat
us
not
in
(
Block
.
NOT_CACHED
,
Block
.
PROCESSING
)
@transaction.atomic
...
...
@@ -987,11 +990,15 @@ class Block(models.Model):
'''
# lock self - avoids concurrent update from scheduler/worker subsystem
Block
.
objects
.
select_for_update
(
pk
=
self
.
pk
)
Block
.
objects
.
select_for_update
(
).
filter
(
pk
=
self
.
pk
)
if
self
.
done
():
return
self
.
job
.
_cancel
()
if
hasattr
(
self
,
'
job
'
):
self
.
job
.
_cancel
()
else
:
self
.
status
=
Block
.
CANCELLED
self
.
save
()
self
.
experiment
.
update_state
()
@transaction.atomic
...
...
@@ -1016,7 +1023,7 @@ class Block(models.Model):
'''
# lock self - avoids concurrent update from scheduler/worker subsystem
Block
.
objects
.
select_for_update
(
pk
=
self
.
pk
)
Block
.
objects
.
select_for_update
(
).
filter
(
pk
=
self
.
pk
)
if
self
.
job
.
result
and
timings
:
...
...
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