Ejemplo n.º 1
0
    def get_result(self, state: prefect.engine.state.State, flow: Flow) -> Any:
        """
        Get the result of this step.

        Parameters
        ----------
        state: prefect.engine.state.State
            The final state object of a prefect flow produced by running the flow.
        flow: prefect.core.flow.Flow
            The flow that ran this step.

        Returns
        -------
        result: Any
            The resulting object from running this step in a flow.

        Notes
        -----
        This will always return the first item that matches this step.
        What this means for the user is that if this step was used in a mapped task,
        you would only recieve the result of the first iteration of that map.

        Generally though, you shouldn't be using these steps in mapped tasks.
        (It's on our to-do list...)
        """
        return state.result[flow.get_tasks(name=self.step_name)[0]].result