It would be useful to be able to use more descriptive or readable titles for Parameters in flow.visualize(). E.g. instead of "erd_input_file_path", I'd like to see "ERD input file" while retaining the variable (parameter) name as erd_input_file_path. In that context, it would be similar to Task's name parameter, which is used to display task name in flow.visualize().
Add an optional display_name parameter to Parameter which will be used by flow.visualize().
Hi @Trymzet, this is a great suggestion.
We actually already support this for all Tasks, but I think you've pointed out that we enforce it backwards for Parameters.
All tasks have a name (arbitrary string) and an optional slug (slugified string that must be unique in the flow, essentially a flow-scoped ID). For parameters, we require them to be the same, in order to ensure that the Parameter name is unique.
However, if we relaxed that assumption and allowed users to customize the Parameter name like any task, while continuing to use the parameter's unique slug in order to associate it with its runtime value, we could achieve your goal.
It sounds like you don't want this but for the record "ERD input file" is a perfectly valid Parameter name. The only slight drawback is that to pass a value for this parameter you have to use a dictionary:
flow.run(parameters={"ERD input file": "foo"})
Good point @cicdw -- so a follow-up question for @Trymzet is do you even want the slugified name at all? Do you only want the "display name" for all purposes?
Thanks, it works for my needs. :) This is the full working code:
@task
def _print(x):
print(x)
param_value = "some value"
param = Parameter("Pretty parameter name")
with Flow("flow_name") as flow:
_print(param)
flow.run(parameters={"Pretty parameter name": param_value })
Most helpful comment
It sounds like you don't want this but for the record
"ERD input file"is a perfectly valid Parameter name. The only slight drawback is that to pass a value for this parameter you have to use a dictionary: