Hi :wave: Is there a way to retrieve the node id o...
# ask-the-community
g
Hi 👋 Is there a way to retrieve the node id or task id (not name) from within a task? Our use case is using it to parameterise a path:
Copy code
@task
def some_task():
    ...
    s3_path = (
        pathlib.Path(...)
        / flytekit.current_context().execution_id.name  # <---- unique (at least in our flow it returns an ID)
        / flytekit.current_context().task_id.name       # <---- non-unique, it returns a name. Would like to have a unique id within a workflow which I think is node_id?
    )
Saw this one, but not sure if there are ways to get the node_id already which is good enough for our purposes (since execution_id + node_id Im assuming is unique?): https://github.com/flyteorg/flyte/issues/2558
Alternatively we will generate a UUID inside the task, but if we can map it back to Flyte objects that would be nice.
s
i don't think you can retrieve node id. how about you use execution id + task name? does that work for you?
g
Ah right, good to know! No unfortunately task name won't work for us since we are using a dynamic task to run things in parallel. We will use the uuid solution in that case 👍
Thanks!