Skip to content
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

UIS Delta subscriptions & GraphQL null stripping back-end #3500

Merged
merged 6 commits into from Jun 18, 2020

Conversation

dwsutherland
Copy link
Member

@dwsutherland dwsutherland commented Feb 8, 2020

Closes #2684

These changes partially address:
https://github.com/cylc/cylc-admin/blob/master/docs/proposal-subscriptions.md
As a back-end solution required to bring the proposal to fruition.

This PR is the prerequisite to the UI Server implementation: cylc/cylc-uiserver#118
(They should be merge together, as there is one change that is breaking to the BaseResolvers)

Labeled POC, but is functional and probably good to go if deemed desirable.

Features:

  • Deltas of a single main loop iteration grouped into a single message, and published as topic all. This grouping is somewhat artificial, but ensures that any related deltas (i.e. new edges and their nodes) do not arrive at the UIS (and hence WebUI) in separate pushes (helps WUI in reducing incomplete/frequency-of view updates).
  • The schema definition of the GraphQL delta subscription and resolving async generator. The resolver creates and monitors a queue, populated during delta application, and maps the Protobuf delta to the yielded GraphQL subscription ObjectType.
  • Bespoke GraphQL backend and middleware to set undesired/empty field values to null, and strip these out of the execution result.

Future:

  • Workflow Scheduler ZMQ GraphQL subscriptions. As far as I know, there are no supported packages for ZMQ+GraphQL and the current REQ/RES GraphQL end-point is something I/we created for Cylc, So we need to write a module combining our currently implemented PUB/SUB and the execution of our schema, possibly in the same way as Tornado does with graphql-ws or likely something more bespoke.
  • Make strip_null/strip_values an argument of the query.

Requirements check-list

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes.
  • Does not contain off-topic changes (use other PRs for other changes).
  • Already covered by or modifies existing tests (and/or belongs to future work).
  • No change log entry required as invisible to users.
  • No documentation update required.

Copy link
Member

@oliver-sanders oliver-sanders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scanning through the code, looks good so far, a couple of small comments.

cylc/flow/network/__init__.py Outdated Show resolved Hide resolved
cylc/flow/data_store_mgr.py Show resolved Hide resolved
cylc/flow/network/graphql.py Outdated Show resolved Hide resolved
cylc/flow/network/subscriber.py Outdated Show resolved Hide resolved
cylc/flow/network/graphql.py Outdated Show resolved Hide resolved
@oliver-sanders
Copy link
Member

@dwsutherland, hi trying to catch up, what's the status of this one? Still POC?

@dwsutherland
Copy link
Member Author

@dwsutherland, hi trying to catch up, what's the status of this one? Still POC?

Just a few things:

@dwsutherland
Copy link
Member Author

dwsutherland commented Mar 30, 2020

FYI - Ran into an issue, which probably should've been addressed earlier (but ok to address here); the job pool is not populated post restart. This means when stopping --now active jobs post restart would update states/times/messages, and previously we had caught this with the scaffolding #3536 (which helped put the core components of the new data provision in place)...

We should probably (like the task pool), repopulate the job pool with the latest submit from the DB:

self.suite_db_mgr.pri_dao.select_task_pool_for_restart(
self.pool.load_db_task_pool_for_restart, self.options.checkpoint)

So this is what I'm working on...

Although, we could defer this to another PR and just put some scaffolding back in place..

Thoughts?

@kinow
Copy link
Member

kinow commented Mar 30, 2020

Although, we could defer this to another PR and just put some scaffolding back in place..

Thoughts?

If you think that would be easier or quicker to review that change in another PR, then +1 for that. We can review that before the deltas (which I at least will spend some more time writing JS code for Cylc UI to use and test this PR)

@dwsutherland
Copy link
Member Author

dwsutherland commented Mar 30, 2020

Although, we could defer this to another PR and just put some scaffolding back in place..
Thoughts?

If you think that would be easier or quicker to review that change in another PR, then +1 for that. We can review that before the deltas (which I at least will spend some more time writing JS code for Cylc UI to use and test this PR)

Done... In order not to make this PR too bloated, check added to the application of update deltas..
The loading of active task's job on restart can be a different/parallel PR.

@kinow
Copy link
Member

kinow commented Mar 30, 2020

Done

And done as in ready for tests with the UI again? Or done as in updated the PR but still gotta more things to be done? 😀

@hjoliver
Copy link
Member

@dwsutherland - just trying to catch up here. Are you saying that restart won't work on this branch (and you can fix it in a follow-upon this)? But it did work before you removed the "scaffolding"? Can you explain what you meant by "scaffolding"? (I know I reviewed that PR, I wondered what you meant by scaffolding there too, but it seemed to be just removing undesirable exception catches as I recall).

@dwsutherland
Copy link
Member Author

@dwsutherland - just trying to catch up here. Are you saying that restart won't work on this branch (and you can fix it in a follow-upon this)? But it did work before you removed the "scaffolding"? Can you explain what you meant by "scaffolding"? (I know I reviewed that PR, I wondered what you meant by scaffolding there too, but it seemed to be just removing undesirable exception catches as I recall).

Before this PR, on the application of deltas, I use to set a default element (just ID) and merge with the updates if it didn't exist in the data-store... However that meant we were potentially missing bugs (like this post restart existing job state update)..

Restarts still work. However, until we load job data from the DB we would miss displaying active task jobs post restart.

@dwsutherland
Copy link
Member Author

Restarts still work. However, until we load job data from the DB we would miss displaying active task jobs post restart.

PR to fix: #3550

@dwsutherland dwsutherland modified the milestones: cylc-8.0a3, cylc-8.0a2 May 18, 2020
@oliver-sanders
Copy link
Member

oliver-sanders commented May 18, 2020

A couple of comments on cylc/flow/network/graphql.py which should be quick to sort out, I think this is ready.

I don't know if @hjoliver will get the time for a code review.

@hjoliver
Copy link
Member

I don't know if @hjoliver will get the time for a code review.

I'll do my best, in the next two days. I already spent a good few hours on it a week or so ago, mostly to understand the method, but had to move on to other things. Thanks for your thorough review though!

Copy link
Member

@oliver-sanders oliver-sanders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@oliver-sanders
Copy link
Member

Will leave for @hjoliver to review/merge on the alpha2 timeframe.

@hjoliver
Copy link
Member

Brilliant, thanks for all the hard work on this @dwsutherland and the heavy duty reviewing @oliver-sanders. I'll take a final look and hit merge as soon as I can.

@hjoliver
Copy link
Member

(and heavy duty functional testing @kinow !)

@dwsutherland dwsutherland force-pushed the uis_delta_subs branch 3 times, most recently from 282bc63 to 268d5ad Compare May 25, 2020 00:40
Copy link
Member

@kinow kinow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor issues after enabling strip null in the UI. Working again (thanks to @dwsutherland !)

@dwsutherland dwsutherland force-pushed the uis_delta_subs branch 2 times, most recently from 36b4232 to a3218bd Compare May 27, 2020 11:07
Copy link
Member

@kinow kinow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Synced today, and tested with the UI. Everything worked fine, re-approved! 🎉

@@ -77,7 +77,7 @@ def setUp(self) -> None:
stopcp=None,
check_point=True
)
assert 0 == warnings
assert warnings == 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

He heh, there's something hilarious about the original line 🤣

Copy link
Member

@hjoliver hjoliver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

@hjoliver hjoliver merged commit 171f4fb into cylc:master Jun 18, 2020
oliver-sanders added a commit to oliver-sanders/cylc-flow that referenced this pull request Jun 18, 2020
oliver-sanders added a commit to oliver-sanders/cylc-flow that referenced this pull request Jun 19, 2020
wxtim added a commit to wxtim/cylc that referenced this pull request Jul 6, 2020
* master: (61 commits)
  prepare 8.0a2 release
  CYLC_CONF_PATH: modify interpretation * if specified it must exist * if it's not readable you get and error because thats your fault * it can specify a file or a directory * also use pathlib because it's pretty
  scheduler_cli: add asyncio notes
  tests: fix version dependent test
  prepare 8.0a2 release
  tests: fix tests/f/cylc-ping/03
  scheduler: shutdown logic for paritally initiated flows
  tests/i: tidy test utilities away out of sight
  pytest: exclude un-collectable test file
  scheduler_cli: simplify cli teardown
  tests/i: simplify teardown
  pycodestyle++
  tests/i: suppress NFS teardown issues
  tests/i: fix asyncio event loop issues
  asyncio: shut down workflow tasks cleanly
  tests/i: fix nfs issues with integration testing cleanup/teardown
  tests/i: forward port test changes from cylc#3500
  tests/i: clean tests
  tests: documentation
  setup: add missing test dependency
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
efficiency For notable efficiency improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add capability for incremental updates to suite monitoring tools
4 participants