Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
f1a68758
Commit
f1a68758
authored
Dec 15, 2021
by
David Sikter
Browse files
Fixed join condition
parent
1bb726da
Pipeline
#117866
failed with stages
in 24 minutes and 6 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nomad/processing/base.py
View file @
f1a68758
...
...
@@ -446,8 +446,8 @@ class Proc(Document):
Called on the parent Proc object to join (resume) the current process.
For the join to succeed, the following must be fullfilled:
* This Proc must have status `WAITING_FOR_RESULT`
*
Every
instance of the child class (defined by calling :func:`child_cls`)
linked to this Proc (if any) must be
in status FAILURE or SUCCESS
.
*
No
instance of the child class (defined by calling :func:`child_cls`)
linked to this Proc (if any) must be
processing
.
If the join succeeds, the `process_status` will be set to `RUNNING` and True
will be returned. Otherwise, the method just returns False. The method is written so
that the join should succeed once and only once.
...
...
@@ -456,12 +456,12 @@ class Proc(Document):
if
self
.
process_status
!=
ProcessStatus
.
WAITING_FOR_RESULT
:
self
.
get_logger
().
debug
(
'trying to join: not waiting for result'
)
return
False
children_p
ending_completion
=
self
.
child_cls
().
objects
(
**
{
children_p
rocessing
=
self
.
child_cls
().
objects
(
**
{
self
.
id_field
:
self
.
id
,
'process_status__
n
in'
:
(
ProcessStatus
.
S
UCCESS
,
ProcessStatus
.
FAILURE
)
}).
count
()
self
.
get_logger
().
debug
(
'trying to join'
,
children_p
ending_completion
=
children_pending_completion
)
'process_status__in'
:
ProcessStatus
.
S
TATUSES_PROCESSING
}).
count
()
self
.
get_logger
().
debug
(
'trying to join'
,
children_p
rocessing
=
children_processing
)
if
not
children_p
ending_completion
:
if
not
children_p
rocessing
:
# We may easily get here multiple times if multiple children finish at the same time
# To join, we need to read and update the mongo record as a single atomic operation
old_record
=
self
.
_get_collection
().
find_one_and_update
(
...
...
tests/processing/test_data.py
View file @
f1a68758
...
...
@@ -605,8 +605,8 @@ def test_phonopy_data(proc_infra, test_user, no_warn):
upload
=
run_processing
((
'test_upload'
,
'tests/data/proc/examples_phonopy.zip'
),
test_user
)
additional_keys
=
[
'results.method.simulation.program_name'
]
assert
upload
.
total_calcs
==
1
assert
len
(
upload
.
calcs
)
==
1
assert
upload
.
total_calcs
==
2
assert
len
(
upload
.
calcs
)
==
2
with
upload
.
entries_metadata
()
as
entries
:
assert_upload_files
(
upload
.
upload_id
,
entries
,
StagingUploadFiles
,
published
=
False
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment