Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Fix bytes and str issue #33

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 3 additions & 36 deletions autosubmitconfigparser/config/configcommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1930,7 +1910,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))
Expand All @@ -1939,7 +1919,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))
Expand All @@ -1956,7 +1936,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):
Expand Down Expand Up @@ -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
Expand Down