Commit 94077d29 authored by Jerome Mariette's avatar Jerome Mariette

add batch_options to component

parent bb539ec9
......@@ -39,6 +39,8 @@ class Component(object):
self.output_directory = None
self.config_reader = JFlowConfigReader()
self.version = self.get_version()
self.jflow_config_reader = JFlowConfigReader()
self.batch_options = self.jflow_config_reader.get_component_batch_options(self.__class__.__name__)
def _longestCommonSubstr(self, data, clean_end=True):
substr = ''
......
......@@ -68,4 +68,10 @@ class JFlowConfigReader(object):
return [type, options]
except NoOptionError, e:
return None
\ No newline at end of file
def get_component_batch_options(self, component_class):
try:
return self.reader.get("components", component_class+".batch_options")
except:
return ""
\ No newline at end of file
......@@ -345,6 +345,7 @@ class Workflow(threading.Thread):
try:
for component in self.components:
nest.symbol = component.get_nameid()
nest.batch = component.batch_options
self.component_nameids[component.get_nameid()] = os.path.join(current_working_directory, self.MAKEFLOW_LOG_FILE_NAME)
component.execute()
# create the DAG
......
......@@ -60,6 +60,7 @@ class Abstraction(Dataset):
self.local = local
Dataset.__init__(self)
self.symbol = self.nest.symbol
self.batch = self.nest.batch
if collect:
self.collect = parse_input_list(self.inputs)
......@@ -72,6 +73,7 @@ class Abstraction(Dataset):
def compile(self):
self.nest.symbol = self.symbol
self.nest.batch = self.batch
""" Compile Abstraction to produce scheduled tasks. """
debug(D_ABSTRACTION, 'Compiling Abstraction {0}'.format(self))
for _ in self:
......
61a62
> self.symbol = self.nest.symbol
62a63
> self.batch = self.nest.batch
72a74
> self.nest.symbol = self.symbol
74a76
> self.nest.batch = self.batch
......@@ -83,6 +83,8 @@ class Function(object):
options.local = True
if environment:
options.environment.update(environment)
if nest.batch:
options.batch = nest.batch
nest.schedule(abstraction, self, command,
list(inputs) + list(includes), outputs, options, nest.symbol)
......
83a84
>
85a86,87
> if nest.batch:
> options.batch = nest.batch
86c87
<
---
......
......@@ -44,6 +44,8 @@ class Nest(Makeflow):
self.tasks = []
self.parent = CurrentNest()
self.symbol = None
self.batch = ""
if self.parent:
self.work_dir = os.path.join(self.parent.work_dir, self.work_dir)
self.stash = stash or Stash(root=os.path.join(self.work_dir, '_Stash'))
......@@ -194,7 +196,7 @@ class Nest(Makeflow):
options, self))
if abstraction is None:
abstraction = SENTINEL
abstraction = SENTINEL
self.tasks.append(
[abstraction, function, command, inputs, outputs, options, symbol])
......
......@@ -4,6 +4,8 @@
> wrapper=None, track_imports=True, track_exports=True, path=None):
46d45
< self.symbol = None
46a47,48
> self.batch = ""
53c53
< Makeflow.__init__(self, wrapper=wrapper,
---
......@@ -19,4 +21,4 @@
199c198
< [abstraction, function, command, inputs, outputs, options, symbol])
---
> [abstraction, function, command, inputs, outputs, options])
\ No newline at end of file
> [abstraction, function, command, inputs, outputs, options])
Markdown is supported
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