-
Notifications
You must be signed in to change notification settings - Fork 110
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
Create end point for events #9691
base: main
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #9691 will improve performances by 10.62%Comparing Summary
Benchmarks breakdown
|
06dfbd1
to
79c008e
Compare
c396805
to
e734a28
Compare
e734a28
to
c373dd0
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.
Some questions and comments
if message: | ||
event_dict = json.loads(message) | ||
if "snapshot" in event_dict: | ||
event_dict["snapshot"] = EnsembleSnapshot.from_nested_dict( | ||
event_dict["snapshot"] | ||
) | ||
try: | ||
event = EventWrapper(event=event_dict).event |
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 you rewrite this:
if message:
event_dict = json.loads(message)
if "snapshot" in event_dict:
event_dict["snapshot"] = EnsembleSnapshot.from_nested_dict(
event_dict["snapshot"]
)
try:
event = EventWrapper(event=event_dict).event
as
if message:
try:
event = status_event_from_json(message)
will make it a bit more clear and you no longer need EventWrapper
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 get this then 🤔
pydantic_core._pydantic_core.ValidationError: 1 validation error for tagged-union[ForwardModelStepStart,ForwardModelStepRunning,ForwardModelStepSuccess,ForwardModelStepFailure,ForwardModelStepChecksum,RealizationPending,RealizationRunning,RealizationSuccess,RealizationFailed,RealizationTimeout,RealizationUnknown,RealizationWaiting,RealizationResubmit,EESnapshot,EESnapshotUpdate,EETerminated,EEUserCancel,EEUserDone,EnsembleStarted,EnsembleSucceeded,EnsembleFailed,EnsembleCancelled]
Input tag 'FullSnapshotEvent' found using 'event_type' does not match any of the expected tags: 'forward_model_step.start', 'forward_model_step.running', 'forward_model_step.success', 'forward_model_step.failure', 'forward_model_step.checksum', 'realization.pending', 'realization.running', 'realization.success', 'realization.failure', 'realization.timeout', 'realization.unknown', 'realization.waiting', 'realization.resubmit', 'ee.snapshot', 'ee.snapshot_update', 'ee.terminated', 'ee.user_cancel', 'ee.user_done', 'ensemble.started', 'ensemble.succeeded', 'ensemble.failed', 'ensemble.cancelled' [type=union_tag_invalid, input_value={'iteration_label': 'Runn...e': 'FullSnapshotEvent'}, input_type=dict]
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 checked out your branch and tested the replacement before I made the suggestion. When I did it again after the latest change I could still not reproduce the issue you encountered.
It is possible you replaced it with event_from_json(message)
imported form _ert.events import event_from_json
and not status_event_from_json
from ert.run_models.event import status_event_from_json
.
When I do the suggested above I get the same issue.
b9d4f73
to
66155f7
Compare
66155f7
to
6221630
Compare
6221630
to
c92e178
Compare
@@ -244,42 +192,22 @@ def mocked_server(url, verify, auth, timeout, proxies): | |||
# The server should fail and store a user-friendly message. | |||
assert status["status"] == ServerStatus.failed | |||
assert OPT_FAILURE_REALIZATIONS in status["message"] | |||
assert "job1 Failed with: job 1 error 1" in status["message"] | |||
assert "job1 Failed with: job 1 error 2" in status["message"] | |||
assert "job2 Failed with: job 2 error 1" in status["message"] | |||
|
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.
Do we not have this information about the failure anymore?
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 will if it exists in the snapshot, but the main difference here from before is that we dont read the error file from disk, as that relies more on the shared file system. If the information is in the snapshot, we will have it. If a job fails, the monitoring will give out whatever information is in the snapshot, so in this specific instance, if the snapshot property error
had: job 2 error 1
, that would be given. It would still be possible to read the error file and get the full error, but the reason for example ert does not do that, and the reason it is not in the snapshot is because it can be quite large. We could potentially tail
the file, and it would be smaller. But that should be done on the server side then.
Seems like quite a few of the tests are testing less (asserting less) are we sure the changed tests tests everything we want ? |
Are they? If you mean: |
Running these tests will cause a lot of dangling threads because the server is started, but not stopped, leading to potential flakyness. This mocks the server completely, which has the drawback that there is less testing of the actual server, but that is also tested in other tests.
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.
Looks very good!
Not sure if this is a perception illusion because I didn't do any actual testing for this but it seems running the examples case in the cli seem to run faster.
It is unclear if it caused by the current changes but I noticed that test_simulator_cache
is very slow. I will add an issue to investigate.
if message: | ||
event_dict = json.loads(message) | ||
if "snapshot" in event_dict: | ||
event_dict["snapshot"] = EnsembleSnapshot.from_nested_dict( | ||
event_dict["snapshot"] | ||
) | ||
try: | ||
event = EventWrapper(event=event_dict).event |
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 checked out your branch and tested the replacement before I made the suggestion. When I did it again after the latest change I could still not reproduce the issue you encountered.
It is possible you replaced it with event_from_json(message)
imported form _ert.events import event_from_json
and not status_event_from_json
from ert.run_models.event import status_event_from_json
.
When I do the suggested above I get the same issue.
I did more testing and |
Issue
Resolves #9001
Approach
Short description of the approach
(Screenshot of new behavior in GUI if applicable)
git rebase -i main --exec 'pytest tests/ert/unit_tests -n logical -m "not integration_test"'
)When applicable