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

Remove hook manager #4012

Merged
merged 1 commit into from
Oct 7, 2022
Merged

Conversation

eivindjahren
Copy link
Contributor

@eivindjahren eivindjahren commented Oct 6, 2022

Issue
Resolves one of the items of #3986

Approach

The only part of hook manager that is used it the hook_workflow_list. This is really a map from workflow (time at which the workflow should run) to run_mode, telling ert when to run the workflow. Its probably a good idea to keep this information together with the workflows, ie. in ert_workflow_list (which is next on the list for simplification, and now that hook manager is gone, ert_workflow_list can be reimplemented in python).

Pre review checklist

  • Added appropriate release note label
  • PR title captures the intent of the changes, and is fitting for release notes.
  • Commit history is consistent and clean, in line with the contribution guidelines.

Adding labels helps the maintainers when writing release notes. This is the list of release note labels.

@eivindjahren eivindjahren force-pushed the remove_hook_manager branch 8 times, most recently from c020476 to 501b2ea Compare October 6, 2022 13:25
@eivindjahren eivindjahren marked this pull request as ready for review October 6, 2022 13:51
@eivindjahren eivindjahren self-assigned this Oct 6, 2022
Copy link
Contributor

@valentin-krasontovitsch valentin-krasontovitsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nicely done, not much to comment, besides the little things with the test assertion and the freeing : )

@@ -50,6 +53,7 @@ ert_workflow_list_alloc_empty(const subst_list_type *context) {
workflow_list->joblist = workflow_joblist_alloc();
workflow_list->context = context;
workflow_list->last_error = NULL;
workflow_list->hook_workflow_list = vector_alloc_new();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're planning to reimplement this in python when simplifying the workflow list, so i understand if this is not a priority. just wanted to mention that freeing the hook_workflow_list might be reasonable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

continue

workflow = hook_workflow.getWorkflow()
for workflow in workflow_list.get_workflows_hooked_at(runtime):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice and elegant. i like

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :)

@@ -648,4 +647,6 @@ def test_that_workflow_run_modes_can_be_selected(tmp_path, run_mode):
f"HOOK_WORKFLOW SCRIPT {run_mode}\n"
)
res_config = ResConfig(str(test_user_config))
assert res_config.hook_manager[0].getRunMode() == run_mode
assert (
len(list(res_config.ert_workflow_list.get_workflows_hooked_at(run_mode))) == 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

much nicer!

@@ -71,7 +71,6 @@ def test_site_config_hook_workflow(monkeypatch, tmp_path):
monkeypatch.setenv("ERT_SITE_CONFIG", site_config_filename)

res_config = ResConfig(user_config_file=test_config_filename)
assert len(res_config.hook_manager) == 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you didn't replace this assertion with something equivalent, as far as i can see - you deemed it unnecessary to remain in the test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added back a similar assertion just in case :)

@eivindjahren eivindjahren merged commit c5ce8a3 into equinor:main Oct 7, 2022
@eivindjahren eivindjahren deleted the remove_hook_manager branch October 7, 2022 07:06
@oysteoh oysteoh mentioned this pull request Oct 7, 2022
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants