Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit f28cc575 authored by Maude Le Jeune's avatar Maude Le Jeune
Browse files

add get_input facility to environment

parent 015bdb2f
......@@ -36,7 +36,7 @@ I see at least before three projects to complete before making the first release
result. I think this is not an issue (Maude)
- [ ] Its calling signature should be rethought
- The name should be changed in glob_parents and glob_seg
- [ ] Are we satisfied with seg_input, is this convenient, should we
- [X] Are we satisfied with seg_input, is this convenient, should we
provide extra function to ease the retrieval of inputs.
- [ ] Are we satisfied with the lst_par, lst_tag, load_param syntax (may become save(name1,name2 ...) and expose(name1,name2...))
- [ ] logged_subprocess is the function I use in every segment,
......@@ -151,6 +151,33 @@ class Environment(EnvironmentBase):
self.logger = init_logger (self._get_data_fn(""), self._get_log_file(), level=[])
def get_input(self, seg=None):
""" Get segment input.
seg: string segment name
python object or None
if isinstance(self.seg_input, dict):
if seg is not None:
if self.seg_input.has_key(seg):
return self.seg_input[seg]
else:"No input from parent named %s", seg)
if len(self.seg_input.values())>0:
return self.seg_input.values()[0]
else:"Empty input list")
elif isinstance(self.seg_input, list) and len(self.seg_input)==0:"Empty input list")
return self.seg_input
return None
def get_data_fn(self, x):
""" Complete the filename with the path to the working
print seg_input
import os
os.system("touch %s"%get_data_fn("file%d.dat"%seg_input.values()[0]))
seg_output = [seg_input.values()[0]]
inp = get_input()
os.system("touch %s"%get_data_fn("file%d.dat"%inp))
seg_output = [inp]
#seg_output = ['aa', 'bb']
import os
print seg_input
os.system("touch %s"%get_data_fn("bbbb%d.dat"%seg_input.values()[0]))
#seg_output = [(seg_input.values()[0], "pp")]
inp = get_input()
os.system("touch %s"%get_data_fn("bbbb%d.dat"%inp))
seg_output = [(inp, "pp")]
#multiplex cross_prod group_by "0"
print seg_input
import os
f = glob_seg("a", "file*.dat")
for file in f:
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