I'm having some issues with the context variables. I seem to be getting incorrect results, or there's something obvious that I'm missing. For example,
Copy code
with Flow('Test 1') as flow:
print(f"""
flow name: {context.flow_name}
flow id: {context.flow_id}
flow run name: {context.flow_run_name}
flow_run_id: {context.flow_run_id}
""")
results in :
Copy code
flow name: Test 1
flow id: Test 1
flow run name: bc5e286e-6268-43a8-aaaf-a5d03275917d
flow_run_id: c867f4ea-1599-4201-a8e0-886cadbe0e1e
It looks like the context variables are not entirely correct? Flow Name and Flow ID are both pulling the same field and I would expect Flow Run Name to pull something like 'violet-marmoset'.
Is there an actual issue here or am I using these incorrectly?
k
Kevin Kho
07/21/2021, 10:10 PM
Hey @DK , are you during
flow.run()
or running with Cloud or Server? I think for flow.run, these are not set because it’s just a test so these are filled, but it should work when running with Cloud/Server
Kevin Kho
07/21/2021, 10:15 PM
The print under the Flow is not deferred. These will resolve when the flow is actually run but this print statement is happening during the build time.
d
DK
07/21/2021, 10:56 PM
ya I'm using flow.run(), I'll test it again with cloud, thanks!
k
Kevin Kho
07/21/2021, 10:59 PM
It might be the same in cloud because the print might be happening during build time. It will work if you put it in a task.
d
DK
07/21/2021, 11:01 PM
I never actually used the example that I had above, in my actual code it was in a task. But good to know going forward, thanks
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.