diff --git a/autosubmit/autosubmit.py b/autosubmit/autosubmit.py index 34106dc75cce51418c690d9e81168ca032a04638..520b45f9abb8e55394121b8537f499d347b49317 100644 --- a/autosubmit/autosubmit.py +++ b/autosubmit/autosubmit.py @@ -1193,6 +1193,23 @@ class Autosubmit: _add_comments_to_yaml(yaml_data, parameter_comments) yaml.dump(yaml_data, output) + @staticmethod + def replace_parameter_inside_section(content, parameter, new_value, section): + # same but for any section any parameter, not only EXPID case insensitive + # Find the any section + if section: + section_match = re.search(rf'({section}:[\s\S]*?{parameter}:.*?)(?=\n|$)', content, re.IGNORECASE) + if section_match: + section = section_match.group(1) + # Replace parameter in the section + new_section = re.sub(rf'({parameter}:).*', rf'\1 "{new_value}"', section) + # Replace the old section + content = content.replace(section, new_section) + else: + # replace only the parameter + content = re.sub(rf'({parameter}:).*', rf'\1 "{new_value}"', content) + return content + @staticmethod def as_conf_default_values(exp_id,hpc="local",minimal_configuration=False,git_repo="",git_branch="main",git_as_conf=""): """ @@ -1220,9 +1237,7 @@ class Autosubmit: search = re.search('TO: .*', content, re.MULTILINE) if search is not None: content = content.replace(search.group(0), "TO: \"\"") - search = re.search('EXPID: .*', content, re.MULTILINE) - if search is not None: - content = content.replace(search.group(0),"EXPID: \""+exp_id+"\"") + content = Autosubmit.replace_parameter_inside_section(content, "EXPID", exp_id, "DEFAULT") search = re.search('HPCARCH: .*', content, re.MULTILINE) if search is not None: content = content.replace(search.group(0),"HPCARCH: \""+hpc+"\"") @@ -1239,9 +1254,6 @@ class Autosubmit: search = re.search('PROJECT_BRANCH: .*', content, re.MULTILINE) if search is not None: content = content.replace(search.group(0), "PROJECT_BRANCH: \""+git_branch+"\"") - - - with open(os.path.join(BasicConfig.LOCAL_ROOT_DIR, exp_id,"conf", as_conf_file), 'w') as f: f.write(content) diff --git a/autosubmit/job/job_list_persistence.py b/autosubmit/job/job_list_persistence.py index 791de78640f924bad9ccc8cebcc83682e21aa27b..48c638db22d4e2d33fdf875f89c966af318bb466 100644 --- a/autosubmit/job/job_list_persistence.py +++ b/autosubmit/job/job_list_persistence.py @@ -124,10 +124,22 @@ class JobListPersistenceDb(JobListPersistence): VERSION = 3 JOB_LIST_TABLE = 'job_list' - TABLE_FIELDS = ['name', 'id', 'status', 'priority', - 'section', 'date', 'member', 'chunk', - 'local_out', 'local_err', - 'remote_out', 'remote_err'] + TABLE_FIELDS = [ + "name", + "id", + "status", + "priority", + "section", + "date", + "member", + "chunk", + "split", + "local_out", + "local_err", + "remote_out", + "remote_err", + "wrapper_type", + ] def __init__(self, persistence_path, persistence_file): self.db_manager = DbManager(persistence_path, persistence_file, self.VERSION)