Skip to content

Commit

Permalink
Merge pull request #167 from mila-iqia/fix-import-jobs-and-nodes-bug
Browse files Browse the repository at this point in the history
Allow sacct and sinfo parsers to create missing directories when writing the output file of the jobs and nodes imports
  • Loading branch information
soline-b authored Oct 12, 2023
2 parents a1822b4 + 0d53b2b commit 8c8557c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions slurm_state/sacct_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,9 @@ def generate_job_report(
)
"""

# Create directories if needed
os.makedirs(os.path.dirname(file_name), exist_ok=True)

# Write the command output to a file
with open(file_name, "w") as outfile:
for line in ssh_stdout.readlines():
Expand Down
3 changes: 3 additions & 0 deletions slurm_state/sinfo_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ def generate_node_report(
)
"""

# Create directories if needed
os.makedirs(os.path.dirname(file_name), exist_ok=True)

# Write the command output to a file
with open(file_name, "w") as outfile:
for line in ssh_stdout.readlines():
Expand Down

0 comments on commit 8c8557c

Please sign in to comment.