-
Notifications
You must be signed in to change notification settings - Fork 21
Avoid storing nodes in frontend - use UUIDs #1389
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
Conversation
69ce066
to
14a5072
Compare
9069da0
to
e822ffd
Compare
9b35790
to
0acd017
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1389 +/- ##
==========================================
- Coverage 72.26% 72.25% -0.01%
==========================================
Files 108 108
Lines 7254 7256 +2
==========================================
+ Hits 5242 5243 +1
- Misses 2012 2013 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The |
0acd017
to
26b5870
Compare
Sure. The motivation for the decorator is in the PR description. But just to reinforce this, consider the following from the results step: def _update_state(self):
if not self._model.has_process:
self.state = self.State.INIT
self._update_controls()
return
if process_state := self._model.process.process_state:
status = self._get_process_status(process_state.value)
else:
status = "Unknown"
if process_state is ProcessState.CREATED:
self.state = self.State.ACTIVE
elif process_state in (
ProcessState.RUNNING,
ProcessState.WAITING,
):
self.state = self.State.ACTIVE
status = self._get_process_status("running") # overwrite status
elif process_state in (
ProcessState.EXCEPTED,
ProcessState.KILLED,
):
self.state = self.State.FAIL
elif self._model.process.is_failed:
self.state = self.State.FAIL
elif self._model.process.is_finished_ok:
self.state = self.State.SUCCESS
self._model.process_info = self.STATUS_TEMPLATE.format(status)
self._update_controls() Without caching As for the implementation, the inner wrapper first checks if the thread already has a cache, otherwise it creates it. It then constructs a key from the class id, the method, the invalidator if provided (e.g., Input welcome of course, if you see a simpler way to implement it 🙂 UpdateI updated the decorator implementation to allow decorating of plain function, but also for clarity, providing comments and extending the docstring. I hope this helps 🙂🙏 |
33a9eca
to
4487f00
Compare
4487f00
to
0f313ca
Compare
0f313ca
to
1bc3153
Compare
ab51171
to
780f53f
Compare
@superstar54 I retested this one this morning. The failed docker build is due to plugins having not yet updated w.r.t the "input_structure" trait changing to "structure_uuid" (in this PR). How should we handle this? Do we merge then update all plugins quickly, or should I leave behind a dummy trait (possible if necessary)? |
I think there is no need to add a dummy trait. We can ignore the failed test this time. In the long term, we should create two Docker images with and without external plugins. I'd like to look at the thread again. Let's discuss in the office later. |
Note to self, loading nodes is quick |
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.
LGTM!
We already use the process UUID in the results step to avoid DB session conflicts across threads. This PR extends this principle throughout the app, allowing a broader use of threads in the future.
In particular, the
HasInputStructure
andHasProcess
mixins now operate with uuids. A property is introduced to each referencing the node. These properties are now cached using a newcache_per_thread
decorator ensuring that each thread only loads the node once. Subsequent calls do not bother the DB. The cache is invalidated explicitly by the respective UUID.Breaking change
Plugins need to switch referencing the old "input_structure" trait to "structure_uuid"
Update
Removing node caching - node loading is efficient