def setUpClass(cls): cls.jobstatus = JobStatus() cls.database = DatabaseAccess('sqlite:///test_job_status.db', 'simulation') par_dict = {'chemicalformula': 'H', 'computer': 'localhost', 'hamilton': 'Test', 'hamversion': '0.1', 'job': 'testing', 'parentid': 0, 'project': 'database.testing', 'projectpath': '/TESTING', 'status': 'initialized', 'timestart': datetime(2016, 5, 2, 11, 31, 4, 253377), 'timestop': datetime(2016, 5, 2, 11, 31, 4, 371165), 'totalcputime': 0.117788, 'username': '******'} cls.job_id = cls.database.add_item_dict(par_dict) cls.jobstatus_database = JobStatus(db=cls.database, job_id=cls.job_id)
def setUpClass(cls): cls.jobstatus = JobStatus() cls.database = DatabaseAccess("sqlite:///test_job_status.db", "simulation") par_dict = { "chemicalformula": "H", "computer": "localhost", "hamilton": "Test", "hamversion": "0.1", "job": "testing", "parentid": 0, "project": "database.testing", "projectpath": "/TESTING", "status": "initialized", "timestart": datetime(2016, 5, 2, 11, 31, 4, 253377), "timestop": datetime(2016, 5, 2, 11, 31, 4, 371165), "totalcputime": 0.117788, "username": "******", } cls.job_id = cls.database.add_item_dict(par_dict) cls.jobstatus_database = JobStatus(db=cls.database, job_id=cls.job_id)
def ref_job(self): """ Get the reference job template from which all jobs within the ParallelMaster are generated. Returns: GenericJob: reference job """ if self._ref_job: return self._ref_job try: ref_job = self[0] if isinstance(ref_job, GenericJob): self._ref_job = ref_job self._ref_job._job_id = None self._ref_job._status = JobStatus(db=self.project.db) return self._ref_job else: return None except IndexError: return None