Skip to content

Commit

Permalink
Fix for #73 and #74.
Browse files Browse the repository at this point in the history
#MSUB -l depend=afterok:960775:960854 works for scatter-gather but not the current format, #MSUB -l depend=afterok:960775: depend=afterok:960854
  • Loading branch information
sahilseth committed Feb 19, 2017
1 parent 28ff02e commit addfe29
Showing 1 changed file with 49 additions and 43 deletions.
92 changes: 49 additions & 43 deletions R/render-dependency.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,23 @@ render_dependency.local <- function(...){
return("")
}

## http://docs.adaptivecomputing.com/torque/4-1-4/Content/topics/commands/qsub.htm
# http://docs.adaptivecomputing.com/torque/4-1-4/Content/topics/commands/qsub.htm

render_dependency.torque <- function(x, index, ...){
dep_type = x@dependency_type

if(dep_type == 'gather'){
dep = sprintf("-W depend=afterok:%s",
paste(unlist(x@dependency), collapse = ":"))
}else if(dep_type == "serial"){
dep <- sprintf("-W %s", paste(" depend=afterok:",
x@dependency[[index]],
sep="", collapse=":"))
dep <- sprintf("-W depend=afterok:%s",
paste(x@dependency[[index]],sep="", collapse=":"))

}else if(dep_type == "burst"){
index=1
dep <- sprintf("-W %s",paste(" depend=afterok:",
x@dependency[[index]], sep="",
collapse=":"))
dep <- sprintf("-W depend=afterok:%s",
paste(x@dependency[[index]], sep="", collapse=":"))

}else{dep = ""}
return(dep)
}
Expand All @@ -47,7 +48,7 @@ render_dependency.lsf <- function(x, index, ...){
dep <- sprintf("-w '%s' -ti",
paste(unlist(x@dependency), collapse = " && "))
}else if(dep_type == "serial"){
dep <- sprintf("-w '%s' -ti", paste(x@dependency[[index]], collapse=" && "))
dep <- sprintf("-w '%s' -ti", paste(x@dependency[[index]], collapse=" && "))
}else if(dep_type == "burst"){
index=1
dep <- sprintf("-w '%s' -ti", paste(x@dependency[[index]],
Expand All @@ -62,58 +63,63 @@ render_dependency.test = render_dependency.lsf
# @samin, change dependency format for moab

render_dependency.moab <- function(x, index, ...){

dep_type = x@dependency_type
if(dep_type == 'gather'){
dep = sprintf("-l depend=afterok:%s",
paste(unlist(x@dependency), collapse = ":"))
}else if(dep_type == "serial"){
dep <- sprintf("-l %s", paste(" depend=afterok:",
x@dependency[[index]],
sep="", collapse=":"))
}else if(dep_type == "burst"){
index=1
dep <- sprintf("-l %s",paste(" depend=afterok:",
x@dependency[[index]], sep="",
collapse=":"))
}else{dep = ""}
return(dep)

dep_type = x@dependency_type
if(dep_type == 'gather'){
dep = sprintf("-l depend=afterok:%s",
paste(unlist(x@dependency), collapse = ":"))
}else if(dep_type == "serial"){
dep <- sprintf("-l depend=afterok:%s", paste(x@dependency[[index]],
sep="", collapse=":"))
}else if(dep_type == "burst"){
index=1
dep <- sprintf("-l depend=afterok: %s",paste(x@dependency[[index]], sep="",
collapse=":"))
}else{dep = ""}
return(dep)
}

render_dependency.sge <- function(x, index, ...){
dep_type = x@dependency_type

# wait for all previous jobs
# MSUB -l depend=afterok:960775:960854
if(dep_type == 'gather'){
dep = sprintf("-W depend=afterok:%s",
paste(unlist(x@dependency), collapse = ":"))

# one for each previous job
# MSUB -l depend=afterok:960775
# MSUB -l depend=afterok:960854
}else if(dep_type == "serial"){
dep <- sprintf("-W %s", paste(" depend=afterok:",
x@dependency[[index]],
sep="", collapse=":"))
dep <- sprintf("-W depend=afterok:%s",
paste(x@dependency[[index]], sep="", collapse=":"))

# MSUB -l depend=afterok:960775
}else if(dep_type == "burst"){
index=1
dep <- sprintf("-W %s",paste(" depend=afterok:",
x@dependency[[index]], sep="",
collapse=":"))
dep <- sprintf("-W depend=afterok:%s",
paste(x@dependency[[index]], sep="", collapse=":"))
}else{dep = ""}
return(dep)
}


## this has not been tested !
render_dependency.slurm <- function(x, index, ...){
dep_type = x@dependency_type
if(dep_type == 'gather'){
dep = sprintf("--dependency=afterok:%s",
paste(unlist(x@dependency), collapse = ":"))
}else if(dep_type == "serial"){ ## collapse jobs at a specific index
dep <- sprintf("--dependency=afterok:%s",
paste(x@dependency[[index]], sep="", collapse=":"))
}else if(dep_type == "burst"){
index=1 ## ALL of them would see index 1
dep <- sprintf("--dependency=afterok:%s",
paste(x@dependency[[index]], sep="", collapse=":"))
}else{dep = ""}
return(dep)
dep_type = x@dependency_type
if(dep_type == 'gather'){
dep = sprintf("--dependency=afterok:%s",
paste(unlist(x@dependency), collapse = ":"))
}else if(dep_type == "serial"){ ## collapse jobs at a specific index
dep <- sprintf("--dependency=afterok:%s",
paste(x@dependency[[index]], sep="", collapse=":"))
}else if(dep_type == "burst"){
index=1 ## ALL of them would see index 1
dep <- sprintf("--dependency=afterok:%s",
paste(x@dependency[[index]], sep="", collapse=":"))
}else{dep = ""}
return(dep)
}


Expand Down

0 comments on commit addfe29

Please sign in to comment.