Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows setting how many days look back when fetching sacct job information #110

Merged
merged 1 commit into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cfg/sequencer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ PARTITION_PEDCALIB: short
PARTITION_DATA: long
MEMSIZE_PEDCALIB: 3GB
MEMSIZE_DATA: 16GB
# Days from current day up to which the jobs are fetched from the queue.
# Default is None (left empty).
STARTTIME_DAYS_SACCT:

[WEBSERVER]
# Set the server address and port to transfer the datacheck plots
Expand Down
8 changes: 5 additions & 3 deletions osa/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,18 +779,20 @@ def run_sacct() -> StringIO:
log.warning("No job info available since sacct command is not available")
return StringIO()

start_date = (datetime.date.today() - datetime.timedelta(weeks=1)).isoformat()
sacct_cmd = [
"sacct",
"-n",
"--parsable2",
"--delimiter=,",
"--units=G",
"--starttime",
start_date,
"-o",
",".join(FORMAT_SLURM),
]
if cfg.get("SLURM", "STARTTIME_DAYS_SACCT"):
days = int(cfg.get("SLURM", "STARTTIME_DAYS_SACCT"))
start_date = (datetime.date.today() - datetime.timedelta(days=days)).isoformat()
sacct_cmd.extend(["--starttime", start_date])

return StringIO(sp.check_output(sacct_cmd).decode())


Expand Down