Richard Alexander
09/29/2022, 1:58 PMParameterTypeError('Flow run received invalid parameters:\n - part_list: value is not a valid list')
When starting a flow run via UI, what is the correct format that the UI expects when passing a list as a parameter?Jenny
09/29/2022, 2:46 PMRichard Alexander
09/29/2022, 2:59 PMJenny
09/29/2022, 3:21 PMZanie
09/29/2022, 3:21 PMprefect flow-run inspect <your-flow-run>
?Richard Alexander
09/29/2022, 3:26 PMpart_list: string
.FlowRun(
id='91e20552-b28b-4f40-a7f3-10c49ff3d6be',
created=DateTime(2022, 9, 29, 15, 13, 47, 577427, tzinfo=Timezone('+00:00')),
updated=DateTime(2022, 9, 29, 15, 13, 51, 979492, tzinfo=Timezone('+00:00')),
name='omicron4-minhiriath',
flow_id='254e5f71-eeb0-45c0-a3e1-6239cea4946f',
state_id='c2ae0c28-c3b7-4c25-a928-e685e1f6baa6',
deployment_id='9f138df5-710c-4940-a52d-08ee52349cf2',
work_queue_name='general',
flow_version='d290e9f5a2cfbe5193231cb5645881c5',
parameters={
'part_list': '{"170-215", "66205-85", "3059258-01"}'
},
empirical_policy=FlowRunPolicy(retries=0, retry_delay=0),
state_type=StateType.FAILED,
state_name='Failed',
expected_start_time=DateTime(2022, 9, 29, 15, 13, 47, 577235, tzinfo=Timezone('+00:00')),
infrastructure_document_id='fa337e2c-92f3-4c42-b48e-2aed81a67be5',
state=State(
id='c2ae0c28-c3b7-4c25-a928-e685e1f6baa6',
type=StateType.FAILED,
name='Failed',
timestamp=DateTime(2022, 9, 29, 15, 13, 51, 976706, tzinfo=Timezone('+00:00')),
message="Validation of flow parameters failed with error: ParameterTypeError('Flow run received invalid parameters:\\n - part_list: value is not a valid list')",
data=DataDocument(
encoding='cloudpickle',
blob=b'gAWVgQAAAAAAAACMEnByZWZlY3QuZXhjZXB0aW9uc5SMElBhcmFtZXRlclR5cGVFcnJvcpSTlIxN\nRmxvdyBydW4gcmVjZWl2ZWQgaW52YWxpZCBwYXJhbWV0ZXJzOgogLSBwYXJ0X2xpc3Q6IHZhbHVl\nIGlzIG5vdCBhIHZhbGlkIGxpc3SUhZRSlC4=\n'
),
state_details=StateDetails(flow_run_id='91e20552-b28b-4f40-a7f3-10c49ff3d6be')
)
)
Zanie
09/29/2022, 3:28 PMList[str]
in your flow definition then in the UI you’ll want to pass it as ["foo", "bar"]
Richard Alexander
09/29/2022, 3:29 PMflow_version='3eab00f5dd40a198fd2e4f61c712950b',
parameters={
'part_list': [
'"170-215", "66205-85", "3059258-01"'
]
},
I changed my method as you suggested:
@flow()
def my_flow(part_list: list[str]):
...
"170-215", "66205-85", "3059258-01"
Zanie
09/29/2022, 3:50 PMRichard Alexander
09/29/2022, 3:52 PMUserWarning: Block document has schema checksum sha256:d28332d78ac90882bfeeef79f98cd26c99cda6a7c6d3a48d56a6bd67d7360648 which does not match the schema checksum for class 'Process'. This indicates the schema has changed and this block may not load.
self.infrastructure = Block._from_block_document(
FlowRun(
id='ada166b4-5279-449a-adc1-b0922c2d6b65',
created=DateTime(2022, 9, 29, 15, 50, 0, 80785, tzinfo=Timezone('+00:00')),
updated=DateTime(2022, 9, 29, 15, 50, 7, 965278, tzinfo=Timezone('+00:00')),
name='theta5-magus-manifold',
flow_id='254e5f71-eeb0-45c0-a3e1-6239cea4946f',
state_id='386e6aa3-53b1-414b-a314-036061a56d32',
deployment_id='9f138df5-710c-4940-a52d-08ee52349cf2',
work_queue_name='general',
flow_version='2db1960d59edb08a61304c30ce80861f',
parameters={'part_list': ['["170-215", "66205-85", "3059258-01"]']},
empirical_policy=FlowRunPolicy(retries=0, retry_delay=0),
state_type=StateType.COMPLETED,
state_name='Completed',
run_count=1,
expected_start_time=DateTime(2022, 9, 29, 15, 50, 0, 80471, tzinfo=Timezone('+00:00')),
start_time=DateTime(2022, 9, 29, 15, 50, 6, 424794, tzinfo=Timezone('+00:00')),
end_time=DateTime(2022, 9, 29, 15, 50, 7, 963240, tzinfo=Timezone('+00:00')),
total_run_time=datetime.timedelta(seconds=1, microseconds=538446),
estimated_run_time=datetime.timedelta(seconds=1, microseconds=538446),
estimated_start_time_delta=datetime.timedelta(seconds=6, microseconds=344323),
infrastructure_document_id='fa337e2c-92f3-4c42-b48e-2aed81a67be5',
state=State(
id='386e6aa3-53b1-414b-a314-036061a56d32',
type=StateType.COMPLETED,
name='Completed',
timestamp=DateTime(2022, 9, 29, 15, 50, 7, 963240, tzinfo=Timezone('+00:00')),
message='All states completed.',
data=DataDocument(encoding='result', blob=b'{"key": "5eaebc2484eb4f2bb910f1091d98f5a5", "filesystem_document_id": "7fc03c9d-acbb-4246-9ef4-079a74f9d80f"}'),
state_details=StateDetails(flow_run_id='ada166b4-5279-449a-adc1-b0922c2d6b65')
)
)
Zanie
09/29/2022, 4:07 PMRichard Alexander
09/29/2022, 4:39 PMZanie
09/29/2022, 4:40 PMRichard Alexander
09/29/2022, 4:40 PMZanie
09/29/2022, 4:41 PMRichard Alexander
09/29/2022, 4:42 PMZanie
09/29/2022, 4:42 PMRichard Alexander
09/29/2022, 4:47 PMZanie
09/29/2022, 4:48 PMRichard Alexander
09/29/2022, 4:48 PMJenny
09/29/2022, 4:49 PMRichard Alexander
09/29/2022, 4:50 PMZanie
09/29/2022, 4:51 PMRichard Alexander
09/29/2022, 4:52 PMZanie
09/29/2022, 4:54 PMimport asyncio
from prefect import get_client
async def create_run():
async with get_client() as client:
flow_run = await client.create_flow_run_from_deployment(
"<deployment-id>", parameters={"your-param": ["your", "big", "list"]}
)
print(flow_run.id)
asyncio.run(create_run)
prefect deployment run
command. Parsing JSON from the CLI is kind of a pain.Jenny
09/29/2022, 6:33 PM