Repository: dask/dask
File: dask/order.py (Python)

Code before:
                                known_runnable_paths[current] = [path]
                        break

    # Pick strategy
    # Note: We're trying to be smart here by picking a strategy on how to
    # determine the critical path. This is not always clear and we may want to
    # consider just calculating both orderings and picking the one with less
    # pressure. The only concern to this would be performance but at time of
    # writing, the most expensive part of ordering is the prep work (mostly
    # connected roots + sort_key) which can be reused for multiple orderings.

    def get_target(longest_path: bool = False) -> Key:
        # Some topologies benefit if the node with the most dependencies
        # is used as first choice, others benefit from the opposite.
        candidates = leaf_nodes
        skey: Callable = sort_key

        preferred_candidates = set()
        if runnable_hull:
            skey = lambda k: (num_needed[k], sort_key(k))
            preferred_candidates = runnable_hull & candidates
        if not preferred_candidates and reachable_hull:
            skey = lambda k: (num_needed[k], sort_key(k))
            preferred_candidates = reachable_hull & candidates

        if reachable_hull or runnable_hull:
            # We can't reach a leaf node directly, but we still have nodes
            # with results in memory, these notes can inform our path towards
            # a new preferred leaf node.
            if not preferred_candidates:
                for r in processed_roots:
                    leafs_connected_to_loaded_roots.update(leafs_connected[r])
                processed_roots.clear()

                leafs_connected_to_loaded_roots.intersection_update(candidates)
                preferred_candidates = leafs_connected_to_loaded_roots
            candidates = preferred_candidates
        else:
            # We reach a new and independent branch, so throw away previous branch
            leafs_connected_to_loaded_roots.clear()

        if longest_path and not runnable_hull and not reachable_hull:
            return leaf_nodes_sorted.pop()
        else:
            # FIXME: This can be very expensive
            return min(candidates, key=skey)

    def use_longest_path() -> bool:
        size = 0
        # Heavy reducer / splitter topologies often benefit from a very
        # traditional critical path that expresses the longest chain of

Review comment (suggestion):
I think we don't want to use runnable_hull here. In fact, reviewing the code more broadly, with 
https://github.com/dask/dask/pull/11305 it is only used within `process_runnables` so it might make sense to rename it to `seen_by_process_runnables` and avoid some confusion.

You are also not using it in the body of the if clause which likely indicates that this should go away

```suggestion
        if reachable_hull:
```

Code after:
                            ):
                                for k in path:
                                    add_to_result(k)
                            else:
                                known_runnable_paths[current] = [path]
                                runnable_hull.discard(current)
                        break

    # Pick strategy
    # Note: We're trying to be smart here by picking a strategy on how to
    # determine the critical path. This is not always clear and we may want to
    # consider just calculating both orderings and picking the one with less
    # pressure. The only concern to this would be performance but at time of
    # writing, the most expensive part of ordering is the prep work (mostly
    # connected roots + sort_key) which can be reused for multiple orderings.

    def get_target(longest_path: bool = False) -> Key:
        # Some topologies benefit if the node with the most dependencies
        # is used as first choice, others benefit from the opposite.
        candidates = leaf_nodes
        skey: Callable = sort_key
        if reachable_hull:
            skey = lambda k: (num_needed[k], sort_key(k))

        all_leafs_accessible = len(leafs_connected_to_loaded_roots) >= len(candidates)
        if reachable_hull and not all_leafs_accessible:
            # Avoid this branch if we can already access all leafs. Just pick
            # one of them without the expensive selection process in this case.

            candidates = reachable_hull & candidates
            if not candidates:
                # We can't reach a leaf node directly, but we still have nodes
                # with results in memory, these notes can inform our path towards
                # a new preferred leaf node.
                for r in processed_roots:
                    leafs_connected_to_loaded_roots.update(leafs_connected[r])
                processed_roots.clear()

                leafs_connected_to_loaded_roots.intersection_update(leaf_nodes)
                candidates = leafs_connected_to_loaded_roots
            else:
                leafs_connected_to_loaded_roots.update(candidates)

        elif not reachable_hull:
            # We reach a new and independent branch, so throw away previous branch
            leafs_connected_to_loaded_roots.clear()

        if longest_path and (not reachable_hull or all_leafs_accessible):
            return leaf_nodes_sorted.pop()
        else:
            # FIXME: This can be very expensive