Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
ni-meister-gedi-biomass-global
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
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
Ian
ni-meister-gedi-biomass-global
Commits
4bc30b7e
Commit
4bc30b7e
authored
2 months ago
by
Ian
Committed by
Ian
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
style: replace print statements with logging calls in JobManager.py
parent
24b20e14
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
maap_utils/JobManager.py
+6
-5
6 additions, 5 deletions
maap_utils/JobManager.py
with
6 additions
and
5 deletions
maap_utils/JobManager.py
+
6
−
5
View file @
4bc30b7e
...
@@ -151,7 +151,7 @@ class JobManager:
...
@@ -151,7 +151,7 @@ class JobManager:
self
.
ledger
.
remove_job
(
job
.
job_id
)
self
.
ledger
.
remove_job
(
job
.
job_id
)
# Submit new jobs
# Submit new jobs
logging
.
info
(
f
"
Resubmitting
{
len
(
new_jobs
)
}
failed jobs
"
)
logging
.
info
(
f
"
Resubmitting
{
len
(
new_jobs
)
}
failed jobs
...
"
)
for
job
in
new_jobs
:
for
job
in
new_jobs
:
try
:
try
:
job
.
submit
()
job
.
submit
()
...
@@ -171,12 +171,13 @@ class JobManager:
...
@@ -171,12 +171,13 @@ class JobManager:
)
)
try
:
try
:
time
.
sleep
(
3
)
time
.
sleep
(
3
)
print
(
"
Resuming monitoring...
"
)
logging
.
info
(
"
Resuming monitoring...
"
)
self
.
monitor
()
self
.
monitor
()
except
KeyboardInterrupt
:
except
KeyboardInterrupt
:
if
self
.
redo_enabled
and
self
.
prompt_for_redo
():
if
self
.
redo_enabled
and
self
.
prompt_for_redo
():
print
(
"
Resubmitting failed jobs...
"
)
logging
.
info
(
"
Resubmitting failed jobs...
"
)
self
.
resubmit_jobs
()
self
.
resubmit_jobs
()
logging
.
info
(
"
Resuming monitoring...
"
)
self
.
monitor
()
self
.
monitor
()
else
:
else
:
self
.
exit_gracefully
()
self
.
exit_gracefully
()
...
@@ -199,7 +200,7 @@ class JobManager:
...
@@ -199,7 +200,7 @@ class JobManager:
def
exit_gracefully
(
self
)
->
None
:
def
exit_gracefully
(
self
)
->
None
:
"""
Cancel pending jobs, print a report, and exit
"""
"""
Cancel pending jobs, print a report, and exit
"""
print
(
"
\n
Exiting
...
"
)
logging
.
info
(
"
\n
Exiting gracefully
...
"
)
# Cancel all pending jobs
# Cancel all pending jobs
pending_jobs
=
self
.
ledger
.
get_pending_jobs
()
pending_jobs
=
self
.
ledger
.
get_pending_jobs
()
...
@@ -208,7 +209,7 @@ class JobManager:
...
@@ -208,7 +209,7 @@ class JobManager:
job
.
cancel
()
job
.
cancel
()
except
Exception
as
e
:
except
Exception
as
e
:
logging
.
error
(
f
"
Error cancelling job:
{
e
}
"
)
logging
.
error
(
f
"
Error cancelling job:
{
e
}
"
)
print
(
"
All
jobs cancelled.
"
)
logging
.
info
(
"
All pending
jobs cancelled.
"
)
self
.
report
()
self
.
report
()
exit
(
0
)
exit
(
0
)
...
...
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