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

data_store: reduce the cost of creating prerequisite objects #5523

Merged
merged 1 commit into from
Jun 19, 2023

Conversation

oliver-sanders
Copy link
Member

@oliver-sanders oliver-sanders commented May 5, 2023

Attempt to reduce the overheads of creating prerequisite objects in the data store.

At Cylc7 we only created prerequisite objects for tasks in the pool. At Cylc 8 we create pbPrerequsite objects for each task in the n=1 window by default, expandable out to large n numbers by request.

These prereq objects are costly to generate. The bulk of that is due to a high number of detokenise calls. Since there is no real function to having the tokens objects around for data store prerequsites which don't technically exist yet, we may as well go back to string formatting here.

Also make some minor optimisations on route and fix what looks like a bug in the expression for non-conditional prerequisites.

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included (or explain why tests are not needed).
  • There are other changelog entries about similar efficiency improvements.
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

Comment on lines -247 to -248
prereq_buf.conditions.extend(conds)
prereq_buf.cycle_points.extend(
Copy link
Member Author

Choose a reason for hiding this comment

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

@dwsutherland Is there a special why these PbPrerequisite fields were initialised, then extended rather than being declared directly? It seems to work this way but I know PB ain't Python so can appear to have strange interactions so want to make sure I'm not breaking anything deliberate.

Copy link
Member

@dwsutherland dwsutherland Jun 19, 2023

Choose a reason for hiding this comment

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

It may have been a work around to an issue that has been solved:
protocolbuffers/protobuf#10063
Or just a quirk of how I did things (perhaps thinking sub message fields couldn't be in the init args)..
If it works, and results are as expected .. Then should be fine.

@oliver-sanders oliver-sanders marked this pull request as ready for review June 16, 2023 12:55
@oliver-sanders oliver-sanders added this to the cylc-8.2.0 milestone Jun 16, 2023
@oliver-sanders oliver-sanders added efficiency For notable efficiency improvements small labels Jun 16, 2023
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.

LGTM. I've pinged David on Element, for the protobuf question.

Copy link
Member

@dwsutherland dwsutherland left a comment

Choose a reason for hiding this comment

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

Looks good.. As the prerequisites are stored and used in the pool task, it made sense to reuse this info for the data-store...

@dwsutherland dwsutherland merged commit 9a7f4a0 into cylc:master Jun 19, 2023
@oliver-sanders oliver-sanders deleted the data-store-prereq branch June 19, 2023 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
efficiency For notable efficiency improvements small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants