Exemple #1
0
def not_all_skipped(upstream_states: Set["state.State"]) -> bool:
    """
    Runs if all upstream tasks were successful and were not all skipped.

    Args:
        - upstream_states (set[State]): the set of all upstream states
    """

    if all(state.is_skipped() for state in upstream_states):
        raise signals.SKIP("All upstreams were skipped", result=None)
    elif not all(state.is_successful() for state in upstream_states):
        raise signals.TRIGGERFAIL(
            'Trigger was "not_all_skipped" but some of the upstream tasks failed.'
        )
    return True
                    "__version__": "0.11.5+59.gdba764390",
                    "result_handler": {
                        "dir": "/src",
                        "type": "LocalResultHandler",
                        "__version__": "0.11.5+59.gdba764390",
                    },
                }
            },
        },
    ],
)
def test_can_deserialize_old_no_result(old_json):
    schema = StateSchema()

    state = schema.load(old_json)
    assert state.is_successful()
=======
    def test_cached_inputs_are_serialized_correctly(self):
        s = state.Cached(
            message="test",
            result=results.PrefectResult(value=1, location="1"),
            cached_inputs=dict(
                x=results.PrefectResult(location='"foo"'),
                y=results.PrefectResult(location='"bar"'),
            ),
        )
        schema = StateSchema()
        serialized = schema.dump(s)

        assert serialized["cached_inputs"]["x"]["location"] == '"foo"'
        assert serialized["cached_inputs"]["y"]["location"] == '"bar"'
Exemple #3
0
def test_can_deserialize_old_no_result(old_json):
    schema = StateSchema()

    state = schema.load(old_json)
    assert state.is_successful()
Exemple #4
0
def _should_flatten(state: "State") -> bool:
    return state.is_successful() and not state.is_skipped()