Can a templated task run name access attributes of...
# prefect-community
j
Can a templated task run name access attributes of objects? Like task_run_name="{my_object.name}"
k
I think if my_object is an input into the task. If not like that, you can surely do a function call like this
j
Right, duh, I literally just read that. Thanks!
So that is giving me an error
TypeError: Object of type function is not JSON serializable
It's when trying to execute create_flow_run:
Copy code
File "c:\sourcecontrol\Prefect\venv\lib\site-packages\prefect\client\client.py", line 1192, in create_flow_run
    res = self.graphql(create_mutation, variables=dict(input=inputs))
  File "c:\sourcecontrol\Prefect\venv\lib\site-packages\prefect\client\client.py", line 447, in graphql
    params=dict(query=parse_graphql(query), variables=json.dumps(variables)),
thoughts?
k
This looks like you are trying to have a function as a parameter or an object? So
create_flow_run
goes through an API so everything passed needs to be JSONSerializable to be passed through the API. You can’t have Python classes or callables
It’s an API request
j
I think I figured it out, didn't change something after switching to a function
k
Ah ok. Good to hear!