Skip to content

Commit e876c45

Browse files
Built-in templates will query job stats conditioned on the command tool is available [#26]
1 parent 4a54e21 commit e876c45

File tree

11 files changed

+97
-47
lines changed

11 files changed

+97
-47
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-9978
2+
Version: 0.12.2-9979
33
Depends:
44
R (>= 3.2.0),
55
parallelly,

inst/templates/lsf.tmpl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,11 @@ echo "Job submission declarations:"
7070
writeLines(sprintf("echo '%s'", job_declarations))
7171
%>
7272

73-
echo "Job information:"
74-
bjobs -l "${LSB_JOBID}"
75-
echo
73+
if command -v bjobs > /dev/null; then
74+
echo "Job information:"
75+
bjobs -l "${LSB_JOBID}"
76+
echo
77+
fi
7678

7779
## Launch R and evaluate the batchtools R job
7880
echo "Command: Rscript -e 'batchtools::doJobCollection("<%= uri %>")' ..."
@@ -82,7 +84,10 @@ echo " - exit code: ${res}"
8284
echo "Command: Rscript -e 'batchtools::doJobCollection("<%= uri %>")' ... done"
8385

8486
## End-of-job summary
85-
bjobs -l "${LSB_JOBID}"
87+
if command -v bjobs > /dev/null; then
88+
echo "Job summary:"
89+
bjobs -l "${LSB_JOBID}"
90+
fi
8691

8792
<% if (length(shutdown) > 0) {
8893
## Inject optional shell code

inst/templates/openlava.tmpl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,11 @@ echo "Job submission declarations:"
7070
writeLines(sprintf("echo '%s'", job_declarations))
7171
%>
7272

73-
echo "Job information:"
74-
bjobs -l "${LSB_JOBID}"
75-
echo
73+
if command -v bjobs > /dev/null; then
74+
echo "Job information:"
75+
bjobs -l "${LSB_JOBID}"
76+
echo
77+
fi
7678

7779
## Launch R and evaluate the batchtools R job
7880
echo "Command: Rscript -e 'batchtools::doJobCollection("<%= uri %>")' ..."
@@ -82,7 +84,10 @@ echo " - exit code: ${res}"
8284
echo "Command: Rscript -e 'batchtools::doJobCollection("<%= uri %>")' ... done"
8385

8486
## End-of-job summary
85-
bjobs -l "${LSB_JOBID}"
87+
if command -v bjobs > /dev/null; then
88+
echo "Job summary:"
89+
bjobs -l "${LSB_JOBID}"
90+
fi
8691

8792
<% if (length(shutdown) > 0) {
8893
## Inject optional shell code

inst/templates/sge.tmpl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,11 @@ echo "Job submission declarations:"
7979
writeLines(sprintf("echo '%s'", job_declarations))
8080
%>
8181

82-
echo "Job information:"
83-
qstat -j "${JOB_ID}"
84-
echo
82+
if command -v qstat > /dev/null; then
83+
echo "Job information:"
84+
qstat -j "${JOB_ID}"
85+
echo
86+
fi
8587

8688
## Launch R and evaluate the batchtools R job
8789
echo "Command: Rscript -e 'batchtools::doJobCollection("<%= uri %>")' ..."
@@ -91,7 +93,10 @@ echo " - exit code: ${res}"
9193
echo "Command: Rscript -e 'batchtools::doJobCollection("<%= uri %>")' ... done"
9294

9395
## End-of-job summary
94-
qstat -j "${JOB_ID}"
96+
if command -v qstat > /dev/null; then
97+
echo "Job summary:"
98+
qstat -j "${JOB_ID}"
99+
fi
95100

96101
<% if (length(shutdown) > 0) {
97102
## Inject optional shell code

inst/templates/slurm.tmpl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,11 @@ echo "Job submission declarations:"
6969
writeLines(sprintf("echo '%s'", job_declarations))
7070
%>
7171

72-
echo "Slurm job information:"
73-
scontrol show job "${SLURM_JOB_ID}"
74-
echo
72+
if command -v scontrol > /dev/null; then
73+
echo "Slurm job information:"
74+
scontrol show job "${SLURM_JOB_ID}"
75+
echo
76+
fi
7577

7678
## Launch R and evaluate the batchtools R job
7779
echo "Command: Rscript -e 'batchtools::doJobCollection("<%= uri %>")' ..."
@@ -81,7 +83,10 @@ echo " - exit code: ${res}"
8183
echo "Command: Rscript -e 'batchtools::doJobCollection("<%= uri %>")' ... done"
8284

8385
## End-of-job summary
84-
sstat --format="JobID,AveCPU,MaxRSS,MaxPages,MaxDiskRead,MaxDiskWrite" --allsteps --jobs="${SLURM_JOB_ID}"
86+
if command -v sstat > /dev/null; then
87+
echo "Job summary:"
88+
sstat --format="JobID,AveCPU,MaxRSS,MaxPages,MaxDiskRead,MaxDiskWrite" --allsteps --jobs="${SLURM_JOB_ID}"
89+
fi
8590

8691
<% if (length(shutdown) > 0) {
8792
## Inject optional shell code

inst/templates/torque.tmpl

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ echo
5656
} %>
5757

5858
echo "Load environment modules:"
59-
<%
60-
writeLines(sprintf("module load %s", modules))
61-
%>
59+
<% if (length(modules) > 0) {
60+
writeLines(c(sprintf("module load %s", modules), "module list"))
61+
} %>
6262

6363
echo "Session information:"
6464
echo "- timestamp: $(date)"
@@ -73,9 +73,11 @@ echo "Job submission declarations:"
7373
writeLines(c(sprintf("module load %s", modules), "module list"))
7474
} %>
7575

76-
echo "Job information:"
77-
qstat -f "${PBS_JOBID}"
78-
echo
76+
if command -v qstat > /dev/null; then
77+
echo "Job information:"
78+
qstat -f "${PBS_JOBID}"
79+
echo
80+
fi
7981

8082
## Launch R and evaluate the batchtools R job
8183
echo "Command: Rscript -e 'batchtools::doJobCollection("<%= uri %>")' ..."
@@ -85,7 +87,10 @@ echo " - exit code: ${res}"
8587
echo "Command: Rscript -e 'batchtools::doJobCollection("<%= uri %>")' ... done"
8688

8789
## End-of-job summary
88-
qstat -f "${PBS_JOBID}"
90+
if command -v qstat > /dev/null; then
91+
echo "Job summary:"
92+
qstat -f "${PBS_JOBID}"
93+
fi
8994

9095
<% if (length(shutdown) > 0) {
9196
## Inject optional shell code

man/batchtools_lsf.Rd

Lines changed: 9 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/batchtools_openlava.Rd

Lines changed: 9 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/batchtools_sge.Rd

Lines changed: 9 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/batchtools_slurm.Rd

Lines changed: 9 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)