Skip to content

Commit 5ebb1c0

Browse files
Built-in templates: further cleanup and restructuring
1 parent 1ebbf19 commit 5ebb1c0

File tree

12 files changed

+287
-216
lines changed

12 files changed

+287
-216
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: future.batchtools
2-
Version: 0.12.2-9981
2+
Version: 0.12.2-9982
33
Depends:
44
R (>= 3.2.0),
55
parallelly,

inst/templates/lsf.tmpl

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,33 @@ set -u # error on unset variables
4646
set -o pipefail # fail a pipeline if any command fails
4747
trap 'echo "ERROR: future.batchtools job script failed on line $LINENO" >&2; exit 1' ERR
4848

49-
echo "Batchtools information:"
50-
echo "- job name: '<%= job.name %>'"
51-
echo "- job log file: '<%= log.file %>'"
52-
echo
49+
<% if (length(job_declarations) > 0) {
50+
writeLines(c(
51+
"echo 'Job submission declarations:'",
52+
sprintf("echo '%s'", job_declarations),
53+
"echo"
54+
))
55+
} %>
56+
57+
<% if (details) { %>
58+
if command -v bjobs > /dev/null; then
59+
echo "Job information:"
60+
bjobs -l "${LSB_JOBID}"
61+
echo
62+
fi
63+
<% } %>
5364

5465
<% if (length(startup) > 0) {
5566
writeLines(startup)
5667
} %>
5768

58-
echo "Load environment modules:"
5969
<% if (length(modules) > 0) {
60-
writeLines(c(sprintf("module load %s", modules), "module list"))
70+
writeLines(c(
71+
"echo 'Load environment modules:'",
72+
sprintf("echo '- modules: %s'", paste(modules, collapse = ", ")),
73+
sprintf("module load %s", paste(modules, collapse = " ")),
74+
"module list"
75+
))
6176
} %>
6277

6378
echo "Session information:"
@@ -68,26 +83,17 @@ echo "- Rscript version: $(Rscript --version)"
6883
echo "- Rscript library paths: $(Rscript -e "cat(shQuote(.libPaths()), sep = ' ')")"
6984
echo
7085

71-
echo "Job submission declarations:"
72-
<%
73-
writeLines(sprintf("echo '%s'", job_declarations))
74-
%>
75-
76-
<% if (details) { %>
77-
if command -v bjobs > /dev/null; then
78-
echo "Job information:"
79-
bjobs -l "${LSB_JOBID}"
80-
echo
81-
fi
82-
<% } %>
83-
8486

8587
## Launch R and evaluate the batchtools R job
86-
echo "Command: Rscript -e 'batchtools::doJobCollection("<%= uri %>")' ..."
88+
echo "Rscript -e 'batchtools::doJobCollection()' ..."
89+
echo "- job name: '<%= job.name %>'"
90+
echo "- job log file: '<%= log.file %>'"
91+
echo "- job uri: '<%= uri %>'"
8792
Rscript -e 'batchtools::doJobCollection("<%= uri %>")'
8893
res=$?
8994
echo " - exit code: ${res}"
90-
echo "Command: Rscript -e 'batchtools::doJobCollection("<%= uri %>")' ... done"
95+
echo "Rscript -e 'batchtools::doJobCollection()' ... done"
96+
echo
9197

