I'm trying to run train a variety of models agains...
# ask-the-community
d
I'm trying to run train a variety of models against a single dataset. The general process works fine but I can't find a clean way to dynamically rename the tasks for each of the model types. Am I missing something? I tried
.with_overrides(name="blah")
but it didn't seem to be picked up.
k
This should work
This will rename the node, cc @Jason Porter / @Soham Can you paste the screenshot of your the Ui
It might just be a Ui bug
d
yes. Let me triple check I didn't miss something if that was supposed to work.
code:
training_file = data_aggregation(input_parquet_dir=output_file).with_overrides(name="agg_stuff")
Still might be missing something but that is what I'm seeing. Is there a different way I could check the names of the tasks?
k
Cc @Yee quick way to triage this
y
hey @Dan Corbiani - just want to clarify a couple things. the task name in normal workflows will not change… the name of the task is a parameter in the TaskTemplate and it’s stored in the database. however as ketan suggested you can override the node name. you can check out this unmerged example which we cooked up for internal testing.
for
@dynamic
tasks, it’s a little different. you can use the same syntax still. but to clarify what happens is that the actual details of the task that is run is not the version that’s stored in the database. (this is kinda a transparent detail for you, but just to clarify)
cuz you mentioned ‘dynamically rename the tasks’ but looking at the screenshot, it doesn’t look like you’re using the @dynamic task decorator right?
d
Finally got back to this. I think it's an error in the UI rendering. Here is the code I'm using:
Copy code
from typing import List

from flytekit import dynamic, task, workflow


@task()
def model_training(name: str) -> str:
    print(f"Hello {name}")
    return name


@task()
def hello_person(name: str) -> str:
    print(f"Hello {name}")
    return name


@dynamic
def people(names: List[str]) -> List[str]:
    ack = []
    for name in names:
        ack.append(model_training(name=name))
    return ack


@workflow()
def hello_people(names: List[str]) -> List[str]:
    ack = people(names=names)
    other_names = ["bob", "sue"]
    for other_name in other_names:
        hello_person(name=other_name).with_overrides(node_name=f"hello_{other_name}")
    print(ack)
    return ack


if __name__ == "__main__":
    output = hello_people(names=["bob", "sue"])
    type(output)
It seems to render correctly on the node page but not on the graph. It's also correct on the timeline view.
k
Cc @Jason Porter / @Soham
j
Ah okay, yeah its definitely not supposed to do that; we'll pick that up this sprint 👍 https://github.com/flyteorg/flyte/issues/3370
e
does anyone know if it’s possible to set the name of a
@dynamic
task using
.with_overrides()
? I tried
name=
(didn’t work) and
node_name=
(failed to run).
to clarify what I meant by “doesn’t work”, I mean that the name of the task node in the Flyte UI is still the function name instead of the name passed to
with_overrides
. And by “failed to run”, I mean that the task would exit with a failure message.
125 Views