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

Not possible to run sim2sumo directly as CLI due to fmu-dataio dependencies on environment variables #41

Open
perolavsvendsen opened this issue Feb 28, 2024 · 1 comment

Comments

@perolavsvendsen
Copy link
Member

perolavsvendsen commented Feb 28, 2024

Ref discussion started in #40

From version 2.1.0, fmu-dataio will read environment variables set by ERT rather than parse the file path to get necessary and required information about the FMU context.

When e.g. sim2sumo is being ran as a CLI directly in the /scratch/ structure, fmu-dataio will no longer detect that we are running in an FMU environment. Hence it will produce incomplete (and invalid) metadata.

This means: sim2sumo can no longer be used as a direct CLI.

Confirmation and recreation:

In an existing FMU case on /scratch;

(mypath is equivalent to: /scratch/asset/user/case/realization-0/iter-0/)
mypath $ sim2sumo execute --config_path fmuconfig/output/global_variables.yml

> Sumo uploader: 1 OK, 3 failed, 4 total

On inspection, the entire fmu block is missing from the metadata. This is expected behavior when fmu-dataio fails to detect that we are in an FMU run.

https://github.com/equinor/fmu-dataio/blob/a24774ba4f76868cd1e21de2f444b091cacf8c84/src/fmu/dataio/_fmu_provider.py#L115

When explicitly setting the following environment variables:

_ERT_ENSEMBLE_ID="ert_ens_id"
_ERT_EXPERIMENT_ID="ert_exp_id"
_ERT_ITERATION_NUMBER="0"
_ERT_REALIZATION_NUMBER="0"
_ERT_RUNPATH="/scratch/sumo/rowh/oldDrogon_komodoBleeding/realization-0/iter-0"

...result is 4 files OK.


Unclear if this should be fixed, i.e. is it a requirement for sim2sumo to run as a CLI (other than for development purposes)? We generally do not want users to (manually) upload data to Sumo, as a separate process from actually running FMU.

For development purposes, it may be necessary to run sim2sumo outside the ERT context.

Some options include:

  • Emulating the ERT context by explicitly setting these environment variables directly in sim2sumo and invoke this behavior with an argument
  • Request that ERT dumps these environment variables to file on RUNPATH, and use that instead in fmu-dataio (or use it as fallback)
@perolavsvendsen
Copy link
Member Author

Ref discussions in #42, one alternative way could be to provide a (separate) script in sim2sumo that sets up the environment. If running sim2sumo directly as a CLI, this would have to be invoked up front.

E.g.

$ sim2sumo_dev --emulate_ert
$ sim2sumo execute --etc --etc

(Syntax may be different)

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

No branches or pull requests

1 participant