-
Notifications
You must be signed in to change notification settings - Fork 104
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
Show restart button when all realisations fail #4113
Conversation
self._initial_realizations_mask, self._completed_realizations_mask | ||
) | ||
] | ||
if len(self._completed_realizations_mask) == 0: |
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.
Can we change this to if self._completed_realizations_mask is None
instead, and then have this attribute None
from object initialization and also set to None
instead of []
in the case of an ErtRunError
(which I speculate is happening here?)
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.
If possible (meaning that the ensemble length is always known) we can also change it to always have the correct length (but it is maybe needed to allow None
at init?)
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.
Can we change this to
if self._completed_realizations_mask is None
instead, and then have this attributeNone
from object initialization and also set toNone
instead of[]
in the case of anErtRunError
(which I speculate is happening here?)
We would then also have to change the input argument to BaseRunModel to Optional[List[bool]] = None right?
Not sure we gain that much from using None instead of [] here.
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.
Right. A zero-length ensemble is always an error in Ert (?) so []
is "free" to be used equivalent to None
. It might be cleaner still to use None
as []
could be thought of as ok if one believes zero-length ensembles is a thing.
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.
So, I tried running poly.ert with 0 realisations and when trying to run an ensemble experiment get this crash:
ValueError: Wrong range syntax 0--1
😬
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.
that is ok!
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.
(but pylint frowns upon if len(list) == 0
, do if not list
instead.)
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.
Pylint does not like bare len(list), explicit checks like len(list)==0 are fine according to pep8.
This was considered a bug in pylint:
pylint-dev/pylint#2815
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.
ah, but pep8 still says that if not list
is good in this situation?
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.
I'm fine with either as long as the bug is fixed.
I've pushed a version that uses if list
.
3e6338b
to
eaa5a6b
Compare
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.
💯
Issue
Resolves #4112
Pre review checklist
Adding labels helps the maintainers when writing release notes. This is the list of release note labels.