-
Notifications
You must be signed in to change notification settings - Fork 20
DOC : Update HOOK_WORKFLOW_JOB documentation #1877
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
Open
nourinmohd
wants to merge
1
commit into
equinor:main
Choose a base branch
from
nourinmohd:1816_update_hook_doc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -90,51 +90,18 @@ read by individual export jobs, and, if you opt to upload data into Sumo, the | |||||||||||
| case metadata are used to register the case. Case metadata are made by a | ||||||||||||
| hooked (pre-sim) Ert workflow running `PRE_SIMULATION`. | ||||||||||||
|
|
||||||||||||
| To make this, first create the workflow file in | ||||||||||||
| `ert/bin/workflows/xhook_create_case_metadata`. | ||||||||||||
|
|
||||||||||||
| ```{note} | ||||||||||||
| The "xhook" prefix is convention, but not mandatory. As all workflows will be | ||||||||||||
| included in the Ert GUI dropdown, the "hook" prefix signals that the workflow | ||||||||||||
| is not intended to be run manually. Further, the "x" makes it go to the bottom | ||||||||||||
| of the (alphabetically) sorted dropdown. If you have many workflows, this | ||||||||||||
| makes things a little bit more tidy. | ||||||||||||
| ``` | ||||||||||||
|
|
||||||||||||
| The workflow calls a pre-installed workflow job: `WF_CREATE_CASE_METADATA`. | ||||||||||||
| Example script from the Drogon workflow: | ||||||||||||
|
|
||||||||||||
| ```sql | ||||||||||||
| -- Create case metadata | ||||||||||||
| -- ert-casepath sumo-flag | ||||||||||||
| WF_CREATE_CASE_METADATA <SUMO_CASEPATH> "--sumo" | ||||||||||||
|
|
||||||||||||
| -- This workflow is intended to run as a HOOK workflow. | ||||||||||||
|
|
||||||||||||
| -- Arguments: | ||||||||||||
| -- casepath (Path): Absolute path to root of the case, typically <SCRATCH>/<USER>/<CASE_DIR> | ||||||||||||
|
|
||||||||||||
| -- Optional arguments: | ||||||||||||
| -- --sumo (str): If passed, case will be registered on Sumo. | ||||||||||||
| -- --verbosity (str): Set log level | ||||||||||||
|
|
||||||||||||
| -- NOTE! If using optional arguments, note that the "--" annotation will be interpreted | ||||||||||||
| -- as comments by ERT if not wrapped in quotes. This is the syntax to use: | ||||||||||||
| -- (existing arguments) "--sumo" | ||||||||||||
| ``` | ||||||||||||
|
|
||||||||||||
| Now, load this workflow in your ERT config file and make it a HOOK workflow: | ||||||||||||
| Add the pre-installed workflow job `WF_CREATE_CASE_METADATA` as a | ||||||||||||
| [`HOOK_WORKFLOW_JOB`](https://fmu-docs.equinor.com/docs/ert/reference/configuration/keywords.html#hook-workflow-job) | ||||||||||||
| in your ERT config file: | ||||||||||||
|
|
||||||||||||
| ```sql | ||||||||||||
| -- Hook workflow for creating case metadata and (optional) registering case on Sumo | ||||||||||||
| LOAD_WORKFLOW ../../bin/workflows/xhook_create_case_metadata | ||||||||||||
| HOOK_WORKFLOW xhook_create_case_metadata PRE_SIMULATION | ||||||||||||
| HOOK_WORKFLOW_JOB xhook_create_case_metadata WF_CREATE_CASE_METADATA "--sumo" PRE_SIMULATION | ||||||||||||
| ``` | ||||||||||||
|
|
||||||||||||
| ```{note} | ||||||||||||
| In the Drogon example, you will notice that the loading is done in the | ||||||||||||
| `install_custom_jobs.ert` include file, while the HOOK_WORKFLOW call is in | ||||||||||||
| the main config file. | ||||||||||||
| The `"--sumo"` argument is optional. When it is included, `<SUMO_CASEPATH>` | ||||||||||||
| must be defined in the ERT config. | ||||||||||||
|
Comment on lines
+103
to
+104
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggest adding a typical example of how to define the casepath. Also lets make it more clear that we want people to use Sumo 🙂
Suggested change
|
||||||||||||
| ``` | ||||||||||||
|
|
||||||||||||
| You can now start ERT to verify that the workflow is loading and working. You | ||||||||||||
|
|
||||||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the look of all this red 🔴