OleHolmNielsen / Slurm_tools

My tools for the Slurm HPC workload manager
GNU General Public License v3.0
444 stars 96 forks source link

Hard coded paths #4

Closed chrissamuel closed 3 years ago

chrissamuel commented 5 years ago

Hi Ole,

It looks like your code has hard coded paths in them to the various Slurm utilities, which likely won't work for sites that don't use RPMs.

$ ./pestat 
./pestat: line 273: /usr/bin/sinfo: No such file or directory
sh: /usr/bin/squeue: No such file or directory
Hostname       Partition     Node Num_CPU  CPUload  Memsize  Freemem  Joblist
                            State Use/Tot              (MB)     (MB)  JobId User ...

It's best to let them be found by the $PATH I think (or alternatively have a config file that says what directory they are in).

All the best, Chris

OleHolmNielsen commented 5 years ago

Hi Chris,

Thanks for the comments. Near the top of pestat are some configuration lines which one may need to edit:

CONFIGURE the paths of commands:

Directory where Slurm commands live:

export prefix=/usr/bin

The awk command

my_awk=$prefix/awk

Variable width of the hostname column (default=8)

export hostnamelength="8"

Global configuration file for pestat

export PESTAT_GLOBAL_CONFIG=/etc/pestat.conf

Per-user configuration file for pestat

export PESTAT_CONFIG=$HOME/.pestat.conf

End of CONFIGURE lines

I've added some text to the Configuration section of the README.md file. Do you think this will suffice?

Best regards, Ole

mdiehn commented 4 years ago

I like your tools, Olle, and - man, impressive use of awk and bash!

I'm going to pile onto this no hardcoded pathnames bandwagon here, though. I have six clusters to manage myself and my partners have about thirty and toolpaths vary from one to another.

We already rely on Environment Modules in our systems so rather than edit all the scripts for each set of clusters, I chose to go through all the scripts and delete all that pathname hard-coding and let the shell find tools itself.

I can that in at least one script you do some sanity checks for existence of tools, but those could be done without hard coding pathname or we could eliminate them; I think those are redundant because the shell will tell the users if they are missing.

Would you entertain a PR with such changes?

OleHolmNielsen commented 4 years ago

Hi Mike, thanks a lot for your kind comments about my Slurm tools. It's fine with me to make the tools more portable. You could send me a PR, or just tell me which scripts need fixing. Thanks, Ole