Skip to content

Commit

Permalink
Now kwargs for generic are set correctly after inheriting from base_jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
YHordijk committed Mar 25, 2024
1 parent fe0e905 commit ff28bdd
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/tcutility/job/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,31 @@ class Job:
wait_for_finish: whether to wait for this job to finish running before continuing your runscript.
delete_on_finish: whether to remove the workdir for this job after it is finished running.
'''
def __init__(self, *base_jobs: List['Job'], test_mode: bool = False, overwrite: bool = False, wait_for_finish: bool = False, delete_on_finish: bool = False):
def __init__(self, *base_jobs: List['Job'], test_mode: bool = None, overwrite: bool = None, wait_for_finish: bool = None, delete_on_finish: bool = None):
self._sbatch = results.Result()
self._molecule = None
self._molecule_path = None
self.slurm_job_id = None
self.name = 'calc'
self.rundir = 'tmp'
self._preambles = []
self._postambles = []
self._postscripts = []

self.test_mode = test_mode
self.overwrite = overwrite
self.wait_for_finish = wait_for_finish
self.delete_on_finish = delete_on_finish
self._preambles = []
self._postambles = []
self._postscripts = []

# update this job with base_jobs
for base_job in base_jobs:
self.__dict__.update(base_job.copy().__dict__)

self.test_mode = self.test_mode if test_mode is None else test_mode
self.overwrite = self.overwrite if overwrite is None else overwrite
self.wait_for_finish = self.wait_for_finish if wait_for_finish is None else wait_for_finish
self.delete_on_finish = self.delete_on_finish if delete_on_finish is None else delete_on_finish

def __enter__(self):
return self

Expand Down

0 comments on commit ff28bdd

Please sign in to comment.