-
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
Type and style for ensemble evaluator builder code #3219
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3219 +/- ##
==========================================
- Coverage 65.60% 65.58% -0.02%
==========================================
Files 614 619 +5
Lines 48982 49059 +77
Branches 4407 4407
==========================================
+ Hits 32135 32177 +42
- Misses 15374 15412 +38
+ Partials 1473 1470 -3
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
1250d3e
to
9aa2652
Compare
9aa2652
to
e15f890
Compare
Move the ensemble evaluator builder code, along with some utility code, to ert/ and add type hinting and style fixes. Type hinting and style fixes have also been extended to code now under audit by virtue of the move to ert/. Some refactors, not strictly necessary, have been made to ease typing.
e15f890
to
8e59f9e
Compare
from .builder._ensemble import _Ensemble | ||
from .builder._ensemble_builder import _EnsembleBuilder | ||
from .builder._io_ import _IO, _InputBuilder, _OutputBuilder | ||
from .builder._job import _JobBuilder, _LegacyJobBuilder | ||
from .builder._realization import _RealizationBuilder | ||
from .builder._step import _StepBuilder |
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.
Find arguments for why this is done like so
from ._realization import _Realization | ||
|
||
if TYPE_CHECKING: | ||
import ert |
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.
unused?
@@ -89,7 +97,10 @@ def _evaluate(self): | |||
# Get a fresh eventloop | |||
asyncio.set_event_loop(asyncio.new_event_loop()) | |||
|
|||
async def _evaluate_inner(): | |||
if self._config is None: | |||
raise RuntimeError("no config") |
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.
ValueError
for real in self.active_reals: | ||
self._job_queue.add_ee_stage( # type: ignore | ||
real.steps[0], callback_timeout=on_timeout | ||
) | ||
self._job_queue.submit_complete() | ||
self._job_queue.submit_complete() # type: ignore |
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.
Opted out of typing these.
|
||
finally: | ||
await timeout_queue.put(None) # signal to exit timer | ||
await send_timeout_future | ||
|
||
# Dispatch final result from evaluator - FAILED, CANCEL or STOPPED | ||
assert self._config # mypy |
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.
Question @sondreso : ValueError or assertion 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.
I think this is a ValueError
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.
Other than the minor comments above I think this looks good!
Very nice work! 👏
Ahh, I did not see the auto merge 😬 |
My bad. Will do a follow up |
Issue
Resolves #3188
Approach
Move the ensemble evaluator builder code, along with some utility code, to ert/ and add type hinting and style fixes. Type hinting and style fixes have also been extended to code now under audit by virtue of the move to ert/. Some refactors, not strictly necessary, have been made to ease typing.
A programming error was made that allowed unix jobs to overwrite output from other unix jobs, causing hard-to-debug test failures. A constraint on file transformations were introduced such that they cannot overwrite files from transforming from a record (to file).
For unknown reasons, I've made a flaky test more flaky. A piece of duct tape was applied. Proper fix will be Stop pickling RecordTransmitters and serialize its configuration instead #3013 and running prefect without multiprocessing.
Pre review checklist
Adding labels helps the maintainers when writing release notes. This is the list of release note labels.