miguelbernadi / slurm_reports

Small too, to create reports on SLURM usage by parsing sacct output
Other
3 stars 0 forks source link

Not running #4

Open naevtamarkus opened 7 years ago

naevtamarkus commented 7 years ago

Hola Miguel,

I am not able to run your code after installing it:

Traceback (most recent call last):
  File "./slurm_reports", line 9, in <module>
    load_entry_point('slurm-reports==0.1.0', 'console_scripts', 'slurm_reports')()
  File "build/bdist.linux-x86_64/egg/slurm_reports/slurm_reports.py", line 14, in cli
  File "build/bdist.linux-x86_64/egg/slurm_reports/slurm_reports.py", line 337, in main
  File "/apps/monch/python/2.7.6/gcc/4.8.1/lib/python2.7/subprocess.py", line 566, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "/apps/monch/python/2.7.6/gcc/4.8.1/lib/python2.7/subprocess.py", line 709, in __init__
    errread, errwrite)
  File "/apps/monch/python/2.7.6/gcc/4.8.1/lib/python2.7/subprocess.py", line 1326, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Maybe it's because of the python installation that I have available (it's not managed by me)... but looking into your code, it seems like everything is confined to a single file. Is there a way that I can run your code from the command line, without having to install it? I tried to add 'cli()' or 'Slurm_Reports().main()' at the end of your code, but without success. (btw I am not a Python expert)

Thanks!

miguelbernadi commented 7 years ago

Hi @naevtamarkus Sorry for the delay in answering. I got caught up with other things in the middle.

You need to open an interactive shell and then load the module with an import like:

import slurm-reports

I haven't tested it, just off the top of my head.

Nonetheless, I guess the problem is you don't have the configuration file that specifies where sacct is installed. The defaults can be seen at https://github.com/Devex/opsworks/blob/1577a668b4915419deb5f8c7ec77619e1230e8ad/zenoss/recipes/default.rb#L126-L138 and the sacct path is missing, which is consistent with your error.

You'll need to create a config file similar to:

[general]
report_title=Report for  my cluster
avail_cpu_number=20
sacct_path=/bin/sacct

and specify the correct path for sacct. You can get that with which sacct in your cluster. You can specify the path to the config file using the flag -c /path/to/config/file or calling the file config and calling the command from the same directory.

If you already did that and it still doesn't work, I'll need more info to debug the issue. We can arrange for a call.