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

[PR] Add an example for embedded operator (and stop/ready flags) #185

Closed
kopf-archiver bot opened this issue Aug 18, 2020 · 0 comments
Closed

[PR] Add an example for embedded operator (and stop/ready flags) #185

kopf-archiver bot opened this issue Aug 18, 2020 · 0 comments
Labels
archive documentation Documentation improvements enhancement New feature or request

Comments

@kopf-archiver
Copy link

kopf-archiver bot commented Aug 18, 2020

A pull request by nolar at 2019-09-03 08:16:44+00:00
Original URL: zalando-incubator/kopf#185
Merged by nolar at 2019-09-13 11:01:51+00:00

Add stop/ready flags to the operator coroutines, and add an example for the embedded operator, which uses these flags.

Issue : #184, follow-up for #156.

Description

The stop-flag is used to signal the operator (from the outside caller) that it should terminate gracefully.

The ready-flag is used to signal the outside caller (from the operator) that the operator has initialised and is ready to work.

This bi-directional communication slightly simplifies the orchestration of the operators when they are embedded into arbitrary applications (i.e. not called via kopf run). This could be also done by cancelling the task of the operator, but that would require few extra lines to operate it (checking for the cross-thread flag and finishing the asyncio task), which are already present inside of the operator coroutines — so why not utilise that?

An example is added to demonstrate how an embedded operator can look like.

Also, the docs were fixed for the embedded operator.

Types of Changes

  • New feature (non-breaking change which adds functionality)
  • Documentation / non-code
@kopf-archiver kopf-archiver bot closed this as completed Aug 18, 2020
@kopf-archiver kopf-archiver bot changed the title [archival placeholder] [PR] Add an example for embedded operator (and stop/ready flags) Aug 19, 2020
@kopf-archiver kopf-archiver bot added documentation Documentation improvements enhancement New feature or request labels Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
archive documentation Documentation improvements enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

0 participants