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

Add post/pre experiment simulation hooks #8993

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

yngve-sk
Copy link
Contributor

Issue
Resolves #7644

Copy link
Collaborator

@oyvindeide oyvindeide left a comment

Choose a reason for hiding this comment

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

Looks good, but think we need to adjust the timing a bit. Also it seems to be missing for some experiment types. Though we should not run the PRE_EXPERIMENT hooks for restart runs and evaluate_experiment´ and none of them for manual_update. Also need to add documentation for when these are run, and for which run model. There is another test: test_model_hook_order` which should proably assert this.

Comment on lines 84 to 85
self.set_env_key("_ERT_ITERATION", "0")
self.set_env_key("_IS_FINAL_ITERATION", "False")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not related to hooks, so suggest removing these.


run_args = create_run_arguments(
self.run_paths,
np.array(self.active_realizations, dtype=bool),
ensemble=self.ensemble,
)

self.run_workflows(HookRuntime.PRE_EXPERIMENT, self._storage, self.ensemble)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggest moving this to before we create anything, so basically right after:

self.log_at_startup()

self._evaluate_and_postprocess(
run_args,
self.ensemble,
evaluator_server_config,
)
self.run_workflows(HookRuntime.POST_EXPERIMENT, self._storage, self.ensemble)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should not give storage and ensemble here (they are optional further down in the callstack, so just need to modify the typing)

@yngve-sk yngve-sk marked this pull request as ready for review November 25, 2024 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create new workflow hooks, PRE and POST experiment
2 participants