Skip to content

Commit

Permalink
Fix flow run parameters literally named keys (#15611)
Browse files Browse the repository at this point in the history
  • Loading branch information
zzstoatzz authored Oct 8, 2024
1 parent 6d084cc commit 0fc625b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/prefect/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ def resolve_block_reference(data: Any) -> Any:
# Get the updated parameter dict with cast values from the model
cast_parameters = {
k: v
for k, v in dict(model).items()
for k, v in model.__dict__.items()
if k in model.model_fields_set or model.model_fields[k].default_factory
}
return cast_parameters
Expand Down
9 changes: 9 additions & 0 deletions tests/test_flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -1735,6 +1735,15 @@ def my_subflow(i: Test):
instance = my_flow(Test())
assert isinstance(instance, Test)

def test_flow_parameter_kwarg_can_be_literally_keys(self):
"""regression test for https://github.com/PrefectHQ/prefect/issues/15610"""

@flow
def my_flow(keys: str):
return keys

assert my_flow(keys="hello") == "hello"


class TestSubflowTaskInputs:
async def test_subflow_with_one_upstream_task_future(self, prefect_client):
Expand Down

0 comments on commit 0fc625b

Please sign in to comment.