def wf_postprocess(self): """ Execute post processes """ # Creates a temporary symlink future_release to keep compatibility if process # tries to access dir with this name future_link = os.path.join( self.bank.config.get("data.dir"), self.bank.config.get("dir.version"), "future_release" ) prod_dir = self.session.get_full_release_directory() to_dir = os.path.join(self.bank.config.get("data.dir"), self.bank.config.get("dir.version")) if os.path.lexists(future_link): os.remove(future_link) os.chdir(to_dir) os.symlink(self.session.get_release_directory(), "future_release") logging.info("Workflow:wf_postprocess") blocks = self.session._session["process"]["postprocess"] pfactory = PostProcessFactory(self.bank, blocks) res = pfactory.run() self.session._session["process"]["postprocess"] = pfactory.blocks # In any way, delete symlink if os.path.lexists(future_link): os.remove(future_link) return res
def test_postprocesses_exec_again(self): ''' Execute once, set a status to false, check that False processes are executed ''' b = Bank('localprocess') pfactory = PostProcessFactory(b) pfactory.run() self.assertTrue(pfactory.blocks['BLOCK1']['META0']['PROC0']) self.assertTrue(pfactory.blocks['BLOCK2']['META1']['PROC1']) self.assertTrue(pfactory.blocks['BLOCK2']['META1']['PROC2']) blocks = copy.deepcopy(pfactory.blocks) blocks['BLOCK2']['META1']['PROC2'] = False pfactory2 = PostProcessFactory(b, blocks) pfactory2.run() self.assertTrue(pfactory2.blocks['BLOCK2']['META1']['PROC2'])
def test_postprocesses_exec_again(self): """ Execute once, set a status to false, check that False processes are executed """ b = Bank("localprocess") pfactory = PostProcessFactory(b) pfactory.run() self.assertTrue(pfactory.blocks["BLOCK1"]["META0"]["PROC0"]) self.assertTrue(pfactory.blocks["BLOCK2"]["META1"]["PROC1"]) self.assertTrue(pfactory.blocks["BLOCK2"]["META1"]["PROC2"]) blocks = copy.deepcopy(pfactory.blocks) blocks["BLOCK2"]["META1"]["PROC2"] = False pfactory2 = PostProcessFactory(b, blocks) pfactory2.run() self.assertTrue(pfactory2.blocks["BLOCK2"]["META1"]["PROC2"])
def test_postprocesses_setup(self): b = Bank('localprocess') pfactory = PostProcessFactory(b) pfactory.run(True) self.assertTrue(len(pfactory.threads_tasks[0]) == 2) self.assertTrue(len(pfactory.threads_tasks[1]) == 1)
def test_postprocesses_setup(self): b = Bank('localprocess') pfactory = PostProcessFactory(b) pfactory.run(True) self.assertTrue(len(pfactory.threads_tasks[0])==2) self.assertTrue(len(pfactory.threads_tasks[1])==1)