Skip to content

Exercise 3d: Input Arguments

In this execise, the queue command is used to assign multiple values to many and different commands. To be more specific the "script.py" file opens the *.txt files, reads the lines and prints them. These files first need to be transferred and then used as arguments for the executable "script.py". The script script.py reads the names of the files that are given as arguments. It opens the files and prints the lines of the file.

#!/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()
The script script.txt:
Welcome to Exercise 3!!!
It is time to investigate the functionalities of queue command!!
Create script.py, the txt file and submit the job with the following submit description file.

    executable              = script.py
    output                  = output/$(ClusterId).$(ProcId).out
    error                   = error/$(ClusterId).$(ProcId).err
    log                     = log/$(ClusterId).log

  queue transfer_input_files, arguments from (
  script.txt,script.txt
  )
Note : Care must be taken as an extra line inside the brackets will submit an additional job. For example, the following queue command will put in the queue one job.:
queue ... from (
  1. ...
)
If by mistake one extra line is added, such as the following example, an extra job will be submitted to the queue and the second one would be undefined.
queue ... from (
  1. ...

)


Last update: November 26, 2019