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?
)
shy-evening-51366
12/04/2023, 9:10 AM
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
shy-evening-51366
12/04/2023, 9:15 AM
Alternatively we will generate a UUID inside the task, but if we can map it back to Flyte objects that would be nice.
t
tall-lock-23197
12/05/2023, 9:25 AM
i don't think you can retrieve node id. how about you use execution id + task name? does that work for you?
s
shy-evening-51366
12/05/2023, 10:41 AM
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 👍