refactor(datashare-python): register workers through entry point plugins#6
Open
refactor(datashare-python): register workers through entry point plugins#6
Conversation
7e9caee to
8a8b2f9
Compare
95277cb to
9ad0bb7
Compare
9ad0bb7 to
62f8850
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Implement workflows and activities discovery through Python entrypoints for plugin.
When devs create worker packages, and installs it together with
datashare-python, they can then start their worker running the workflow and activities of the choice as following:datashare-python worker start --queue <queue> [--activities <activity-regex>] [--workflows <workflow-regex>] --temporal-address localhost:7233This API lets the CLI user cherry picking the activities and workflow of their choice and route them to a given queue.
The registry machnism works as following:
worker_package/registry.py:pyproject.tomlunder thedatashare.workflowsanddatashare.activitiesplugin/entrypoint group:After that the
datashare-pythonCLI will auto discover registered activities and workflow and perform filtering through regexesNote: workflows and activite must use explicit name through the
name=keywoard arg when using theactivity/workflow.defn(name=)functiondatashare-pythonAdded