Commit 98e06ef4 authored by Melesse Vergara, Veronica's avatar Melesse Vergara, Veronica
Browse files

fixed helloworld example

parent 0b0f724f
jobname = hellotest
total_processes = 16
processes_per_node = 16
batchqueue = batch
walltime = 300
......@@ -64,7 +64,7 @@ def main():
# Submit the batch file to the scheduler.
#
sched_job_id = send_to_scheduler(batchfilename,scheduler)
print ("Job id =" + str(sched_job_id))
print("Job id =" + str(sched_job_id))
#
......@@ -78,15 +78,15 @@ def make_batch_script(batch_recursive_mode,path_to_workspace,test_id_string,sche
# Define the batch file names.
#
if scheduler == "pbs":
print "Using PBS scheduler syntax"
print("Using PBS scheduler syntax")
batchtemplatefilename = "pbs.template.x"
sched_id = 0
elif scheduler == "lsf":
print "Using LSF scheduler syntax"
print("Using LSF scheduler syntax")
batchtemplatefilename = "lsf.template.x"
sched_id = 1
else:
print "Scheduler " + scheduler + " is not supported"
print("Scheduler " + scheduler + " is not supported")
sched_id = -1
batchfilename = "run_helloWorld.sh"
......@@ -115,7 +115,7 @@ def make_batch_script(batch_recursive_mode,path_to_workspace,test_id_string,sche
walltime = "300"
joblaunchcommand = "poe $EXECUTABLE 1> std.out.txt 2> std.err.txt"
else:
print "Executing on current node"
print("Executing on current node")
joblaunchcommand = "$EXECUTABLE 1> std.out.txt 2> std.err.txt"
rg_array = [
......@@ -211,13 +211,13 @@ def send_to_scheduler(batchfilename,scheduler):
my_stderr = open(t2,"w")
if scheduler == "pbs":
print "Using PBS scheduler syntax to submit job"
print("Using PBS scheduler syntax to submit job")
sched_id = 0
elif scheduler == "lsf":
print "Using LSF scheduler syntax to submit job"
print("Using LSF scheduler syntax to submit job")
sched_id = 1
else:
print "Scheduler " + scheduler + " is not supported"
print("Scheduler " + scheduler + " is not supported")
sched_id = -1
......@@ -229,12 +229,10 @@ def send_to_scheduler(batchfilename,scheduler):
submit_command = "bsub "
qcommand = submit_command
else:
print "Unsupported scheduler (sched_id = " + str(sched_id) + ")"
print("Unsupported scheduler (sched_id = " + str(sched_id) + ")")
# Split the arguments for the command
args = shlex.split(qcommand)
print "args = "
print args
# Execute the command as a subprocess
if sched_id == 0:
......@@ -244,7 +242,7 @@ def send_to_scheduler(batchfilename,scheduler):
p = subprocess.Popen(args,stdout=my_stdout,stderr=my_stderr,stdin=my_jobfile)
my_jobfile.close()
else:
print "Unsupported scheduler (sched_id = " + str(sched_id) + ")"
print("Unsupported scheduler (sched_id = " + str(sched_id) + ")")
p.wait()
......@@ -253,8 +251,6 @@ def send_to_scheduler(batchfilename,scheduler):
my_stdout = open(t1,"r")
records = my_stdout.readlines()
print "records = "
print records
jobid = extract_jobid(records,sched_id)
my_stdout.close()
......@@ -263,18 +259,14 @@ def send_to_scheduler(batchfilename,scheduler):
def extract_jobid(records,sched_id):
if sched_id == 0:
print "Extracting PBS jobID"
print("Extracting PBS jobID")
jobid = records[0].strip()
elif sched_id == 1:
print "Extracting LSF jobID"
print("Extracting LSF jobID")
m = re.compile('\d+')
print "m = "
print m
print "m.findall = "
jobid = m.findall(records[0])[0]
print jobid
else:
print "Non-supported scheduler requested"
print("Non-supported scheduler requested")
return jobid
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment