-
Notifications
You must be signed in to change notification settings - Fork 37
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
Refactor/task builder #131
Conversation
This allows for parameters named args or kwargs that are not *args or **kwargs
Considering this is a breaking change, I think it is a good idea to include zeebe v1.0.0 support before releasing. See https://forum.zeebe.io/t/changelog-for-zeebe-client-lib-maintainers/2064 |
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.
Approached this by going over the tests added/changed.
tests/unit/task/task_builder_test.py
Outdated
def test_decorator_variables_are_added(self, original_task_function: Callable, decorator: TaskDecorator, | ||
task_config: TaskConfig, mocked_job_with_adapter: Job): | ||
decorator_return_value = mocked_job_with_adapter | ||
decorator_return_value.variables = {"x": 2} |
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.
Maybe create a helper function that returns {str(uuid4()): str(uuid4)}
The dataclasses library is not supported in python 3.6
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.
Approached this review round from the code side (as well as verified the recent changes).
Looks good, some suggestions/changes needed. Impressive work, thanks for your commitment to this project!
Hey @kbakk, I implemented most of your suggestions, some replies to things I view differently/didn't understand. Could you take another look? |
A couple of lint issues to address, otherwise good to merge I think: |
Hey @kbakk, I decided that |
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.
Sorry for the delay here.
I think it's a good call to retain the task API.
Couple of comments, not important to address, so setting this to approved. Well done!
pyzeebe/worker/task_router.py
Outdated
|
||
def task_wrapper(fn: Callable): | ||
task = task_builder.build_task(fn, config_with_decorators) | ||
if single_value and not variable_name: |
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.
Can we move back this check to TaskConfig.__init__
, and build the TaskConfig
outside of the wrapper? It seems to belong there.
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.
The task config is built here because we need the task_function
to get variables_to_fetch
Move the task building process from
ZeebeWorker
.This pr introduces a breaking change.
Changes
TaskConfig
class, which is used internallyTaskHandler
classZeebeTaskDecorator
base classZeebeWorker
now inherits fromZeebeTaskRouter
API Updates
none
Enhancements (optional)
Move task building functionality out of the
ZeebeWorker
class.Checklist