Stefano Cascavilla
10/19/2021, 9:24 AMStartFlowRun.run()
this error is shown:
Error during execution of task: 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\'}]'}}}])
We are migrating from 0.14.22
version, we are using server
as the backend in local
Can anybody help?Anna Geller
Anna Geller
Stefano Cascavilla
10/19/2021, 10:05 AMAnna Geller
prefect server create-tenant
Stefano Cascavilla
10/19/2021, 10:08 AMAnna Geller
StartFlowRun
from another task. Have a look at this: https://prefect-community.slack.com/archives/CL09KU1K7/p1632911162461300?thread_ts=1632754964.329100&cid=CL09KU1K7Stefano Cascavilla
10/19/2021, 10:15 AMStefano Cascavilla
10/19/2021, 10:20 AMStefano Cascavilla
10/19/2021, 10:42 AM--expose
flag, but received the same errorAnna Geller
from prefect import Flow, unmapped
from prefect.tasks.prefect import create_flow_run
from prefect.executors import LocalDaskExecutor
with Flow("MasterFlow_Mapped", executor=LocalDaskExecutor()) as flow:
mapped_flows = create_flow_run.map(
flow_name=["flow_name_1", "flow_name_2", "flow_name_3"],
project_name=unmapped("Flow_of_Flows"),
)
if __name__ == "__main__":
flow.run()
I tested this and it works - they are ran in parallel. But I’m using the create_flow_run task rather than StartFlowRun. Could you give it a try?Anna Geller
from prefect import Flow, unmapped, task
from prefect.tasks.prefect import StartFlowRun
from prefect.executors import LocalDaskExecutor
from uuid import uuid4
@task
def run_subflow(flow_name):
StartFlowRun(flow_name=flow_name, project_name="Flow_of_Flows", wait=True).run(
idempotency_key=str(uuid4())
)
with Flow("MasterFlow_Mapped", executor=LocalDaskExecutor()) as flow:
mapped_flows = run_subflow.map(
flow_name=["flow_name_1", "flow_name_2", "flow_name_3"]
)
if __name__ == "__main__":
flow.run()
Stefano Cascavilla
10/19/2021, 12:38 PMidempotency_key
param to the run
invocation, but received the same error.Anna Geller
StartFlowRun
and create_flow_run
above and none of that worked?
Can you share your flow code so that we can reproduce the issue?Stefano Cascavilla
10/19/2021, 1:17 PMcreate_flow_run
along with wait_for_flow_run
and worked fine! Thank you so much! 😄ale
10/19/2021, 1:19 PMcreate_flow_run
instead of StartFlowRun
as a best practice?Anna Geller
StartFlowRun
was initially built to manage subflows but it did it in a way which combines multiple actions in one task. The new tasks create_flow_run
, wait_for_flow_run
and get_task_run_result
separate the concerns, and are much easier to combine with other tasks - you can read more here.ale
10/19/2021, 1:36 PMKevin Kho