diff --git a/autosubmit/database/db_jobdata.py b/autosubmit/database/db_jobdata.py index 3e5df112b33a7012416963490f828a66aa37fee4..5faf9e624fb9c608a39448472b1dd03047929c52 100644 --- a/autosubmit/database/db_jobdata.py +++ b/autosubmit/database/db_jobdata.py @@ -1218,9 +1218,8 @@ class JobDataStructure(MainDataBase): "Parent Id List couldn't be parsed to array of int. Using default values.") extra_data["parents"] = parent_id_list pass - current_timestamp = int(time.time()) - job_data_last.finish = current_timestamp if no_slurm == True else ( - job_data_last.finish if job_data_last.finish > 0 else current_timestamp) + current_timestamp = finish if finish > 0 else int(time.time()) + job_data_last.finish = current_timestamp # Take finish from input # job_data_last.finish = finish_time if finish_time > 0 and finish_time >= job_data_last.start else ( # current_timestamp if no_slurm == True else job_data_last.finish) #print("Job data finish time {0}".format(job_data_last.finish)) @@ -1267,49 +1266,6 @@ class JobDataStructure(MainDataBase): Log.warning("Autosubmit couldn't write finish time.") return None - # def retry_incompleted_data(self, list_jobs): - # """ - # DEPRECATED - # Retries retrieval of data that might be incompleted. - - # :param list_jobs: list of jobs in experiment - # :type list_jobs: list() - - # :return: None (Modifies database) - # """ - # try: - # pending_jobs = self.get_pending_data() - # if pending_jobs: - # for item in pending_jobs: - # job_object = section = next( - # (job for job in list_jobs if job.name == item), None) - # if (job_object): - # platform_object = job_object.platform - # if type(platform_object) is not str: - # if platform_object.type == "slurm": - # # print("Checking Slurm for " + str(job_name)) - # Log.info("Attempting to complete information for {0}".format( - # job_object.name)) - # submit_time, start_time, finish_time, energy, extra_data = platform_object.check_job_energy( - # job_object.id, job_object.packed) - # if submit_time > 0 and start_time > 0: - # job_data_last = self.get_job_data_last( - # job_object.name)[0] - # job_data_last.submit = int(submit_time) - # job_data_last.start = int(start_time) - # job_data_last.energy = energy - # job_data_last.extra_data = dumps( - # extra_data) - # job_data_last.modified = datetime.today().strftime('%Y-%m-%d-%H:%M:%S') - # rowid = self._update_finish_job_data_plus( - # job_data_last) - # Log.info("Historic data successfully retrieved and updated for: {0} {1}".format( - # job_object.name, rowid)) - # except Exception as exp: - # print(traceback.format_exc()) - # Log.warning(str(exp)) - # return None - def process_current_run_collection(self): """ Post-process source output for job_data. diff --git a/autosubmit/job/job.py b/autosubmit/job/job.py index 8e51ac58bd5e81220db6a78ab43751ad9ce9625c..d851823d9102cd47709747211b9393705fa6d06d 100644 --- a/autosubmit/job/job.py +++ b/autosubmit/job/job.py @@ -548,7 +548,8 @@ class Job(object): if copy_remote_logs: # unifying names for log files if remote_logs != local_logs: - self.synchronize_logs(self._platform, remote_logs, local_logs) + self.synchronize_logs( + self._platform, remote_logs, local_logs) remote_logs = copy.deepcopy(local_logs) self._platform.get_logs_files(self.expid, remote_logs) # Update the logs with Autosubmit Job Id Brand @@ -572,9 +573,11 @@ class Job(object): @threaded def retrieve_logfiles(self, copy_remote_logs, local_logs, remote_logs, expid, platform_name): try: - as_conf = AutosubmitConfig(expid, BasicConfig, ConfigParserFactory()) + as_conf = AutosubmitConfig( + expid, BasicConfig, ConfigParserFactory()) as_conf.reload() - remote_logs = (self.script_name + ".out", self.script_name + ".err") + remote_logs = (self.script_name + ".out", + self.script_name + ".err") submitter = self._get_submitter(as_conf) submitter.load_platforms(as_conf) platform = submitter.platforms[platform_name.lower()] @@ -730,12 +733,14 @@ class Job(object): platform_name = copy.deepcopy(self.platform_name.lower()) local_logs = copy.deepcopy(self.local_logs) remote_logs = copy.deepcopy(self.remote_logs) - as_conf = AutosubmitConfig(expid, BasicConfig, ConfigParserFactory()) + as_conf = AutosubmitConfig( + expid, BasicConfig, ConfigParserFactory()) as_conf.reload() if as_conf.get_disable_recovery_threads(self.platform.name) == "true": self.retrieve_logfiles_unthreaded(copy_remote_logs, local_logs) else: - self.retrieve_logfiles(copy_remote_logs, local_logs, remote_logs, expid, platform_name) + self.retrieve_logfiles( + copy_remote_logs, local_logs, remote_logs, expid, platform_name) return self.status @@ -748,10 +753,10 @@ class Job(object): :rtype: Submitter """ #communications_library = as_conf.get_communications_library() - #if communications_library == 'paramiko': + # if communications_library == 'paramiko': return ParamikoSubmitter() # communications library not known - #raise AutosubmitCritical( + # raise AutosubmitCritical( # 'You have defined a not valid communications library on the configuration file', 7014) def update_children_status(self): @@ -934,7 +939,7 @@ class Job(object): :rtype: str """ parameters = self.parameters - try: # issue in tests with project_type variable while using threads + try: # issue in tests with project_type variable while using threads if as_conf.get_project_type().lower() != "none": template_file = open(os.path.join( as_conf.get_project_dir(), self.file), 'r') @@ -974,9 +979,9 @@ class Job(object): def _get_template_content(self, as_conf, snippet, template): #communications_library = as_conf.get_communications_library() - #if communications_library == 'paramiko': + # if communications_library == 'paramiko': return self._get_paramiko_template(snippet, template) - #else: + # else: # raise AutosubmitCritical( # "Job {0} does not have an correct template// template not found".format(self.name), 7014)