Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running non-python scripts remotely using PyCharm

I am using PyCharm to do remote deployment and execution of python on an SSH server. However, I would also like to be able to run other files directly in the same way. For example, I would like to "run" a "job.run" script through sbatch to submit it to a HPC server.

I can see PyCharm runs the following type of command for python

ssh://username@server:22/home/username/anaconda3/bin/python -u /home/username/project1/main.py

I would like to have another file called "job.run" that runs as follows

ssh://username@server:22/home/username/bin/sbatch /home/username/project1/job.run

This feels like it should be simple to do, however I cannot find any options that allow me to do so.

like image 432
Tristan Maxson Avatar asked Sep 01 '25 20:09

Tristan Maxson


1 Answers

One option is to configure a specific interpreter as explained here where you make sure to set Interpreter: /usr/bin/bash in the dialog window of step 6. Then you should set that interpreter for the project with the job.run file following this doc. You might need two distinct projects with different profiles/interpreter for that ; one with the Python code, another with the Slurm submission scripts.

Another option, to keep everything inside the same project, could be to wrap the submission of jobs in Python code, either using

  • os.system("sbatch job.run") or the more versatile subprocess package
  • the PySlurm package
  • the Slurm Rest API, following the steps explained in this answer
like image 136
damienfrancois Avatar answered Sep 04 '25 10:09

damienfrancois