Skip to content

Commit

Permalink
Merge pull request #187 from mila-iqia/handle-unknown-nodes-parser
Browse files Browse the repository at this point in the history
Raise missing parser exception as warning and not as error
  • Loading branch information
soline-b authored Apr 17, 2024
2 parents a32c3c5 + b44fbd7 commit a19c985
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions slurm_state/mongo_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Insert elements extracted from the Slurm reports into the database.
"""

import copy, json, os, time
import copy, json, logging, os, time
from pymongo import InsertOne, ReplaceOne, UpdateOne


Expand Down Expand Up @@ -35,9 +35,12 @@ def fetch_slurm_report(parser, report_path):
assert ctx is not None, f"{cluster_name} not configured"

with open(report_path, "r") as f:
for e in parser.parser(f):
e["cluster_name"] = cluster_name
yield e
try:
for e in parser.parser(f):
e["cluster_name"] = cluster_name
yield e
except Exception as e:
logging.warning(str(e))


def slurm_job_to_clockwork_job(slurm_job: dict):
Expand Down

0 comments on commit a19c985

Please sign in to comment.