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.
In progress.
Currently blocked by equinor/fmu-sumo#224.Waiting on input on equinor/fmu-sumo#228.Suggested pattern: Using a "factory method" (
@classmethod
) to initialize classes, and a parent-child-class-relationship which enables us to remove duplicated__init__
andfrom_case_uuid
methods on access classes.Other approaches tried:
__aenter__
and async context managers (sinceasync
code can not run in__init__
), however this is more complex and would require multiple levels of idendation in cases different data type access classes are required in an endpoint.@staticmethod
. There is almost no difference to this approach compared with@classmethod
. The benefit with the latter is that it is trivial, and the common Python pattern, to make factory methods on parent classes which can be used from child classes. With parent-child class relationship we can completely remove__init__
and the factory method on the child classes.CaseInspector
andIterationInspector
, in addition to the different access classes.CaseInspector
,IterationInspector
and an access class. This results in three different async calls to sumo to verity three times the case uuid is unique. To easily avoid this,IterationInspector
is renamed toSumoEnsemble
(which is also the mentioned parent class for the other access classes). TheCaseInspector
is renamed toSumoCase
and made the parent class toSumoEnsemble
again, but this inheritence level is not as important I think so could be removed if we prefer.Closes #240.