@@ -118,7 +118,7 @@ class(batchtools_torque) <- c("batchtools_torque", "batchtools_template",
118118 " batchtools" , " multiprocess" , " future" ,
119119 " function" )
120120
121-
121+ # ' @importFrom batchtools findTemplateFile
122122# ' @importFrom batchtools makeClusterFunctionsLSF
123123# ' @importFrom batchtools makeClusterFunctionsOpenLava
124124# ' @importFrom batchtools makeClusterFunctionsSGE
@@ -152,28 +152,24 @@ batchtools_by_template <- function(expr, envir = parent.frame(),
152152 ! is.na(template ), nzchar(template ))
153153
154154 # # Tweaked search for template file
155- findTemplateFile <- import_batchtools(" findTemplateFile" , default = NA )
156- if (! identical(findTemplateFile , NA )) {
157- pathname <- tryCatch({
158- findTemplateFile(template )
159- }, error = function (ex ) {
160- # # Try to find it in this package?
161- if (grepl(" Argument 'template'" , conditionMessage(ex ))) {
162- pathname <- system.file(" templates" , sprintf(" %s.tmpl" , template ),
163- package = " future.batchtools" )
164- if (file_test(" -f" , pathname )) return (pathname )
165- }
166- stop(ex )
167- })
168-
169- if (is.na(pathname )) {
170- stop(sprintf(" Failed to locate a batchtools template file: *%s.tmpl" ,
171- template ))
155+ pathname <- tryCatch({
156+ findTemplateFile(template )
157+ }, error = function (ex ) {
158+ # # Try to find it in this package?
159+ if (grepl(" Argument 'template'" , conditionMessage(ex ))) {
160+ pathname <- system.file(" templates" , sprintf(" %s.tmpl" , template ),
161+ package = " future.batchtools" )
162+ if (file_test(" -f" , pathname )) return (pathname )
172163 }
173-
174- template <- pathname
164+ stop(ex )
165+ })
166+ if (is.na(pathname )) {
167+ stop(sprintf(" Failed to locate a batchtools template file: *%s.tmpl" ,
168+ template ))
175169 }
176170
171+ template <- pathname
172+
177173 cluster.functions <- make_cfs(template )
178174 attr(cluster.functions , " template" ) <- template
179175
0 commit comments