Skip to content

Commit

Permalink
Merge pull request #1736 from bnaul/patch-4
Browse files Browse the repository at this point in the history
Respect order of inputs in merge
  • Loading branch information
cicdw authored Nov 13, 2019
2 parents 3726035 + da65fa0 commit 7298003
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ These changes are available in the [master branch](https://github.com/PrefectHQ/
- Fix executor initialization missing `self` in `KubernetesJobEnvironment` - [#1713](https://github.com/PrefectHQ/prefect/pull/1713)
- Fix `identifier_label` not being generated on each run for Kubernetes based environments - [#1718](https://github.com/PrefectHQ/prefect/pull/1718)
- Fix issue where users could not override their user config path when deploying Docker to Cloud - [#1719](https://github.com/PrefectHQ/prefect/pull/1719)
- Respect order of inputs in merge - [#1736](https://github.com/~/1736)

### Deprecations

Expand Down
7 changes: 6 additions & 1 deletion src/prefect/tasks/control_flow/conditional.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ def __init__(self, **kwargs) -> None:

def run(self, **task_results: Any) -> Any:
return next(
(v for v in task_results.values() if not isinstance(v, NoResultType)), None
(
v
for k, v in sorted(task_results.items())
if not isinstance(v, NoResultType)
),
None,
)


Expand Down
16 changes: 16 additions & 0 deletions tests/tasks/test_control_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,22 @@ def true_branch():
assert state.result[merge_task].result == [1, 2]


def test_merge_order():
@task
def x():
return "x"

@task
def y():
return "y"

with Flow(name="test") as flow:
merge_task = merge(x(), y())

state = flow.run()
assert state.result[merge_task].result == "x"


class TestFilterTask:
def test_empty_initialization(self):
task = FilterTask()
Expand Down

0 comments on commit 7298003

Please sign in to comment.