<@U06RKAMK0UC> how do I change the node name to no...
# ask-ai
a
@ancient-wolf-19325 how do I change the node name to not default to the task name in my workflow?
j
To change the node name in your Flyte workflow so that it does not default to the task name, you can use the
with_overrides
method provided by Flytekit. This method allows you to override the default node name with a more meaningful one. For example, you can specify a custom node name by using
.with_overrides(node_name="custom_name")
when you call a task within a workflow. However, be aware that there are some limitations, such as a maximum node ID length of 20 characters, beyond which the name will be hashed down to 8 characters, and underscores in node names can cause issues during registration, as noted in GitHub Issue #3608. Here's a simple example of how to use
with_overrides
to change a node name:
Copy code
from flytekit import task, workflow

@task
def my_task(val: str) -> str:
    return f"Hello, {val}!"

@workflow
def my_workflow(name: str) -> str:
    return my_task(val=name).with_overrides(node_name="custom_task_name")
Would you like more detail on this process or any other aspect of Flyte? Sources: - GitHub Issue #3865 - GitHub Issue #3092 - GitHub Issue #3608 👍 1 button 👎 0 button 💡 Hint: Mention @ancient-wolf-19325 in the thread for followups.