def parse(self, retrieved_temporary_folder=None): """Parse a retrieved job calculation. This is called once it's finished waiting for the calculation to be finished and the data has been retrieved. """ import shutil from aiida.engine.daemon import execmanager try: exit_code = execmanager.parse_results(self, retrieved_temporary_folder) finally: # Delete the temporary folder try: shutil.rmtree(retrieved_temporary_folder) except OSError as exception: if exception.errno != 2: raise # Finally link up the outputs and we're done for entry in self.node.get_outgoing(): self.out(entry.link_label, entry.node) return exit_code
nlcgcalc = CalculationFactory('sirius.py.nlcg') calc = nlcgcalc(inputs) with SandboxFolder() as sandbox_folder: calc_info, script_filename = calc.presubmit(sandbox_folder) calc_info.uuid = calc.node.uuid # calc_info = calc.prepare_for_submission(folder=None) from aiida.engine.daemon import execmanager with computer.get_transport() as transport: calc_info, script_filename = execmanager.upload_calculation( calc.node, transport, calc_info, script_filename=script_filename) # dummy submit job_id = -1 calc.node.set_job_id(job_id) # copy stdout to workdir instead of running the actual calculation remote_workdir = calc.node.attributes['remote_workdir'] copyfile('sirius.py.nlcg.out', os.path.join(remote_workdir, 'sirius.py.nlcg.out')) calc.node.set_state(CalcJobState.RETRIEVING) execmanager.retrieve_calculation(calc.node, transport, retrieved_temporary_folder=None) calc.node.set_state(CalcJobState.PARSING) execmanager.parse_results(calc) for out in calc.outputs: calc.outputs[out].store() calc.kill()