Commit 4b842774 authored by Fidel Alfaro Almagro's avatar Fidel Alfaro Almagro
Browse files

Return to a more complex executing scheme

parent e1359e17
......@@ -35,7 +35,7 @@ class Usage(Exception):
def choose_block(subject, runTopup, fileConfig, queue, coeff, num_shells,
b_value_shell, exec_block):
if ((exec_block == 0) or (exec_block == 123)):
if exec_block == 0:
# Default value for job id. SGE does not wait for a job with this id.
jobSTEP2 = "1"
jobSTEP3 = "1"
......@@ -45,15 +45,14 @@ def choose_block(subject, runTopup, fileConfig, queue, coeff, num_shells,
if runTopup:
jobSTEP2 = bb_pipeline_func(subject, jobSTEP1, fileConfig, queue, coeff)
jobSTEP3 = bb_pipeline_diff_joint(subject, jobSTEP1, fileConfig, queue,
jobSTEP3 = bb_pipeline_asl(subject, jobSTEP1, fileConfig)
jobSTEP4 = bb_pipeline_diff_joint(subject, jobSTEP1, fileConfig, queue,
coeff, num_shells, b_value_shell,
exec_block)
jobSTEP4 = bb_pipeline_asl(subject, jobSTEP1, fileConfig)
jobSTEP5 = bb_pipeline_FS(subject, jobSTEP1, fileConfig, queue)
jobSTEP6 = bb_IDP(subject, str(jobSTEP1) + "," + str(jobSTEP2) + "," + str(jobSTEP3) + "," + str(jobSTEP4),
jobSTEP6 = bb_IDP(subject, str(jobSTEP1) + "," + str(jobSTEP2) + "," + str(jobSTEP4),
fileConfig, queue)
jobSTEP7 = bb_post_pipeline(subject, str(jobSTEP4) + "," + str(jobSTEP5) + "," + str(jobSTEP6),
jobSTEP7 = bb_post_pipeline(subject, str(jobSTEP3) + "," + str(jobSTEP5) + "," + str(jobSTEP6),
fileConfig, queue)
return jobSTEP7
......@@ -67,30 +66,34 @@ def choose_block(subject, runTopup, fileConfig, queue, coeff, num_shells,
else:
return jobSTEP1
elif ((exec_block == 2) or (exec_block == 20)):
elif exec_block == 123:
jobSTEP1 = bb_pipeline_struct(subject, runTopup, fileConfig, queue, coeff)
if runTopup:
jobSTEP2 = bb_pipeline_diff_joint(subject, 1, fileConfig, queue,
jobSTEP2 = bb_pipeline_func(subject, jobSTEP1, fileConfig, queue, coeff)
jobSTEP3 = bb_pipeline_asl(subject, jobSTEP1, fileConfig)
jobSTEP4 = bb_pipeline_diff_joint(subject, jobSTEP1, fileConfig, queue,
coeff, num_shells, b_value_shell,
exec_block)
return jobSTEP2
return jobSTEP4
else:
return 1
elif (exec_block == 3):
jobSTEP1 = "1"
jobSTEP3 = "1"
jobSTEP4 = "1"
return jobSTEP1
elif ((exec_block == 2) or (exec_block == 20) or (exec_block == 3) or
(exec_block == 4) or (exec_block == 40)):
if runTopup:
jobSTEP3 = bb_pipeline_diff_joint(subject, jobSTEP1, fileConfig, queue,
jobSTEP3 = bb_pipeline_diff_joint(subject, 1, fileConfig, queue,
coeff, num_shells, b_value_shell,
exec_block)
return jobSTEP3
else:
return 1
jobSTEP5 = bb_pipeline_FS(subject, jobSTEP1, fileConfig, queue)
jobSTEP6 = bb_IDP(subject, str(jobSTEP1) + "," + str(jobSTEP2) + "," + str(jobSTEP3) + "," + str(jobSTEP4),
fileConfig, queue)
jobSTEP7 = bb_post_pipeline(subject, str(jobSTEP4) + "," + str(jobSTEP5) + "," + str(jobSTEP6),
fileConfig, queue)
if exec_block == 5:
jobSTEP5 = bb_pipeline_FS(subject, "1", fileConfig, queue)
jobSTEP6 = bb_IDP(subject, "1", fileConfig, queue)
jobSTEP7 = bb_post_pipeline(subject, str(jobSTEP5) + "," + str(jobSTEP6), fileConfig, queue)
return jobSTEP7
else:
return 1
......@@ -153,12 +156,15 @@ def main():
dest="num_shells")
parser.add_argument("-X", "--exec_block", action="store", nargs="?", default=0,
help='Pipeline block(s) to execute: Option (default 0): \n' +
' - 0 Run the whole pipeline with default parameters \n' +
' - 1 Run (CPU) 1st block (up until eddy) \n' +
' - 2 Run (GPU) 2nd block (eddy + bedpostX + probtrackX) \n' +
' - 3 Run (CPU) 3rd block (after eddy + bedpostX + probtrackX) \n' +
' - 20 Run (CPU) 2nd block (eddy + bedpostX + probtrackX) \n '+
' - 123 Run (CPU) 1st, 2nd, & 3rd block \n ',
' - 0: Run the whole pipeline with default parameters \n' +
' - 1: Run (CPU) 1st block (up until eddy) \n' +
' - 2: Run (GPU) 2nd block (eddy) \n' +
' - 3: Run (CPU) 3rd block (after eddy, before bedpostX + probtrackX) \n' +
' - 4: Run (GPU) 4th block (bedpostX + probtrackX) \n' +
' - 5: Run (CPU) 5th block (everything after bedpostX + probtrackX) \n' +
' - 20: Run (CPU) 2nd block (eddy) \n '+
' - 40: Run (CPU) 4th block (bedpostX + probtrackX) \n ' +
' - 123: Run (CPU) 1st, 2nd, & 3rd block (up until bedpostX) \n ',
dest="exec_block")
#########################
......@@ -199,7 +205,6 @@ def main():
if not os.path.exists(coeff):
coeff = "none"
# Parsing number of SWI coils argument
if not argsa.coils_SWI:
coils_SWI = 32
......@@ -316,7 +321,7 @@ def main():
else:
try:
exec_block = int(argsa.exec_block)
allowed_values = [0, 1, 2, 3, 20, 123]
allowed_values = [0, 1, 2, 3, 4, 5, 20, 40, 123]
if not exec_block in allowed_values:
logger.warning("ERROR in the eXecute block: " + exec_block +
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment