-
Notifications
You must be signed in to change notification settings - Fork 94
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
Fix data-store reloaded flag #5715
Conversation
Cheers, this should be enough information for the UI to maintain its store. Couple of questions:
|
2c08c37
to
52dacf1
Compare
There will be added information (pretty certain). I can't rule out the others (although it might not be possible), but pretty hard to rule out what gets included main loop batch.. However, the publishing in this case might happen outside the main loop batching.
Good idea, then I can avoid setting fields at the UIS.. I'll add it to this PR. |
Ok I've extended the |
fb47755
to
c808238
Compare
Tested in combination with cylc/cylc-ui#1479, works for both reloads and restarts. I applied this diff to the cylc-ui branch to ensure things were working as intended: diff --git a/src/services/treeCallback.js b/src/services/treeCallback.js
index 276501bb..562b1910 100644
--- a/src/services/treeCallback.js
+++ b/src/services/treeCallback.js
@@ -38,11 +38,16 @@ class CylcTreeCallback extends DeltasCallback {
// do this, we can end up with nodes in the store which aren't meant to be
// there and won't get pruned.
if (deltas.updated?.workflow?.reloaded) {
+ console.log('updated', deltas.updated.workflow)
store.commit('workflows/REMOVE_CHILDREN', (deltas.updated.workflow.id))
+ return
}
if (deltas.added?.workflow?.reloaded) {
+ console.log('added', deltas.added.workflow)
store.commit('workflows/REMOVE_CHILDREN', (deltas.added.workflow.id))
+ return
}
+ console.log('REGULAR DELTA')
}
onAdded (added, store, errors) {
diff --git a/src/store/workflows.module.js b/src/store/workflows.module.js
index 3dff0a8a..5c49542a 100644
--- a/src/store/workflows.module.js
+++ b/src/store/workflows.module.js
@@ -535,7 +535,7 @@ const mutations = {
},
// remove all children of a node
REMOVE_CHILDREN (state, id) {
- // console.log('@ REMOVE CHILDREN')
+ console.log('@ REMOVE CHILDREN')
const workflow = getIndex(state, id)
if (workflow) {
removeTree(state, workflow, false) It looks like the UI is receiving more We would expect two reloaded deltas, one per subscription (because we have one subscription for gscan and one for each workflow to make subscription management easier). But, I'm sometimes seeing 6 deltas, so 3 per subscription which doesn't make sense. This appears to be harmless as the first non |
I usually just use firefox dev tools ( |
I did do this, but the results are very noisy so harder to convey. It does look like there's some duplicate reloaded deltas coming through, but the reason for this isn't necessarily related. |
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, not sure how to reproduce the question mark bug
I've had a go at testing a regular subscription (no deltas) in GraphiQL: subscription {
workflows(ids: ["~osanders/sequential"]) {
id
reloaded
}
} I used a regular workflow with all of the tasks held to avoid task updates coming through. Here are the results, there seem to be some erroneous updates, errors marked in bold:
Raw web socket responses[
["start subscription"],
{"id": "8", "type": "data", "payload": {"data": {"workflows": [{"id": "~osanders/sequential", "reloaded": true}]}}},
["cylc", "play", "sequential", "--pause"],
{"id": "8", "type": "data", "payload": {"data": {"workflows": [{"id": "~osanders/sequential", "reloaded": true}]}}},
["cylc", "reload", "sequential"],
{"id": "8", "type": "data", "payload": {"data": {"workflows": [{"id": "~osanders/sequential", "reloaded": true}]}}},
["cylc", "play", "sequential"],
{"id": "8", "type": "data", "payload": {"data": {"workflows": [{"id": "~osanders/sequential", "reloaded": false}]}}},
["cylc", "reload", "sequential"],
{"id": "8", "type": "data", "payload": {"data": {"workflows": [{"id": "~osanders/sequential", "reloaded": false}]}}},
["cylc", "reload", "sequential"],
{"id": "8", "type": "data", "payload": {"data": {"workflows": [{"id": "~osanders/sequential", "reloaded": false}]}}},
["cylc", "reload", "sequential"],
{"id": "8", "type": "data", "payload": {"data": {"workflows": [{"id": "~osanders/sequential", "reloaded": false}]}}},
["cylc", "stop", "sequential"],
{"id": "8", "type": "data", "payload": {"data": {"workflows": [{"id": "~osanders/sequential", "reloaded": false}]}}},
{"id": "8", "type": "data", "payload": {"data": {"workflows": [{"id": "~osanders/sequential", "reloaded": false}]}}},
["cylc", "play", "sequential"],
{"id": "8", "type": "data", "payload": {"data": {"workflows": [{"id": "~osanders/sequential", "reloaded": true}]}}},
["cylc", "reload", "sequential"],
{"id": "8", "type": "data", "payload": {"data": {"workflows": [{"id": "~osanders/sequential", "reloaded": false}]}}},
["cylc", "reload", "sequential"],
{"id": "8", "type": "data", "payload": {"data": {"workflows": [{"id": "~osanders/sequential", "reloaded": false}]}},
["cylc", "reload", "sequential"],
{"id": "8", "type": "data", "payload": {"data": {"workflows": [{"id": "~osanders/sequential", "reloaded": false}]}}}
] @MetRonnie, could you check you get the same result as me? |
I get much the same thing * start subscription
* reloaded: **true** (the workflow is stopped, it shouldn't show as reloaded)
* cylc play sequential --pause
* reloaded: true
* cylc reload sequential
- * reloaded: true
+ * reloaded: **false**
* cylc play sequential
* reloaded: false
* cylc reload sequential
* reloaded: **false**
* cylc reload sequential
* reloaded: **false**
* cylc reload sequential
* reloaded: **false**
* cylc stop sequential
* reloaded: false
* cylc play sequential
* reloaded: true
* cylc reload sequential
* reloaded: **false**
* cylc reload sequential
* reloaded: **false**
* cylc reload sequential
* reloaded: **false** |
Will have to take a look in the morning.. If I can reproduce, I can fix it. |
Everything is working as expected! 😆 That subscription (
i.e. if you used a subscription with:
it will send a dump of the last added store every time the data-store changes (in any way), and it will always have However going through that above sequence of commands with:
Will always send We may want to try ignore sending deltas if the subscription resolves to empty to some level (i.e. only IDs) or the same content as the previous sent (?) .. But that has not been implemented, so we have to fish through all the deltas to find the corresponded
This is intentional, when a new subscription is made, an initial-burst of data is sent with the data-store sent as an added delta (essentially), and the client told it's a reload in order to remove any old/irrelevant data it may be holding:
(if this isn't desirable we can change it) |
Ok, it makes sense to me that the I've put up the cylc-ui end of this, it wipes the store when it receives a reloaded delta (whether it's added or updated as the UI is agnostic on this), the applies any other data that was delivered with the delta. Testing this branch in combination with cylc/cylc-ui#1479 should demonstrate the fix to cylc/cylc-ui#1480 |
Yeah, by default it's a dump of the data-store (so the only merging is the deltas from the scheduler into the UIS data-store). The arrival of a delta from the scheduler triggers this dump to be sent to the UI/subscriber. |
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.
Reloaded deltas coming through as expected.
Suggest keeping this open whilst cylc/cylc-ui#1479 is reviewed as the two are a pair and any issues discovered in cylc/cylc-ui#1479 may require changes here.
Merging, the UI PR is in now. |
Partially addresses cylc/cylc-uiserver#485
The
reloaded
field wasn't being set/sent, this change fixes it:Check List
CONTRIBUTING.md
and added my name as a Code Contributor.setup.cfg
(andconda-environment.yml
if present).CHANGES.md
entry included if this is a change that can affect users?.?.x
branch.