Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nomad-FAIR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
nomad-lab
nomad-FAIR
Commits
29d46113
Commit
29d46113
authored
6 years ago
by
Markus Scheidgen
Browse files
Options
Downloads
Patches
Plain Diff
Typos.
parent
ca3a3156
No related branches found
No related tags found
1 merge request
!12
Docs
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nomad/processing/base.py
+10
-10
10 additions, 10 deletions
nomad/processing/base.py
with
10 additions
and
10 deletions
nomad/processing/base.py
+
10
−
10
View file @
29d46113
...
@@ -132,7 +132,7 @@ class Proc(Document, metaclass=ProcMetaclass):
...
@@ -132,7 +132,7 @@ class Proc(Document, metaclass=ProcMetaclass):
def
create
(
cls
,
**
kwargs
):
def
create
(
cls
,
**
kwargs
):
"""
Factory method that must be used instead of regular constructor.
"""
"""
Factory method that must be used instead of regular constructor.
"""
assert
cls
.
tasks
is
not
None
and
len
(
cls
.
tasks
)
>
0
,
\
assert
cls
.
tasks
is
not
None
and
len
(
cls
.
tasks
)
>
0
,
\
"""
the class attribute tasks must be overwritten with an ac
u
tal list
"""
"""
the class attribute tasks must be overwritten with an act
u
al list
"""
assert
'
status
'
not
in
kwargs
,
\
assert
'
status
'
not
in
kwargs
,
\
"""
do not set the status manually, its managed
"""
"""
do not set the status manually, its managed
"""
...
@@ -245,8 +245,8 @@ class Proc(Document, metaclass=ProcMetaclass):
...
@@ -245,8 +245,8 @@ class Proc(Document, metaclass=ProcMetaclass):
def
block_until_complete
(
self
,
interval
=
0.01
):
def
block_until_complete
(
self
,
interval
=
0.01
):
"""
"""
Reloads the process const
r
antly until it sees a completed process. Should be
Reloads the process constantly until it sees a completed process. Should be
used with care as it can block indefine
t
ly. Just intended for testing purposes.
used with care as it can block indefin
it
ely. Just intended for testing purposes.
"""
"""
while
not
self
.
completed
:
while
not
self
.
completed
:
time
.
sleep
(
interval
)
time
.
sleep
(
interval
)
...
@@ -275,13 +275,13 @@ class InvalidChordUsage(Exception): pass
...
@@ -275,13 +275,13 @@ class InvalidChordUsage(Exception): pass
class
Chord
(
Proc
):
class
Chord
(
Proc
):
"""
"""
A special Proc base class that manages a chord of child processes. It saves some
A special Proc base class that manages a chord of child processes. It saves some
a
t
tional state to track child processes and provides methods to control that
a
ddi
tional state to track child processes and provides methods to control that
state.
state.
It uses a counter approach with atomic updates to trac the number of processed
It uses a counter approach with atomic updates to trac
k
the number of processed
children.
children.
TODO the joined attribute is not stricly necessary and only serves debugging purposes.
TODO the joined attribute is not stric
t
ly necessary and only serves debugging purposes.
Maybe it should be removed, since it also requires another save.
Maybe it should be removed, since it also requires another save.
TODO it is vital that sub classes and children don
'
t miss any calls. This might
TODO it is vital that sub classes and children don
'
t miss any calls. This might
...
@@ -313,7 +313,7 @@ class Chord(Proc):
...
@@ -313,7 +313,7 @@ class Chord(Proc):
self
.
_check_join
(
children
=
0
)
self
.
_check_join
(
children
=
0
)
def
completed_child
(
self
):
def
completed_child
(
self
):
"""
Children must call this, when they completed processig.
"""
"""
Children must call this, when they completed processi
n
g.
"""
self
.
_check_join
(
children
=
1
)
self
.
_check_join
(
children
=
1
)
def
_check_join
(
self
,
children
):
def
_check_join
(
self
,
children
):
...
@@ -374,12 +374,12 @@ class Chord(Proc):
...
@@ -374,12 +374,12 @@ class Chord(Proc):
def
task
(
func
):
def
task
(
func
):
"""
"""
The decorator for tasks that will be wrapped in exc
a
ption handling that will fail the process.
The decorator for tasks that will be wrapped in exc
e
ption handling that will fail the process.
The task methods of a :class:`Proc` class/document comprise a sequence
The task methods of a :class:`Proc` class/document comprise a sequence
(order of methods in class namespace) of tasks. Tasks must be executed in that order.
(order of methods in class namespace) of tasks. Tasks must be executed in that order.
Completion of the last task, will put the :class:`Proc` instance into the
Completion of the last task, will put the :class:`Proc` instance into the
SUCCESS state. Calling the first task will put it into RUNNING state. Tasks will
SUCCESS state. Calling the first task will put it into RUNNING state. Tasks will
only be exec
t
ued, if the process has not yet reached FAILURE state.
only be execu
t
ed, if the process has not yet reached FAILURE state.
"""
"""
def
wrapper
(
self
,
*
args
,
**
kwargs
):
def
wrapper
(
self
,
*
args
,
**
kwargs
):
if
self
.
status
==
'
FAILURE
'
:
if
self
.
status
==
'
FAILURE
'
:
...
@@ -416,7 +416,7 @@ def proc_task(task, cls_name, self_id, func_attr):
...
@@ -416,7 +416,7 @@ def proc_task(task, cls_name, self_id, func_attr):
It ignores results, since all results are handled via the self document.
It ignores results, since all results are handled via the self document.
It retries for 3 times with a countdown of 3 on missing
'
selfs
'
, since this
It retries for 3 times with a countdown of 3 on missing
'
selfs
'
, since this
might happen in sharded, distributed mongo setups where the object might not
might happen in sharded, distributed mongo setups where the object might not
have yet been propagated and therefore apear missing.
have yet been propagated and therefore ap
p
ear missing.
"""
"""
logger
=
utils
.
get_logger
(
__name__
,
cls
=
cls_name
,
id
=
self_id
,
func
=
func_attr
)
logger
=
utils
.
get_logger
(
__name__
,
cls
=
cls_name
,
id
=
self_id
,
func
=
func_attr
)
...
...
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