Exercise 4b: Input Files As Arguments
In this exercise, the same executable ex_04.py is queued but the executable will use a different input file as an argument each time. These files are located in the ex04_folder.
The script ex_04.py reads the name of the file and opens it in order to ensure that the correct file was used.
#!/usr/bin/env python
import sys
input_filename = sys.argv[1]
print "The name of the file is ", input_filename
input_file = open(input_filename, 'r')
for line in input_file:
    print line
input_file.close()
    executable              = ex_04.py
    arguments               = $(file)
    output                  = $(file).$(ClusterId).$(ProcId).out
    error                   = $(file).$(ClusterId).$(ProcId).err
    log                     = $(file).$(ClusterId).log
    initialdir              = your_path/ex04_folder
    transfer_input_files    = $(file)
    file=file01.txt
    queue 1
    file=file02.txt
    queue 2
    file=file03.txt
    queue 3
Note: The jobs belong to the same Cluster and in different Processes because they use the same executable with different argument every time.
  
    
      Last update: November 26, 2019