Skip to content

Commit

Permalink
Gstat: adding -d output for efficient piping (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdegeus committed Oct 14, 2022
1 parent cce9839 commit 85c94be
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion GooseSLURM/cli/Gstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@
--debug=<FILE>
Debug: read ``squeue -o "%all"`` from file.
-d, --print-dependency
Print the selected jobs as ``-d <jobid> -d <jobid> ...``.
Use to for example ``Gsub *slurm `Gstat -d -U --partition "serial"```.
-h, --help
Show help.
Expand Down Expand Up @@ -191,6 +195,7 @@ def print_help(self):
parser.add_argument("--sep", type=str, default=" ")
parser.add_argument("--long", action="store_true")
parser.add_argument("--debug", type=str)
parser.add_argument("-d", "--print-dependency", action="store_true")
parser.add_argument("--version", action="version", version=version)
parser.add_argument("jobs", type=int, nargs="*")

Expand Down Expand Up @@ -500,7 +505,9 @@ def print(self):
Print.
"""

if not self.args["summary"]:
if self.args["print_dependency"]:
print("-d " + " -d ".join([str(line["JOBID"]) for line in self.lines]))
elif not self.args["summary"]:
self.print_all()
else:
self.print_summary()
Expand Down

0 comments on commit 85c94be

Please sign in to comment.