<@U06RKAMK0UC> Is it possible to fetch the workflo...
# ask-ai
b
@ancient-wolf-19325 Is it possible to fetch the workflow execution id from a workflow or task within a workflow without using launchplans?
a
Yes, it is possible to fetch the workflow execution ID from within a task using
flytekit.current_context().execution_id
. However, it is not possible to fetch the execution ID directly from within a workflow. According to this discussion, you can access the execution ID inside a task using the following code snippet:
Copy code
import flytekit

@task
def my_task():
    ctx = flytekit.current_context()
    execution_id = ctx.execution_id.name
    print(execution_id)
Would you like more details on this? Sources: - Flyte Discussion on Execution ID - Flytekit ExecutionParameters Documentation 👍 1 button 👎 0 button 💡 Hint: Mention @ancient-wolf-19325 in the thread for followups.