-
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
Use Experiment server in all run models when feature is enabled #3768
Conversation
You can check this one too: #3637 and close it afterwards. |
656549d
to
f452e3c
Compare
Codecov Report
@@ Coverage Diff @@
## main #3768 +/- ##
==========================================
- Coverage 63.73% 63.73% -0.01%
==========================================
Files 587 587
Lines 43828 43977 +149
Branches 3786 3786
==========================================
+ Hits 27935 28029 +94
- Misses 14770 14826 +56
+ Partials 1123 1122 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
||
# Push ensemble, parameters, observations to new storage | ||
ensemble_id = await loop.run_in_executor( | ||
threadpool, self._post_ensemble_data, update_id |
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.
_post_ensemble_data
calls self.setPhaseName()
which should maybe invoke a call to the experiment server?
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 will happen later when the experiment server supports it.
78a29e8
to
73f18e4
Compare
73f18e4
to
817f6ca
Compare
experiment_logger.debug("evaluating") | ||
await self._evaluate(run_context, evaluator_server_config) | ||
|
||
num_successful_realizations = self._state_machine.successful_realizations( | ||
num_successful_realizations = await self.successful_realizations( |
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.
Agree, makes more sense to use the defined member 👍
prior_context.iteration, | ||
) | ||
|
||
self._checkMinimumActiveRealizations(prior_context) |
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.
Use loop.run_in_executor
? Not sure where should be a threshold for saying this function is "atomic" does not need to be async.
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.
Tracing through the code, this seems to only involve trivial getters and an integer comparison. My gut feeling is then not to
yield through await since there might be some overhead with our switching between sync and async context? (this is partly speculation)
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.
You are right there actually! For reference: https://stackoverflow.com/questions/54813458/asyncio-performance-with-synchronous-code
|
||
experiment_logger.debug("update complete") | ||
|
||
await self.dispatch( |
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.
We might consider creating a helper class for dispatch
, which automatically injects the correct source string based on ids specified and creates an uuid
.
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.
Good idea, implemented. Unsure of the name I chose, "_dispatch_ee"
"id": str(uuid.uuid1()), | ||
}, | ||
{ | ||
"error": str(e), |
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.
Wondering where this error
field is actually used? This is essentially data
argument in CloudEvent, but it's not really processed ...., or maybe I've missed it where; hence the question :)
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.
Not sure, but I guess it does make sense to pass the error information on. The same data argument is used for hook names as far as I can see, maybe not picked up (yet!) either(?)
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 see. I wonder mainly whether this kind of general "data" field should be present for Protobuf objects (which of-course it can't, but we can supplement some error
fields at least) ...
Anyway, for this I understand you would like to keep regardless it's being consumed or not?
bc1c370
to
c096236
Compare
c096236
to
8e83349
Compare
todo: Write test function for |
Considering |
Thanks for picking up on the continuation of #3438. With this implementation though we are adding a fair bit of duplicated code for the
Could we not use the samme pattern that we already implement for There we have both I would really like us to avoid duplicating the |
8e83349
to
55190c8
Compare
5daa7d2
to
ca511b1
Compare
The async versions are modified duplicates of the existing sync run functions, and use the Experiment server feature. Co-authored-by: Håvard Berland <havb@equinor.com>
ca511b1
to
afe7d88
Compare
As discussed on our standup, we will do the "merging" process on one by one basis. The corresponding issue for the task is here: #3948. |
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.
Nice and LGTM! I linked to the corresponding issue to this PR.
Issue
Resolves #3413
Approach
runSimulations()
in each run model has been ported to an async function alongside that uses the experiment server.Pre review checklist
Adding labels helps the maintainers when writing release notes. This is the list of release note labels.