I'm trying to return the output of the slurm command scontrol show job ID where ID is the ID number of the slurm job, to python as a string. I'm trying to use python's subprocess command by trying
x = subprocess.check_output("scontrol show job 62988265")
However this results in the following error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python3.6/subprocess.py", line 356, in check_output
**kwargs).stdout
File "/usr/lib64/python3.6/subprocess.py", line 423, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib64/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib64/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'scontrol show job 62988265': 'scontrol show job 62988265'
What am I missing? I'm confused as to what the command and argument are in this case.