Hi, Kent Engström <[email protected]> writes:
> "Loris Bennett" <[email protected]> writes: >> Hi, >> >> I can generate a list of node lists on which the jobs of a given user >> are running with the following: >> >> $ squeue -u user123 -h -o "%N" >> node[006-007,014,016,021,024] >> node[012,094] >> node[005,008-011,013,015,026,095,097-099] >> >> I would like to merge these node lists to obtain >> >> node[005-016,021,024,026,094-095,097-099] >> >> I can do the following: >> >> $ squeue -u user123 -h -o "%N" | xargs -I {} scontrol show hostname {} | >> sed ':a;N;$!ba;s/\n/,/g' | xargs scontrol show hostlistsorted >> node[005-016,021,024,026,094-095,097-099] >> >> Would it be worth adding an option to allow the delimiter in the output >> of 'scontrol show hostname' to be changed from an newline to, say, a >> comma? That would permit easier manipulation of node lists without >> one having to google the appropiate sed magic. > > Hi, > > slighly off topic, but if you are willing to install and use an external > program that is not part of SLURM itself, I might perhaps be allowed to > advertise the python-hostlist package? > > Your example would be: > > squeue -u user123 -h -o "%N" | hostlist -c - > > (read as "Collapse several hostlist into one, and take the input from > stdin"). > > You find it at: > https://pypi.python.org/pypi/python-hostlist > https://www.nsc.liu.se/~kent/python-hostlist/ > > Best Regards, > -- > Kent Engström, National Supercomputer Centre > [email protected], +46 13 28 4444 In fact, I had already spotted your ad from 2010: https://groups.google.com/forum/#!topic/slurm-devel/n6x2WgGmDls but was wondering whether there might be any interest in having a solution more tightly integrated solution. I am not averse to installing an external program and I do rather like Python, despite having done most of my programming in Perl. However, my experience of installing Python software for users is that the packet management is somewhat fragmented and brittle. Nevertheless, I was able to install your package (with only minor moaning from pip) and it works fine. Thanks, Loris -- Dr. Loris Bennett (Mr.) ZEDAT, Freie Universität Berlin Email [email protected]
