Skip to content

Commit

Permalink
slurm2sql: seff: Allow a single argument that is a JobID
Browse files Browse the repository at this point in the history
  • Loading branch information
rkdarst committed Aug 8, 2024
1 parent b15bcf6 commit f0fb179
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions slurm2sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,8 +1007,19 @@ def sacct_cli(argv=sys.argv[1:]):

def seff_cli(argv=sys.argv[1:]):
parser = argparse.ArgumentParser(description=
"All unknown arguments get passed to sacct to fetch data."
"For example, one would usually give '-a' or '-S 2019-08-01' here, for example")

"""Print out efficiency of different jobs. Included is CPU,
memory, GPU, and i/o stats.
All extra arguments get passed to `sacct` to fetch data job
data. For example, one would usually give '-a' or '-S
2019-08-01' here, for example. To look only at completed
jobs, use "--completed -S now-1week" (a start time must be
given with --completed because of how sacct works).
If a single argument is given, and it
looks like a JobID, then use only on that single job with
--jobs=[JobID].""")
#parser.add_argument('db', help="Database filename to create or update")
#parser.add_argument('sacct_filter', nargs=0,
# help="sacct options to filter jobs. )
Expand All @@ -1034,6 +1045,10 @@ def seff_cli(argv=sys.argv[1:]):
logging.lastResort.setLevel(logging.WARN)
LOG.debug(args)

# A single argument that looks like a jobID is used.
if len(unknown_args) == 1 and re.match(r'[0-9+_]+(.[0-9a-z]+)?', unknown_args[0]):
unknown_args = [f'--jobs={unknown_args[0]}']

if args.order:
order_by = f'ORDER BY {args.order}'
else:
Expand Down

0 comments on commit f0fb179

Please sign in to comment.