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

        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 = ray.get(trip.run_async()) # 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 as ray.ObjectRef.

        """
        # TODO(suquark): avoid cyclic importing
        from ray.workflow.execution import run

        self._step_id = None
        return run(self, workflow_id, metadata)
Run a workflow asynchronously.

        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 = ray.get(trip.run_async()) # 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 as ray.ObjectRef.

        
Run a workflow asynchronously.
If the workflow with the given id already exists, it will be resumed.
Run a workflow asynchronously . If the workflow with the given id already exists it will be resumed .
def run_async(
        self,
        workflow_id: Optional[str] = None,
        metadata: Optional[Dict[str, Any]] = None,
    ) -> ObjectRef:
        from ray.workflow.execution import run
        self._step_id = None
        return run(self, workflow_id, metadata)
def run_async ( self , workflow_id : Optional [ str ] = None , metadata : Optional [ Dict [ str , Any ] ] = None , ) -> ObjectRef : from ray . workflow . execution import run self . _step_id = None return run ( self , workflow_id , metadata )
Run a workflow asynchronously.
Run a workflow asynchronously .
"""Run a workflow asynchronously.

        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 = ray.get(trip.run_async()) # 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 as ray.ObjectRef.

        """ # TODO(suquark): avoid cyclic importing
The running result as ray.ObjectRef.
The running result as ray . ObjectRef .
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 = ray.get(trip.run_async()) # 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 = ray . get ( trip . run_async () ) # doctest : + SKIP