StackStorm / StackStorm/st2

Variable \"result\" is referenced before assignment

Open
#5,865 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

In stackstorm, I'm building a workflow that includes a task that uses a prometheus query and needs to transfer the results to another task. But when I try to call the result to a variable, I get an error.

Variable "result" is referenced before assignment

Below is my workflow.

version: 1.0
tasks:

[221, 79]

task1:
action: prometheus.query
input:
log_level: DEBUG
query:
url: ""
next:
# #629e47

  - when: <% succeeded() %>
    do:
      - TestTask
    publish:
      - mem: <% ctx(result).select($.value) %>  

Can anyone offer advice on this?

@armab

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is named. Start by reproducing the shown StackStorm workflow and tracing how prometheus.query publishes its result into ctx(result), then inspect the workflow context and publish documentation or implementation. Done means explaining the error and identifying how the query output can be passed to TestTask.

Written by the indexing model from the issue text.

Assessment

Tech stack
prometheus
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.