Independently of Jupyter, Marvin cluster can also run Python files. For example, here we have a simple python code we can run on the cluster:
a = 5
b = 2
As we can suppose, the output we expect is 10.
Open the VI text editor through the terminal and copy the above code. Save this code as an Python file (i.e. your_code.py).
Next, proceed to create a sbatch file with the same text editor that has the following structure:
#SBATCH [email protected]
# For the next step, choose the module Python/X.X.X that you need (module av to see available modules):
module load Python/X.X.X
Save it as a sbatch file (sbatch_example.sh), and upload it to your cluster account using an application such as FileZilla (for macOS and windows), or uploading it from your terminal if you are working with linux/ubuntu using the command:
$ scp ~/(path of the file in yout computer) [email protected]:/homes/users/user_name/(folder where you want your file to be or the name of the file)
Next, log in to the cluster from a terminal, go to the corresponding folder where your files are saved and run the sbatch file:
$ sbatch sbatch_exampe.sh
This will generate a slurm file (slurm-[number].out) that will let you check the output of your code using the command:
$ more slurm-[number].out