-
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
Bugfix/all variables injected when function has no variables #348
Bugfix/all variables injected when function has no variables #348
Conversation
…o bugfix/all-variables-injected-when-function-has-no-variables
Looks good, but please add a simple unit test so that this bug doesn't reproduce. |
Done. |
pyzeebe/worker/task_router.py
Outdated
@@ -71,7 +72,7 @@ def task( | |||
def task_wrapper(task_function: Callable): | |||
config = TaskConfig( | |||
task_type, | |||
exception_handler, | |||
exception_handler or self._default_exception_handler, |
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.
Would be nice to add a small unit test for this
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.
I'll add it in #349
tests/unit/utils/random_utils.py
Outdated
def _build_dict_from_list(keys: List[str], *values): | ||
if not values: | ||
return dict(zip(keys, keys)) | ||
assert len(keys) == len(values) |
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.
No need to add this imo
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.
Removed :)
Co-authored-by: Jonatan Martens <[email protected]>
…n-has-no-variables
Waiting for re-review :) |
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.
Waiting for re-review :)
tests/unit/utils/random_utils.py
Outdated
def _build_dict_from_list(keys: List[str], *values): | ||
if not values: | ||
return dict(zip(keys, keys)) | ||
assert len(keys) == len(values) |
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.
Removed :)
pyzeebe/worker/task_router.py
Outdated
@@ -71,7 +72,7 @@ def task( | |||
def task_wrapper(task_function: Callable): | |||
config = TaskConfig( | |||
task_type, | |||
exception_handler, | |||
exception_handler or self._default_exception_handler, |
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.
I'll add it in #349
fixed in #404 |
Fix bug where function decorated as task receives all variables that are available to the task causing an
unexpected keyword argument
error. Referenced in #337.The bug originates from the zeebe grpc API for
ActivateJobs
. If no variables are passed tofetchVariable
, it fetches all available variables.Changes
include_variables
flag to private function_create_job_from_raw_job
. If flag is set to False, retrieved variables will be ignored.The function is called in one place, which now calls it with
bool(variables_to_fetch)
as the flag's value.None
or an empty list will cause no variables to be injected to theJob
object, so they will never end up getting passed to the function.API Updates
New Features (required)
Checklist
References
ActivateJobs API
Fixes #337