How to import a local python module when using the sbatch command in SLURM

前端 未结 1 1129
不思量自难忘°
不思量自难忘° 2021-01-06 05:37

I was using the cluster manager slurm and I was running a submission script with sbatch (with a python interpeter). The sbatch submission imported one of my modules called <

相关标签:
1条回答
  • 2021-01-06 06:19

    As Slurm copies the submission script to a specific location on the compute node to run it, your Python script will not find the modules that are in the submission directory.

    But Slurm correctly sets the current working directory so you can explicitly add it to the python path with something like:

    sys.path.append(os.getcwd()) 
    

    near the beginning of your script.

    0 讨论(0)
提交回复
热议问题