Python Lecture - 14
Python Lecture - 14
Unix
HORT 59000
Lecture 14
Instructor: Kranthi Varala
Controlling processes from command line
Fixed Variable
Generating shell scripts from Python
• Python can be used to generate shell scripts that differ
in few parameters
• For example, PBS scripts with different job parameters
• Key: A PBS script is made of fixed lines, such as PBS
parameters, module loads etc. and variable lines, such
as the lines specifying the input line.
Fixed
Variable
Generating UNIX commands from Python
Option 1 Option 2 Option 3
SRR039920 Run each download Generate commands Use Python to
command in Python. generate PBS script
SRR039921
individually. to run commands.
SRR039922
10 jobs have to be 1 script can run jobs 1 PBS job runs in
SRR039923
created manually. sequentially. background.
SRR039924
No record of Script keeps track of Script keeps track of
SRR039925 parameters give to parameters given to parameters given to
command. command. command.
SRR039926
SRR039927 Run time for Run time for Run time for
commads is commands is commands can be
SRR039928 cumulative and cumulative and cumulative and
needs user DOESN’T need user DOESN’T need user
SRR039929
attention. attention. attention.
Making system calls from python