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

Account for ert and ert3 discrepancy when uploading parameter data to storage #192

Merged
merged 2 commits into from
Dec 22, 2021

Conversation

DanSava
Copy link
Collaborator

@DanSava DanSava commented Nov 23, 2021

Issue
Resolves: #191

It seems parameters are handled differently for ert3 and ert at the moment:

  • Ert3: uploads a record for each realisation index.
  • Ert: uploads only one global record for each parameter.

Approach

For a given parameter (i.e. coefficients) try to retrieve a global record (assuming the user has run ERT) if this fails for the same parameter try to retrieve a record for a realization index in the list of active realization of the run example.

@DanSava DanSava self-assigned this Nov 23, 2021
@DanSava DanSava force-pushed the fix_ert3_parameter_vis branch from 2bea1ae to 1a22ee8 Compare November 23, 2021 13:19
@markusdregi
Copy link

I did some testing of this PR and I can confirm that the visualiser no longer crashes 👍🏻

First, a comment on the behaviour of the visualiser: coefficients consists of three different variables, namely a, b and c. I believe that earlier I've been able to plot these independently and this no longer seems possible...

Second, a comment on the approach: I'm not entirely convinced that this should be resolved in webviz-ert given the apparent reason for the problem. If ert-storage serves the records differently dependent on whether they where uploaded in one batch or one by one I would perhaps consider that an ert-storage bug?

@DanSava DanSava force-pushed the fix_ert3_parameter_vis branch 5 times, most recently from d37df69 to 37e9f3a Compare December 1, 2021 12:33
return df
except DataLoaderException as e:
logger.error(e)
return self.get_ensemble_record_data(
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary because the above only fetches ensemble wide data, and this call fetches realization by realization?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, that's right

@DanSava DanSava force-pushed the fix_ert3_parameter_vis branch 3 times, most recently from 874ece5 to 19df739 Compare December 15, 2021 10:38
Copy link
Contributor

@frode-aarstad frode-aarstad left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -98,7 +101,18 @@ def parameters(
self,
) -> Optional[Mapping[str, ParametersModel]]:
if not self._parameters:
parameter_names = self._data_loader.get_ensemble_parameters(self._id)
parameter_names = []
# TODO Remove except code path after PR https://github.com/equinor/ert-storage/pull/180 is merged

Choose a reason for hiding this comment

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

I think TODO's are more likely to be picked up in issues, then in the code ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Generally, that is right but the point of this TODO was to remind me that there is still something to be solved and removed before having a final version of the code and merging it.... like a TODO is meant to be right 🤔 ?

Choose a reason for hiding this comment

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

Ah, so this is not ready for merging yet then? :)

Copy link
Collaborator Author

@DanSava DanSava Dec 16, 2021

Choose a reason for hiding this comment

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

It is now that the TODO was dealt with also jenkins should also pass once the new ert-storage release is in bleeding

@markusdregi
Copy link

I'm pressuming this is not the end of this effort? Would be nice to see the issues pointing laying out the remaining work before we merge this :)

@DanSava DanSava force-pushed the fix_ert3_parameter_vis branch 2 times, most recently from 8f7864d to d0194f5 Compare December 16, 2021 14:47
@markusdregi markusdregi marked this pull request as draft December 16, 2021 14:52
@DanSava DanSava force-pushed the fix_ert3_parameter_vis branch from d0194f5 to 00a3826 Compare December 16, 2021 15:20
@DanSava DanSava marked this pull request as ready for review December 16, 2021 15:22
@DanSava
Copy link
Collaborator Author

DanSava commented Dec 16, 2021

I'm pressuming this is not the end of this effort

Not really sure what "this effort" is that you are hinting at.

This PR should enable webviz ert to properly display grouped ert3 parameters and plot them also get responses as ensemble wide records.

@DanSava
Copy link
Collaborator Author

DanSava commented Dec 17, 2021

Jenkins test this please

@@ -113,7 +113,7 @@ class DataLoader:
_instances: MutableMapping[ServerIdentifier, "DataLoader"] = {}

baseurl: str
token: str
token: Optional[str]

Choose a reason for hiding this comment

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

Could you explain why this is optional now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not really sure why pylint was not complaining before about this, it just started, I guess it was updated recently.

The Dataloader __new__ definition looked like this for quite some time

def __new__(cls, baseurl: str, token: Optional[str] = None) -> "DataLoader":

So token is expected to he Optional[str]

Choose a reason for hiding this comment

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

Thanks :)

df = pd.read_parquet(stream)
return df
try:
if "::" in parameter_name:

Choose a reason for hiding this comment

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

This is what I meant by future work. It might be that I'm misunderstanding something, but is this not somewhat of a hack to avoid having to make ERT2 upload parameters as it should?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure we can make ert2 upload parameters like ert3 does it, but I thought the idea was that the underlying Data structure is the same for both ert3 and ert2 it should not matter how they are uploaded, ert2 or ert3 style given that both ways are valid and supported by the storage API.

Copy link

@markusdregi markusdregi left a comment

Choose a reason for hiding this comment

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

I was expecting some tests verifying the current :: logic...?

@markusdregi
Copy link

I did some testing and it seems like the original problems are fixed 👍🏻 I tried running the entire polynomial case with ert3 using run_demo and it crashes when I'm trying to visualise the doe experiment with

raise DataLoaderException(
webviz_ert.data_loader.DataLoaderException: Error fetching data from http://127.0.0.1:51822/ensembles/12d84e2f-7ccc-4e95-bd1a-328c0658b962/records/coefficients/labels
                The request return with status code: 404
                b'{"detail":{"ensemble_id":"12d84e2f-7ccc-4e95-bd1a-328c0658b962","name":"coefficients","error":"Record not found"}}'

I guess we should either fix it here or create a new issue for it. I'm fine with either :)

@DanSava
Copy link
Collaborator Author

DanSava commented Dec 20, 2021

I did some testing and it seems like the original problems are fixed 👍🏻 I tried running the entire polynomial case with ert3 using run_demo and it crashes when I'm trying to visualise the doe experiment with

raise DataLoaderException(
webviz_ert.data_loader.DataLoaderException: Error fetching data from http://127.0.0.1:51822/ensembles/12d84e2f-7ccc-4e95-bd1a-328c0658b962/records/coefficients/labels
                The request return with status code: 404
                b'{"detail":{"ensemble_id":"12d84e2f-7ccc-4e95-bd1a-328c0658b962","name":"coefficients","error":"Record not found"}}'

I guess we should either fix it here or create a new issue for it. I'm fine with either :)

I think a new issue is required, I will create it. I think this never worked (the visualisation) it cannot find the coefficient record because it is not part of the doe ensemble due to it being added to storage as part of the "general" ensemble.

The coefficients are added to storage before the experiment is run with ert3 record load designed_coefficients experiments/doe/coefficients_record.json

@DanSava
Copy link
Collaborator Author

DanSava commented Dec 20, 2021

#203 was added to track the issue reported ⬆️

@DanSava DanSava force-pushed the fix_ert3_parameter_vis branch from 8f23b8e to c5b3723 Compare December 21, 2021 10:48
@DanSava DanSava requested a review from markusdregi December 21, 2021 10:52
Copy link

@markusdregi markusdregi left a comment

Choose a reason for hiding this comment

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

Thanks for the update 👍🏻

@DanSava DanSava merged commit d6c4a41 into equinor:master Dec 22, 2021
@DanSava DanSava deleted the fix_ert3_parameter_vis branch December 22, 2021 13:00
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.

Unable to plot coefficients in ERT3 polynomial example
4 participants