Skip to content

Commit

Permalink
Ensure empty label lists are disambiguated from None
Browse files Browse the repository at this point in the history
  • Loading branch information
cicdw committed Oct 14, 2020
1 parent 5f4f68f commit 3d06688
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/prefect_server/api/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ async def schedule_flow_runs(flow_id: str, max_runs: int = None) -> List[str]:

# if the event has parameter defaults or labels, we do allow for
# same-time scheduling
if event.parameter_defaults or event.labels:
if event.parameter_defaults or event.labels is not None:
md5 = hashlib.md5()
param_string = str(sorted(json.dumps(event.parameter_defaults)))
label_string = str(sorted(json.dumps(event.labels)))
Expand Down
4 changes: 4 additions & 0 deletions tests/api/test_flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,10 @@ async def test_doesnt_schedule_same_time_twice(self, project_id):
[dict(parameter_defaults=dict(x="a")), dict(labels=["b"])],
[dict(labels=["c", "d"]), dict(labels=["c"])],
[dict(labels=None), dict(labels=["ef"])],
[
dict(labels=None),
dict(labels=[]),
], # the scheduler should distinguish between none vs. empty
],
)
async def test_allows_for_same_time_if_event_attrs_are_different(
Expand Down

0 comments on commit 3d06688

Please sign in to comment.