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
12951c8f
Commit
12951c8f
authored
2 months ago
by
Ian
Committed by
Ian
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
fix: write unsuccessful job details to JSON file instead of logging
parent
607f736b
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
+10
-8
10 additions, 8 deletions
maap_utils/JobManager.py
with
10 additions
and
8 deletions
maap_utils/JobManager.py
+
10
−
8
View file @
12951c8f
...
@@ -5,6 +5,7 @@ import time
...
@@ -5,6 +5,7 @@ import time
from
tqdm
import
tqdm
from
tqdm
import
tqdm
from
pathlib
import
Path
from
pathlib
import
Path
import
logging
import
logging
import
json
from
.RunConfig
import
RunConfig
from
.RunConfig
import
RunConfig
from
.Job
import
Job
from
.Job
import
Job
...
@@ -233,13 +234,14 @@ class JobManager:
...
@@ -233,13 +234,14 @@ class JobManager:
successful_jobs
=
set
(
self
.
ledger
.
get_jobs_in_state
(
"
Succeeded
"
))
successful_jobs
=
set
(
self
.
ledger
.
get_jobs_in_state
(
"
Succeeded
"
))
unsuccessful_jobs
=
set
(
self
.
ledger
.
get_jobs
())
-
successful_jobs
unsuccessful_jobs
=
set
(
self
.
ledger
.
get_jobs
())
-
successful_jobs
# Write ids, final state, and kwargs of unsuccessful jobs to log
# Write unsuccessful jobs details to JSON in output directory
logging
.
info
(
f
"
See unsuccessful_jobs.json in
{
self
.
output_dir
}
"
unsuccessful_jobs_details
=
[
"
for details on unsuccessful jobs.
"
)
{
"
job_id
"
:
job
.
job_id
,
"
state
"
:
job
.
get_status
(),
"
kwargs
"
:
job
.
kwargs
}
for
job
in
unsuccessful_jobs
for
job
in
unsuccessful_jobs
:
]
logging
.
debug
(
f
"
\n
Failed job ID:
{
job
.
job_id
}
"
)
json_file
=
self
.
output_dir
/
"
unsuccessful_jobs.json
"
logging
.
debug
(
f
"
Final state:
{
job
.
get_status
()
}
"
)
with
open
(
json_file
,
"
w
"
)
as
f
:
logging
.
debug
(
f
"
Job kwargs:
{
job
.
kwargs
}
"
)
json
.
dump
(
unsuccessful_jobs_details
,
f
,
indent
=
2
)
logging
.
info
(
f
"
Wrote unsuccessful jobs details to
{
json_file
}
"
)
return
counts
return
counts
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