Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
olcf-acceptance-team
olcf4-acceptance-tests
Commits
98f54b39
Commit
98f54b39
authored
Jun 20, 2016
by
Melesse Vergara, Veronica
Browse files
introduced machine based batch script functions
parent
075b97ba
Pipeline
#6718
skipped
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Crest/HelloWorld/Test_16cores/Scripts/submit_executable.x
View file @
98f54b39
...
...
@@ -8,7 +8,7 @@ import re
import
time
import
subprocess
import
shlex
from
machine_types.
factories.
machine_factory
import
MachineFactory
from
machine_types.machine_factory
import
MachineFactory
#
# Author: Arnold Tharrington
...
...
@@ -59,19 +59,22 @@ def main():
#
mymachine
=
MachineFactory
.
create_machine
()
# try-catch around this to alert the user something was missing
mymachine
.
make_batch_script
()
batchfilename
=
make_batch_script
(
batch_recursive_mode
,
path_to_workspace
,
test_id_string
,
mymachine
)
#
==##
#
==##
Submit the batch file to the scheduler.
#
==##
#==#
sched_job_id = send_to_scheduler(batchfilename,scheduler)
#==#
print("Job id =" + str(sched_job_id))
#
# Submit the batch file to the scheduler.
#
sched_job_id
=
send_to_scheduler
(
batchfilename
,
mymachine
.
get_
scheduler
_type
()
)
print
(
"Job id ="
+
str
(
sched_job_id
))
#
==##
#==#
#Write pbs job id to job_id.txt in the Status dir.
#
==##
#==#
write_job_id_to_status(sched_job_id,test_id_string)
#
#Write pbs job id to job_id.txt in the Status dir.
#
write_job_id_to_status
(
sched_job_id
,
test_id_string
)
def
make_batch_script
(
batch_recursive_mode
,
path_to_workspace
,
test_id_string
,
mymachine
):
...
...
@@ -79,11 +82,11 @@ def make_batch_script(batch_recursive_mode,path_to_workspace,test_id_string,myma
# Define the batch file names.
#
if
mymachine
.
get_scheduler_type
()
==
"PBS"
:
print
(
"Using PBS scheduler syntax"
)
print
(
"Using PBS scheduler syntax
to build the job submission file
"
)
batchtemplatefilename
=
"pbs.template.x"
sched_id
=
0
elif
mymachine
.
get_scheduler_type
()
==
"
lsf
"
:
print
(
"Using LSF scheduler syntax"
)
elif
mymachine
.
get_scheduler_type
()
==
"
LSF
"
:
print
(
"Using LSF scheduler syntax
to build the job submission file
"
)
batchtemplatefilename
=
"lsf.template.x"
sched_id
=
1
else
:
...
...
@@ -110,15 +113,18 @@ def make_batch_script(batch_recursive_mode,path_to_workspace,test_id_string,myma
resubmitme
=
batch_recursive_mode
if
sched_id
==
0
:
print
(
"Setting walltime to 5 minutes for PBS + aprun job"
)
walltime
=
"00:05:00"
joblaunchcommand
=
"aprun -n "
+
str
(
ranks
)
+
" -N "
+
str
(
ppn
)
+
" $EXECUTABLE 1> std.out.txt 2> std.err.txt"
elif
sched_id
==
1
:
print
(
"Setting walltime to 300 seconds for LSF + poe job"
)
walltime
=
"300"
joblaunchcommand
=
"poe $EXECUTABLE 1> std.out.txt 2> std.err.txt"
else
:
print
(
"Executing on current node"
)
joblaunchcommand
=
"$EXECUTABLE 1> std.out.txt 2> std.err.txt"
rg_array
=
[
(
re
.
compile
(
"__jobname__"
),
jobname
),
(
re
.
compile
(
"__walltime__"
),
walltime
),
...
...
@@ -202,7 +208,7 @@ def write_job_id_to_status(sched_job_id,test_id_string):
return
path1
def
send_to_scheduler
(
batchfilename
,
scheduler
):
def
send_to_scheduler
(
batchfilename
,
scheduler
_type
):
t1
=
"t1.out"
...
...
@@ -211,23 +217,25 @@ def send_to_scheduler(batchfilename,scheduler):
my_stdout
=
open
(
t1
,
"w"
)
my_stderr
=
open
(
t2
,
"w"
)
if
scheduler
==
"
pbs
"
:
if
scheduler
_type
==
"
PBS
"
:
print
(
"Using PBS scheduler syntax to submit job"
)
sched_id
=
0
elif
scheduler
==
"
lsf
"
:
elif
scheduler
_type
==
"
LSF
"
:
print
(
"Using LSF scheduler syntax to submit job"
)
sched_id
=
1
else
:
print
(
"Scheduler "
+
scheduler
+
" is not supported"
)
print
(
"Scheduler "
+
scheduler
_type
+
" is not supported"
)
sched_id
=
-
1
# Set the appropriate qcommand for each scheduler
if
sched_id
==
0
:
submit_command
=
"qsub "
print
(
"Submitting job using "
+
submit_command
)
qcommand
=
submit_command
+
batchfilename
elif
sched_id
==
1
:
submit_command
=
"bsub "
print
(
"Submitting job using "
+
submit_command
)
qcommand
=
submit_command
else
:
print
(
"Unsupported scheduler (sched_id = "
+
str
(
sched_id
)
+
")"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment