Skip to content

1. A Quick Example

Three files are recommended to simplify the process.

  • File 1: Do a list of the processes you need
  • File 2: Intermediate file to pass the bash argument and start python (may not be needed if python3 is called directly from File 1.
  • File 3: Your python code. Take advantage of the input arguments passed in the batch.

See a template code below for each file.

-File 1: Submit.sh

  #!/bin/bash

  module load python/3.9

  source opensees/bin/activate


  # JOBS

  # srun would send individual jobs (Upto1000jobs?). Use 1 CPU each.


  forSFin1.0; do

      # sed "s/FILENAME/$filename/" template.sh > $filename\.sh

      sbatch template.sh "opt11"$Model$gmID$SF;

  done

-File 2: template.sh

  #!/bin/bash


  # Run job

  # $@ refers to all the arguments


  python3 RunFromCluster.py $@

-File 3: RunFromCluster.py

# You are in python now :)

import openseespy.opensees as ops
import os, sys
import time
import itertools

# input arguments
Arg1 = sys.argv[1]
Arg2 = sys.argv[2]

# your python code
# You are welcome