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

Expected Job.variables to contain the variables in a task #207

Closed
jelleklaver opened this issue Aug 30, 2021 · 1 comment
Closed

Expected Job.variables to contain the variables in a task #207

jelleklaver opened this issue Aug 30, 2021 · 1 comment
Labels
3.0.0 Will be released in Zeebe 3.0.0 bug Something isn't working

Comments

@jelleklaver
Copy link

Is your feature request related to a problem? Please describe.
When #176 was introduced, it also introduced some expected behaviour (to me at least ;-)). I expected when using the pyzeebe.Job for a parameter on a task, all variables would be replaced by the job (since it contains a variables dictionary). Therefore, I tried to do something like the following:

@worker.task('create_organisation')
def create_organisation(job: pyzeebe.Job):
    """Create organisation from job.variables"""
    organisation = job.variables["organisation"]
    # do something with organisation
    job.variables['new_var'] = new_var
    return job.variables

However, this doesn't work, since the job.variables dict doesn't actually contain the variables, but it recursively contains the job.

Describe the solution you'd like
I think it would be best to have access to the actual variables through job.variables, if possible. Else, the variables should be removed of this 'kind of Job' (maybe related to #179). But at the very least, I think it should be clearly stated in the docs if this behaviour is kept.

Describe alternatives you've considered
You can still get the variables the regular way.

E.g. this does work:

@worker.task('create_organisation')
def create_organisation(job: pyzeebe.Job, organisation):
    """Create organisation from job's variables"""
    # do something with organisation
    return {'new_var': new_var}

Additional context
Version used: v3.0.0rc3

@JonatanMartens JonatanMartens added 3.0.0 Will be released in Zeebe 3.0.0 bug Something isn't working labels Sep 6, 2021
@JonatanMartens
Copy link
Collaborator

Fixed in v3.0.0rc4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.0.0 Will be released in Zeebe 3.0.0 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants