Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
caos-collector
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
caos
caos-collector
Commits
ff9d29c9
Commit
ff9d29c9
authored
7 years ago
by
Fabrizio Chiarello
Browse files
Options
Downloads
Patches
Plain Diff
Fix job naming
Signed-off-by:
Fabrizio Chiarello
<
fabrizio.chiarello@pd.infn.it
>
parent
1209cae4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
caos_collector/shell.py
+8
-7
8 additions, 7 deletions
caos_collector/shell.py
with
8 additions
and
7 deletions
caos_collector/shell.py
+
8
−
7
View file @
ff9d29c9
...
...
@@ -60,10 +60,10 @@ _JOBS = {
'
hypervisors_state
'
:
HypervisorsStateJob
,
}
for
job_name
,
job_class
in
_JOBS
.
items
():
if
not
job_class
.
__doc__
:
for
_
job_name
,
_
job_class
in
_JOBS
.
items
():
if
not
_
job_class
.
__doc__
:
raise
NotImplementedError
(
"
Job `{job}` miss __doc__
"
.
format
(
job
=
job_class
))
.
format
(
job
=
_
job_class
))
def
build_parser
():
...
...
@@ -99,13 +99,14 @@ def get_job_instance(name):
return
job_class
()
def
run_job
(
cmdline
):
def
job_partial
(
cmdline
):
parser
=
build_parser
()
args
=
parser
.
parse_args
(
shlex
.
split
(
cmdline
))
job_name
=
args
.
job
job_instance
=
get_job_instance
(
job_name
)
job_instance
.
run_job
(
args
)
func
=
partial
(
job_instance
.
run_job
,
args
)
return
(
func
,
job_name
)
def
run_scheduler
(
scheduler_name
):
...
...
@@ -117,7 +118,7 @@ def run_scheduler(scheduler_name):
scheduler_cfg
=
cfg
.
SCHEDULERS
[
scheduler_name
]
jobs
=
scheduler_cfg
[
'
jobs
'
]
for
cmdline
in
jobs
:
func
=
partial
(
run_job
,
cmdline
)
func
,
_
=
job_partial
(
cmdline
)
logger
.
info
(
"
Running job {cmd_line} for scheduler {name}
"
.
format
(
name
=
scheduler_name
,
cmd_line
=
cmdline
))
func
()
...
...
@@ -132,7 +133,7 @@ def setup_scheduler():
for
name
,
scheduler_cfg
in
schedulers
.
items
():
jobs
=
scheduler_cfg
[
'
jobs
'
]
for
cmdline
in
jobs
:
func
=
partial
(
run_job
,
cmdline
)
func
,
job_name
=
job_partial
(
cmdline
)
cron_kwargs
=
scheduler_cfg
[
'
cron_kwargs
'
]
scheduler
.
add_job
(
func
=
func
,
...
...
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