```Task 'run_edit_connection_graph_flow[1]': Excep...
# ask-community
s
Copy code
Task 'run_edit_connection_graph_flow[1]': Exception encountered during task execution!
Traceback (most recent call last):
  File "ENV\lib\site-packages\prefect\engine\task_runner.py", line 859, in get_task_run_state
    value = prefect.utilities.executors.run_task_with_timeout(
  File "ENV\lib\site-packages\prefect\utilities\executors.py", line 454, in run_task_with_timeout
    return task.run(*args, **kwargs)  # type: ignore
  File "MY_DRIVE\tasks.py", line 688, in run_X_flow
    prefect.tasks.prefect.StartFlowRun(
  File "ENV\lib\site-packages\prefect\utilities\tasks.py", line 445, in method
    return run_method(self, *args, **kwargs)
  File "ENV\lib\site-packages\prefect\tasks\prefect\flow_run.py", line 432, in run
    create_link(urlparse(run_link).path)
  File "ENV\lib\site-packages\prefect\artifacts.py", line 52, in create_link
    return _create_task_run_artifact("link", {"link": link})
  File "ENV\lib\site-packages\prefect\artifacts.py", line 28, in _create_task_run_artifact
    return client.create_task_run_artifact(
  File "ENV\lib\site-packages\prefect\client\client.py", line 2155, in create_task_run_artifact
    result = self.graphql(
  File "ENV\lib\site-packages\prefect\client\client.py", line 569, in graphql
    raise ClientError(result["errors"])
prefect.exceptions.ClientError: [{'message': '[{\'extensions\': {\'path\': \'$.selectionSet.insert_task_run_artifact.args.objects\', \'code\': \'constraint-violation\'}, \'message\': \'Not-NULL violation. null value in column "tenant_id" violates not-null constraint\'}]', 'locations': [{'line': 2, 'column': 5}], 'path': ['create_task_run_artifact'], 'extensions': {'code': 'INTERNAL_SERVER_ERROR', 'exception': {'message': '[{\'extensions\': {\'path\': \'$.selectionSet.insert_task_run_artifact.args.objects\', \'code\': \'constraint-violation\'}, \'message\': \'Not-NULL violation. null value in column "tenant_id" violates not-null constraint\'}]'}}}]
Having issues after upgrading to 0.15.6 using StartFlowRun task. Local executors pointing to a Prefect Server hosted on our infrastructure. The requested flow starts running however the flow that did the requesting fails when trying to create an artefact for the run it just started. I'm surprised the issues is around tenants because my understanding was that they're Cloud things. Any help gratefully recieved.
k
Hey @Sam Thomas, is this happening for all StartFlowRun calls? Are other tasks before that succeeding?
s
Tasks before that that aren't StartFlowRun are succeeding as expected
k
Will check with the team
Would you be able to share your flow code? Or do a simple test with just a StartFlowRun task and see if it persists?
s
Alright as expected it's user error but I'll document it anyway in case it helps someone in the future. As best I can tell the issue was because I wasn't using StartFlowRun as a standard task but rather calling it with .run inside another task. So I had something like
Copy code
with prefect.Flow("flow1") as flow:
     # Code goes here with input parameters

flow.register(project_name="project")

@prefect.task
def format_inputs_and_run(par1, par2):
     par1 = [str(i) for i in par1]
     par2 = [str(i) for i in par2]
     StartFlowRun(flow_name = "flow1",
                  project_name = "project",
                  wait = True,
                  parameters= {"par1": par1,
                               "par2": par2}).run()

with prefect.Flow("flow2") as flow:
     # Code to get inputs
     format_inputs_and_run(par1, par2)
I did this because I needed to format the inputs to the flow to be json serializable (in this case because I was using pathlib to find the paths I wanted but they need to be converted to strings to be passed to the server). Interestingly this did actually work with prefect 0.14.22. The better solution that now works is to properly use StartFlowRun as a task and have a separate task to format the data.
👍 1