9298
<% if (details) { %>
9399
if command -v bjobs > /dev/null; then

inst/templates/openlava.tmpl

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,33 @@ set -u # error on unset variables
4646
set -o pipefail # fail a pipeline if any command fails
4747
trap 'echo "ERROR: future.batchtools job script failed on line $LINENO" >&2; exit 1' ERR
4848

49-
echo "Batchtools information:"
50-
echo "- job name: '<%= job.name %>'"
51-
echo "- job log file: '<%= log.file %>'"
52-
echo
49+
<% if (length(job_declarations) > 0) {
50+
writeLines(c(
51+
"echo 'Job submission declarations:'",
52+
sprintf("echo '%s'", job_declarations),
53+
"echo"
54+
))
55+
} %>
56+
57+
<% if (details) { %>
58+
if command -v bjobs > /dev/null; then
59+
echo "Job information:"
60+
bjobs -l "${LSB_JOBID}"
61+
echo
62+
fi
63+
<% } %>
5364

5465
<% if (length(startup) > 0) {
5566
writeLines(startup)
5667
} %>
5768

58-
echo "Load environment modules:"
5969
<% if (length(modules) > 0) {
60-
writeLines(c(sprintf("module load %s", modules), "module list"))
70+
writeLines(c(
71+
"echo 'Load environment modules:'",
72+
sprintf("echo '- modules: %s'", paste(modules, collapse = ", ")),
73+
sprintf("module load %s", paste(modules, collapse = " ")),
74+
"module list"
75+
))
6176
} %>
6277

6378
echo "Session information:"
@@ -68,26 +83,17 @@ echo "- Rscript version: $(Rscript --version)"
6883
echo "- Rscript library paths: $(Rscript -e "cat(shQuote(.libPaths()), sep = ' ')")"
6984
echo
7085

71-
echo "Job submission declarations:"
72-
<%
73-
writeLines(sprintf("echo '%s'", job_declarations))
74-
%>
75-
76-
<% if (details) { %>
77-
if command -v bjobs > /dev/null; then
78-
echo "Job information:"
79-
bjobs -l "${LSB_JOBID}"
80-
echo
81-
fi
82-
<% } %>
83-
8486

8587
## Launch R and evaluate the batchtools R job
86-
echo "Command: Rscript -e 'batchtools::doJobCollection("<%= uri %>")' ..."
88+
echo "Rscript -e 'batchtools::doJobCollection()' ..."
89+
echo "- job name: '<%= job.name %>'"
90+
echo "- job log file: '<%= log.file %>'"
91+
echo "- job uri: '<%= uri %>'"
8792
Rscript -e 'batchtools::doJobCollection("<%= uri %>")'
8893
res=$?
8994
echo " - exit code: ${res}"
90-
echo "Command: Rscript -e 'batchtools::doJobCollection("<%= uri %>")' ... done"
95+
echo "Rscript -e 'batchtools::doJobCollection()' ... done"
96+
echo
9197

9298
<% if (details) { %>
9399
if command -v bjobs > /dev/null; then

inst/templates/sge.tmpl

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,33 @@ set -u # error on unset variables
5555
set -o pipefail # fail a pipeline if any command fails
5656
trap 'echo "ERROR: future.batchtools job script failed on line $LINENO" >&2; exit 1' ERR
5757

58-
echo "Batchtools information:"
59-
echo "- job name: '<%= job.name %>'"
60-
echo "- job log file: '<%= log.file %>'"
61-
echo
58+
<% if (length(job_declarations) > 0) {
59+
writeLines(c(
60+
"echo 'Job submission declarations:'",
61+
sprintf("echo '%s'", job_declarations),
62+
"echo"
63+
))
64+
} %>
65+
66+
<% if (details) { %>
67+
if command -v qstat > /dev/null; then
68+
echo "Job information:"
69+
qstat -j "${JOB_ID}"
70+
echo
71+
fi
72+
<% } %>
6273

6374
<% if (length(startup) > 0) {
6475
writeLines(startup)
6576
} %>
6677

67-
echo "Load environment modules:"
6878
<% if (length(modules) > 0) {
69-
writeLines(c(sprintf("module load %s", modules), "module list"))
79+
writeLines(c(
80+
"echo 'Load environment modules:'",
81+
sprintf("echo '- modules: %s'", paste(modules, collapse = ", ")),
82+
sprintf("module load %s", paste(modules, collapse = " ")),
83+
"module list"
84+
))
7085
} %>
7186

7287
echo "Session information:"
@@ -77,26 +92,17 @@ echo "- Rscript version: $(Rscript --version)"
7792
echo "- Rscript library paths: $(Rscript -e "cat(shQuote(.libPaths()), sep = ' ')")"
7893
echo
7994

80-
echo "Job submission declarations:"
81-
<%
82-
writeLines(sprintf("echo '%s'", job_declarations))
83-
%>
84-
85-
<% if (details) { %>
86-
if command -v qstat > /dev/null; then
87-
echo "Job information:"
88-
qstat -j "${JOB_ID}"
89-
echo
90-
fi
91-
<% } %>
92-
9395

9496
## Launch R and evaluate the batchtools R job
95-
echo "Command: Rscript -e 'batchtools::doJobCollection("<%= uri %>")' ..."
97+
echo "Rscript -e 'batchtools::doJobCollection()' ..."
98+
echo "- job name: '<%= job.name %>'"
99+
echo "- job log file: '<%= log.file %>'"
100+
echo "- job uri: '<%= uri %>'"
96101
Rscript -e 'batchtools::doJobCollection("<%= uri %>")'
97102
res=$?
98103
echo " - exit code: ${res}"
99-
echo "Command: Rscript -e 'batchtools::doJobCollection("<%= uri %>")' ... done"
104+
echo "Rscript -e 'batchtools::doJobCollection()' ... done"
105+
echo
100106

101107
<% if (details) { %>
102108
if command -v qstat > /dev/null; then

inst/templates/slurm.tmpl

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,33 @@ set -u # error on unset variables
4545
set -o pipefail # fail a pipeline if any command fails
4646
trap 'echo "ERROR: future.batchtools job script failed on line $LINENO" >&2; exit 1' ERR
4747

48-
echo "Batchtools information:"
49-
echo "- job name: '<%= job.name %>'"
50-
echo "- job log file: '<%= log.file %>'"
51-
echo
48+
<% if (length(job_declarations) > 0) {
49+
writeLines(c(
50+
"echo 'Job submission declarations:'",
51+
sprintf("echo '%s'", job_declarations),
52+
"echo"
53+
))
54+
} %>
55+
56+
<% if (details) { %>
57+
if command -v scontrol > /dev/null; then
58+
echo "Job information:"
59+
scontrol show job "${SLURM_JOB_ID}"
60+
echo
61+
fi
62+
<% } %>
5263

5364
<% if (length(startup) > 0) {
5465
writeLines(startup)
5566
} %>
5667

57-
echo "Load environment modules:"
5868
<% if (length(modules) > 0) {
59-
writeLines(c(sprintf("module load %s", modules), "module list"))
69+
writeLines(c(
70+
"echo 'Load environment modules:'",
71+
sprintf("echo '- modules: %s'", paste(modules, collapse = ", ")),
72+
sprintf("module load %s", paste(modules, collapse = " ")),
73+
"module list"
74+
))
6075
} %>
6176

6277
echo "Session information:"
@@ -67,25 +82,16 @@ echo "- Rscript version: $(Rscript --version)"
6782
echo "- Rscript library paths: $(Rscript -e "cat(shQuote(.libPaths()), sep = ' ')")"
6883
echo
6984

70-
echo "Job submission declarations:"
71-
<%
72-
writeLines(sprintf("echo '%s'", job_declarations))
73-
%>
74-
75-
<% if (details) { %>
76-
if command -v scontrol > /dev/null; then
77-
echo "Slurm job information:"
78-
scontrol show job "${SLURM_JOB_ID}"
79-
echo
80-
fi
81-
<% } %>
82-
8385
## Launch R and evaluate the batchtools R job
84-
echo "Command: Rscript -e 'batchtools::doJobCollection("<%= uri %>")' ..."
86+
echo "Rscript -e 'batchtools::doJobCollection()' ..."
87+
echo "- job name: '<%= job.name %>'"
88+
echo "- job log file: '<%= log.file %>'"
89+
echo "- job uri: '<%= uri %>'"
8590
Rscript -e 'batchtools::doJobCollection("<%= uri %>")'
8691
res=$?
8792
echo " - exit code: ${res}"
88-
echo "Command: Rscript -e 'batchtools::doJobCollection("<%= uri %>")' ... done"
93+
echo "Rscript -e 'batchtools::doJobCollection()' ... done"
94+
echo
8995

9096
<% if (details) { %>
9197
if command -v sstat > /dev/null; then

inst/templates/torque.tmpl

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,33 @@ set -u # error on unset variables
4949
set -o pipefail # fail a pipeline if any command fails
5050
trap 'echo "ERROR: future.batchtools job script failed on line $LINENO" >&2; exit 1' ERR
5151

52-
echo "Batchtools information:"
53-
echo "- job name: '<%= job.name %>'"
54-
echo "- job log file: '<%= log.file %>'"
55-
echo
52+
<% if (length(job_declarations) > 0) {
53+
writeLines(c(
54+
"echo 'Job submission declarations:'",
55+
sprintf("echo '%s'", job_declarations),
56+
"echo"
57+
))
58+
} %>
59+
60+
<% if (details) { %>
61+
if command -v qstat > /dev/null; then
62+
echo "Job information:"
63+
qstat -f "${PBS_JOBID}"
64+
echo
65+
fi
66+
<% } %>
5667

5768
<% if (length(startup) > 0) {
5869
writeLines(startup)
5970
} %>
6071

61-
echo "Load environment modules:"
6272
<% if (length(modules) > 0) {
63-
writeLines(c(sprintf("module load %s", modules), "module list"))
73+
writeLines(c(
74+
"echo 'Load environment modules:'",
75+
sprintf("echo '- modules: %s'", paste(modules, collapse = ", ")),
76+
sprintf("module load %s", paste(modules, collapse = " ")),
77+
"module list"
78+
))
6479
} %>
6580

6681
echo "Session information:"
@@ -71,25 +86,16 @@ echo "- Rscript version: $(Rscript --version)"
7186
echo "- Rscript library paths: $(Rscript -e "cat(shQuote(.libPaths()), sep = ' ')")"
7287
echo
7388

74-
echo "Job submission declarations:"
75-
<% if (length(modules) > 0) {
76-
writeLines(c(sprintf("module load %s", modules), "module list"))
77-
} %>
78-
79-
<% if (details) { %>
80-
if command -v qstat > /dev/null; then
81-
echo "Job information:"
82-
qstat -f "${PBS_JOBID}"
83-
echo
84-
fi
85-
<% } %>
86-
8789
## Launch R and evaluate the batchtools R job
88-
echo "Command: Rscript -e 'batchtools::doJobCollection("<%= uri %>")' ..."
90+
echo "Rscript -e 'batchtools::doJobCollection()' ..."
91+
echo "- job name: '<%= job.name %>'"
92+
echo "- job log file: '<%= log.file %>'"
93+
echo "- job uri: '<%= uri %>'"
8994
Rscript -e 'batchtools::doJobCollection("<%= uri %>")'
9095
res=$?
9196
echo " - exit code: ${res}"
92-
echo "Command: Rscript -e 'batchtools::doJobCollection("<%= uri %>")' ... done"
97+
echo "Rscript -e 'batchtools::doJobCollection()' ... done"
98+
echo
9399

94100
<% if (details) { %>
95101
if command -v qstat > /dev/null; then

0 commit comments

Comments
 (0)