From 30229e1e2ca6dee763e41c43ac082c498fdb451c Mon Sep 17 00:00:00 2001 From: "Bruno P. Kinoshita" Date: Thu, 6 Jul 2023 14:38:33 +0200 Subject: [PATCH 1/2] Fix bytes and str issue --- autosubmitconfigparser/config/configcommon.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autosubmitconfigparser/config/configcommon.py b/autosubmitconfigparser/config/configcommon.py index 6a123ed..9edec67 100644 --- a/autosubmitconfigparser/config/configcommon.py +++ b/autosubmitconfigparser/config/configcommon.py @@ -1930,7 +1930,7 @@ def set_git_project_commit(self, as_conf): full_project_path = as_conf.get_project_dir() try: output = subprocess.check_output("cd {0}; git rev-parse --abbrev-ref HEAD".format(full_project_path), - shell=True) + shell=True, text=True) except subprocess.CalledProcessError as e: raise AutosubmitCritical( "Failed to retrieve project branch...", 7014, str(e)) @@ -1939,7 +1939,7 @@ def set_git_project_commit(self, as_conf): Log.debug("Project branch is: " + project_branch) try: output = subprocess.check_output( - "cd {0}; git rev-parse HEAD".format(full_project_path), shell=True) + "cd {0}; git rev-parse HEAD".format(full_project_path), shell=True, text=True) except subprocess.CalledProcessError as e: raise AutosubmitCritical( "Failed to retrieve project commit SHA...", 7014, str(e)) @@ -1956,7 +1956,7 @@ def set_git_project_commit(self, as_conf): "PROJECT_COMMIT: " + project_sha) open(self._exp_parser_file, 'wb').write(content) Log.debug( - "Project commit SHA succesfully registered to the configuration file.") + "Project commit SHA successfully registered to the configuration file.") return True def get_svn_project_url(self): From a94e33495e6bb84db6990761828db69adf81e113 Mon Sep 17 00:00:00 2001 From: "Bruno P. Kinoshita" Date: Thu, 10 Oct 2024 14:19:08 +0200 Subject: [PATCH 2/2] Remove functions not used in Autosubmit, nor here --- autosubmitconfigparser/config/configcommon.py | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/autosubmitconfigparser/config/configcommon.py b/autosubmitconfigparser/config/configcommon.py index 9edec67..9cfba28 100644 --- a/autosubmitconfigparser/config/configcommon.py +++ b/autosubmitconfigparser/config/configcommon.py @@ -1766,26 +1766,6 @@ def load_section_parameters(self, job_list, as_conf, submitter): section_param] = job_list_by_section[section][0].parameters[section_param] return parameters - def set_expid(self, exp_id): - """ - Set experiment identifier in autosubmit and experiment config files - - :param exp_id: experiment identifier to store - :type exp_id: str - """ - # Experiment conf - content = open(self._exp_parser_file).read() - if re.search('EXPID:.*', content): - content = content.replace( - re.search('EXPID:.*', content).group(0), "EXPID: " + exp_id) - open(self._exp_parser_file, 'w').write(content) - - content = open(self._conf_parser_file).read() - if re.search('EXPID:.*', content): - content = content.replace( - re.search('EXPID:.*', content).group(0), "EXPID: " + exp_id) - open(self._conf_parser_file, 'w').write(content) - def get_project_type(self): """ Returns project type from experiment config file @@ -2140,19 +2120,6 @@ def get_platform(self): """ return self.experiment_data['DEFAULT']['HPCARCH'].upper() - def set_platform(self, hpc): - """ - Sets main platforms in experiment's config file - - :param hpc: main platforms - :type: str - """ - content = open(self._exp_parser_file).read() - if re.search('HPCARCH:.*', content): - content = content.replace( - re.search('HPCARCH:.*', content).group(0), "HPCARCH: " + hpc) - open(self._exp_parser_file, 'w').write(content) - def set_last_as_command(self, command): """ Set the last autosubmit command used in the experiment's config file