Skip to content

Commit

Permalink
Fix an issue with arglist with simulation job
Browse files Browse the repository at this point in the history
In 9809fef the call to
ext_job_free_deprecated_argv was erronously omitted while
reimplementing the creation of ext_job from the SIMULATION_JOB
keyword in python. This lead to simulation job not working
correctly when the job has an ARGLIST.
  • Loading branch information
eivindjahren committed Nov 11, 2022
1 parent 17dee53 commit 5bb7b6c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/clib/lib/include/ert/job_queue/ext_job.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ extern "C" const char *ext_job_get_help_text(const ext_job_type *job);
void ext_job_set_help_text(ext_job_type *job, const char *help_text);

ext_job_type *ext_job_alloc_copy(const ext_job_type *);
void ext_job_free_deprecated_argv(ext_job_type *ext_job); //DEPRECATED
extern "C" void
ext_job_free_deprecated_argv(ext_job_type *ext_job); //DEPRECATED
ext_job_type *ext_job_alloc(const char *, const char *license_root_path,
bool private_job);
extern "C" const char *ext_job_get_name(const ext_job_type *);
Expand Down
1 change: 1 addition & 0 deletions src/ert/_c_wrappers/enkf/res_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ def _alloc_from_content(self, user_config_file=None, config=None):
job = self.site_config.job_list.get_job_copy(job_description[0])
job.set_arglist(job_description[1:])
job.set_define_args(self.substitution_list)
job.clear_deprecated_argv()
job.convertToCReference(None)
jobs.append(job)

Expand Down
4 changes: 4 additions & 0 deletions src/ert/_c_wrappers/job_queue/ext_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class ExtJob(BaseCClass):
_set_define_args = ResPrototype(
"subst_list_ref ext_job_set_define_args(ext_job, subst_list)"
)
_free_deprecated_argv = ResPrototype("void ext_job_free_deprecated_argv(ext_job)")

def __init__(
self,
Expand Down Expand Up @@ -102,6 +103,9 @@ def __repr__(self):
else:
return "UNINITIALIZED ExtJob"

def clear_deprecated_argv(self):
self._free_deprecated_argv()

def set_define_args(self, subst_list: SubstitutionList) -> None:
self._set_define_args(subst_list)

Expand Down
15 changes: 15 additions & 0 deletions tests/unit_tests/c_wrappers/res/enkf/test_enkf_sim_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,21 @@ def test_forward_model_job(job, forward_model, expected_args):
["word", "<ECLBASE>"],
id="Some args",
),
pytest.param(
dedent(
"""
EXECUTABLE echo
MIN_ARG 1
MAX_ARG 2
ARG_TYPE 0 STRING
ARG_TYPE 0 STRING
ARGLIST <ARGUMENTA> <ARGUMENTB>
"""
),
"SIMULATION_JOB job_name arga argb",
["arga", "argb"],
id="simulation job with arglist",
),
],
)
def test_simulation_job(job, forward_model, expected_args):
Expand Down

0 comments on commit 5bb7b6c

Please sign in to comment.