From fad736c4c6a12e3f73f5d4e100f3f62d7f1467ae Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Fri, 14 Apr 2017 12:47:32 +0200 Subject: IRATI: moved generated conf files in IRATI_conf folder --- rumba/prototypes/irati.py | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'rumba') diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py index dd7086e..edc49c6 100644 --- a/rumba/prototypes/irati.py +++ b/rumba/prototypes/irati.py @@ -53,6 +53,16 @@ class Experiment(mod.Experiment): else: self.sudo = self.real_sudo + self._conf_dir = os.path.join(os.getcwd(), 'IRATI_conf') + try: + os.mkdir(self._conf_dir) + except OSError: + # Already there, nothing to do + pass + + def conf_dir(self, path): + return os.path.join(self._conf_dir, path) + def setup(self): """Installs IRATI on the vms.""" setup_irati = False @@ -104,6 +114,8 @@ class Experiment(mod.Experiment): [gen_files_conf, 'normal.%(name)s.*.dif' % {'name': name}]) dir_path = os.path.dirname(os.path.abspath(__file__)) gen_files_bin = 'enroll.py' + gen_files_conf_full = \ + ' '.join([self.conf_dir(x) for x in gen_files_conf.split()]) gen_files_bin_full = os.path.join(dir_path, 'enroll.py') ipcm_components = ['scripting', 'console'] @@ -111,7 +123,7 @@ class Experiment(mod.Experiment): ipcm_components.append('mad') ipcm_components = ', '.join(ipcm_components) - gen_files = ' '.join([gen_files_conf, gen_files_bin_full]) + gen_files = ' '.join([gen_files_conf_full, gen_files_bin_full]) sshopts = ('-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' ' -o IdentityFile=%s' @@ -270,11 +282,11 @@ class Experiment(mod.Experiment): "difName": shim.name }) - template_file_name = 'shimeth.%s.%s.dif' \ - % (node.name, shim.name) + template_file_name = self.conf_dir('shimeth.%s.%s.dif' + % (node.name, shim.name)) ipcmconf["difConfigurations"].append({ "name": shim.name, - "template": template_file_name + "template": os.path.basename(template_file_name) }) fout = open(template_file_name, 'w') @@ -334,7 +346,7 @@ class Experiment(mod.Experiment): difconfs[dif.name][node_name], path, ps, parms=[]) # Dump the DIF Allocator map - with open('da.map', 'w') as da_map_file: + with open(self.conf_dir('da.map'), 'w') as da_map_file: json.dump(irati_templates.da_map_base, da_map_file, indent=4, @@ -342,7 +354,8 @@ class Experiment(mod.Experiment): for node in self.nodes: # Dump the IPCM configuration files - with open('%s.ipcm.conf' % (node.name,), 'w') as node_file: + with open(self.conf_dir('%s.ipcm.conf' + % (node.name,)), 'w') as node_file: json.dump(ipcmconfs[node.name], node_file, indent=4, @@ -353,7 +366,8 @@ class Experiment(mod.Experiment): if dif_conf: # Dump the normal DIF configuration files for node in dif.members: - with open('normal.%s.%s.dif' % (node.name, dif.name), 'w') \ + with open(self.conf_dir('normal.%s.%s.dif' + % (node.name, dif.name)), 'w') \ as dif_conf_file: json.dump(dif_conf[node.name], dif_conf_file, -- cgit v1.2.3