10000 GitHub - jiphex/shostspec
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

jiphex/shostspec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shostspec

This is a small utility for converting Slurm (and other batch system/etc) host expressions (e.g host[120-150,999]) into their composite individual hosts. This is often required when using information from e.g Slurm (such as the output from sinfo) to do administrative things (like powering on a number of hosts using ipmitool).

Usage

[you@box] $ shostspec host[1234-5678,8100]
host1234
host1235
host1236
...
host5678
host8100

Provide the arguments on the command-line, you get out a newline-separated list with each individual host.

You can prefix the first entry in the range with zeros to set the width of the output, e.g shostspec host[0001-1999] will create output like this:

host0001
host0002
...
host0010
...
...
host1999

A screenshot showing output similar to above

Pre-empting some questions/feature requests:

  • If you need the output separated by spaces or commas or whatever, use something like xargs
  • It takes arguments, not standard input, suitable for pasting (although standard input would be nice later, for big lists)
  • There's no way to reverse the format, turning lists into minimal expressions, but that sounds like a fun algorithmic challenge (I'm not sure why it would be useful)
  • Every host has to have a number range, because of the way that the parsing works, I guess just cat anything else on the end?
  • You can't yet have more than one range in the expression (e.g cpu[1-10]-[2-5]), but I don't think this would be too difficult to add (patches welcome)
  • Reversed ranges don't work, but I don't think Slurm or whatever would ever generate them anyway
  • More test cases would be nice

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0