python/ray/workflow/common.py
def run(
        self,
        workflow_id: Optional[str] = None,
        metadata: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Run a workflow.

        If the workflow with the given id already exists, it will be resumed.

        Examples:
            >>> from ray import workflow
            >>> Flight, Reservation, Trip = ... # doctest: +SKIP
            >>> @workflow.step # doctest: +SKIP
            ... def book_flight(origin: str, dest: str) -> Flight: # doctest: +SKIP
            ...    return Flight(...) # doctest: +SKIP
            >>> @workflow.step # doctest: +SKIP
            ... def book_hotel(location: str) -> Reservation: # doctest: +SKIP
            ...    return Reservation(...) # doctest: +SKIP
            >>> @workflow.step # doctest: +SKIP
            ... def finalize_trip(bookings: List[Any]) -> Trip: # doctest: +SKIP
            ...    return Trip(...) # doctest: +SKIP

            >>> flight1 = book_flight.step("OAK", "SAN") # doctest: +SKIP
            >>> flight2 = book_flight.step("SAN", "OAK") # doctest: +SKIP
            >>> hotel = book_hotel.step("SAN") # doctest: +SKIP
            >>> trip = finalize_trip.step([flight1, flight2, hotel]) # doctest: +SKIP
            >>> result = trip.run() # doctest: +SKIP

        Args:
            workflow_id: A unique identifier that can be used to resume the
                workflow. If not specified, a random id will be generated.
            metadata: The metadata to add to the workflow. It has to be able
                to serialize to json.

        Returns:
            The running result.
        """
        return ray.get(self.run_async(workflow_id, metadata))
Run a workflow.

        If the workflow with the given id already exists, it will be resumed.

        Examples:
            >>> from ray import workflow
            >>> Flight, Reservation, Trip = ... # doctest: +SKIP
            >>> @workflow.step # doctest: +SKIP
            ... def book_flight(origin: str, dest: str) -> Flight: # doctest: +SKIP
            ...    return Flight(...) # doctest: +SKIP
            >>> @workflow.step # doctest: +SKIP
            ... def book_hotel(location: str) -> Reservation: # doctest: +SKIP
            ...    return Reservation(...) # doctest: +SKIP
            >>> @workflow.step # doctest: +SKIP
            ... def finalize_trip(bookings: List[Any]) -> Trip: # doctest: +SKIP
            ...    return Trip(...) # doctest: +SKIP

            >>> flight1 = book_flight.step("OAK", "SAN") # doctest: +SKIP
            >>> flight2 = book_flight.step("SAN", "OAK") # doctest: +SKIP
            >>> hotel = book_hotel.step("SAN") # doctest: +SKIP
            >>> trip = finalize_trip.step([flight1, flight2, hotel]) # doctest: +SKIP
            >>> result = trip.run() # doctest: +SKIP

        Args:
            workflow_id: A unique identifier that can be used to resume the
                workflow. If not specified, a random id will be generated.
            metadata: The metadata to add to the workflow. It has to be able
                to serialize to json.

        Returns:
            The running result.
        
Run a workflow.
If the workflow with the given id already exists, it will be resumed.
Run a workflow . If the workflow with the given id already exists it will be resumed .
def run(
        self,
        workflow_id: Optional[str] = None,
        metadata: Optional[Dict[str, Any]] = None,
    ) -> Any:
        return ray.get(self.run_async(workflow_id, metadata))
def run ( self , workflow_id : Optional [ str ] = None , metadata : Optional [ Dict [ str , Any ] ] = None , ) -> Any : return ray . get ( self . run_async ( workflow_id , metadata ) )
Run a workflow.
Run a workflow .
"""Run a workflow.

        If the workflow with the given id already exists, it will be resumed.

        Examples:
            >>> from ray import workflow
            >>> Flight, Reservation, Trip = ... # doctest: +SKIP
            >>> @workflow.step # doctest: +SKIP
            ... def book_flight(origin: str, dest: str) -> Flight: # doctest: +SKIP
            ...    return Flight(...) # doctest: +SKIP
            >>> @workflow.step # doctest: +SKIP
            ... def book_hotel(location: str) -> Reservation: # doctest: +SKIP
            ...    return Reservation(...) # doctest: +SKIP
            >>> @workflow.step # doctest: +SKIP
            ... def finalize_trip(bookings: List[Any]) -> Trip: # doctest: +SKIP
            ...    return Trip(...) # doctest: +SKIP

            >>> flight1 = book_flight.step("OAK", "SAN") # doctest: +SKIP
            >>> flight2 = book_flight.step("SAN", "OAK") # doctest: +SKIP
            >>> hotel = book_hotel.step("SAN") # doctest: +SKIP
            >>> trip = finalize_trip.step([flight1, flight2, hotel]) # doctest: +SKIP
            >>> result = trip.run() # doctest: +SKIP

        Args:
            workflow_id: A unique identifier that can be used to resume the
                workflow. If not specified, a random id will be generated.
            metadata: The metadata to add to the workflow. It has to be able
                to serialize to json.

        Returns:
            The running result.
        """
The running result.
The running result .
self
workflow_id
Optional[str]
A unique identifier that can be used to resume the
workflow. If not specified, a random id will be generated.
A unique identifier that can be used to resume the workflow . If not specified a random id will be generated .
metadata
Optional[Dict[str, Any]]
The metadata to add to the workflow.
The metadata to add to the workflow .
examples
>>> from ray import workflow
>>> Flight, Reservation, Trip = ... # doctest: +SKIP
>>> @workflow.step # doctest: +SKIP
def book_flight(origin: str, dest: str) -> Flight: # doctest: +SKIP
return Flight(...) # doctest: +SKIP
>>> @workflow.step # doctest: +SKIP
def book_hotel(location: str) -> Reservation: # doctest: +SKIP
return Reservation(...) # doctest: +SKIP
>>> @workflow.step # doctest: +SKIP
def finalize_trip(bookings: List[Any]) -> Trip: # doctest: +SKIP
return Trip(...) # doctest: +SKIP

>>> flight1 = book_flight.step("OAK", "SAN") # doctest: +SKIP
>>> flight2 = book_flight.step("SAN", "OAK") # doctest: +SKIP
>>> hotel = book_hotel.step("SAN") # doctest: +SKIP
>>> trip = finalize_trip.step([flight1, flight2, hotel]) # doctest: +SKIP
>>> result = trip.run() # doctest: +SKIP
>>> from ray import workflow >>> Flight Reservation Trip = ... # doctest : + SKIP >>> @workflow . step # doctest : + SKIP def book_flight ( origin : str dest : str ) - > Flight : # doctest : + SKIP return Flight ( ... ) # doctest : + SKIP >>> @workflow . step # doctest : + SKIP def book_hotel ( location : str ) - > Reservation : # doctest : + SKIP return Reservation ( ... ) # doctest : + SKIP >>> @workflow . step # doctest : + SKIP def finalize_trip ( bookings : List [ Any ] ) - > Trip : # doctest : + SKIP return Trip ( ... ) # doctest : + SKIP >>> flight1 = book_flight . step ( " OAK " " SAN " ) # doctest : + SKIP >>> flight2 = book_flight . step ( " SAN " " OAK " ) # doctest : + SKIP >>> hotel = book_hotel . step ( " SAN " ) # doctest : + SKIP >>> trip = finalize_trip . step ( [ flight1 flight2 hotel ] ) # doctest : + SKIP >>> result = trip . run () # doctest : + SKIP