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

Getting empty job variables when using job: Job in worker #311

Open
nilsonrossi opened this issue Jun 16, 2022 · 0 comments
Open

Getting empty job variables when using job: Job in worker #311

nilsonrossi opened this issue Jun 16, 2022 · 0 comments

Comments

@nilsonrossi
Copy link

According to the doc, i can define in worker parameters, the variable job: Job, so we can get the Job instance.
However, the job.variables is always empty and i think the error is when pulling the jobs:

jobs = self.zeebe_adapter.activate_jobs(
task_type=self.task.type,
worker=self.worker_name,
timeout=self.task.config.timeout_ms,
max_jobs_to_activate=self.calculate_max_jobs_to_activate(),
variables_to_fetch=self.task.config.variables_to_fetch,
request_timeout=self.request_timeout,
)

The variable self.task.config.variables_to_fetch in this case is ['job']. This mean that, if there isn't a job variable in the instance variables, the worker will receive a Job with an empty variables.

How to reproduce:

  • Just create a worker with job: Job as parameter, and print(job.variables) inside the function.
  • Run a new process passing some data in variables.
@worker.task(task_type="task_1")
def task_1(job: Job):
    print(job.variables)
    return {}

If i run a new process with {"var1": "value"} variable, the worker should print exact the same variables.Sorr
Sorry about the English if i made some mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant