def set_workdir(self, workdir, chroot=False): """ Set the working directory. Cannot be set more than once unless chroot is True """ if not chroot and hasattr(self, "workdir") and self.workdir != workdir: raise ValueError("self.workdir != workdir: %s, %s" % (self.workdir, workdir)) # Directories with (input|output|temporary) data. self.workdir = os.path.abspath(workdir) self.indir = Directory(os.path.join(self.workdir, "indata")) self.outdir = Directory(os.path.join(self.workdir, "outdata")) self.tmpdir = Directory(os.path.join(self.workdir, "tmpdata"))
def set_workdir(self, workdir): """Set the working directory.""" self.workdir = os.path.abspath(workdir) # Files required for the execution. self.input_file = File(os.path.join(self.workdir, "run.abi")) self.output_file = File(os.path.join(self.workdir, "run.abo")) self.files_file = File(os.path.join(self.workdir, "run.files")) self.log_file = File(os.path.join(self.workdir, "run.log")) self.stderr_file = File(os.path.join(self.workdir, "run.err")) # Directories with input|output|temporary data. self.indir = Directory(os.path.join(self.workdir, "indata")) self.outdir = Directory(os.path.join(self.workdir, "outdata")) self.tmpdir = Directory(os.path.join(self.workdir, "tmpdata"))
def __init__(self, workdir, manager, auto_restart=False, pickle_protocol=-1): """ Args: workdir: String specifying the directory where the workflows will be produced. manager: `TaskManager` object responsible for the submission of the jobs. auto_restart: True if unconverged calculations should be restarted automatically. pickle_procol: Pickle protocol version used for saving the status of the object. -1 denotes the latest version supported by the python interpreter. """ super(AbinitFlow, self).__init__() self.workdir = os.path.abspath(workdir) self.creation_date = time.asctime() self.manager = manager.deepcopy() self.auto_restart = auto_restart # List of workflows. self._works = [] # List of callbacks that must be executed when the dependencies reach S_OK self._callbacks = [] # Directories with (input|output|temporary) data. self.indir = Directory(os.path.join(self.workdir, "indata")) self.outdir = Directory(os.path.join(self.workdir, "outdata")) self.tmpdir = Directory(os.path.join(self.workdir, "tmpdata")) self.pickle_protocol = int(pickle_protocol)