python/ray/workflow/api.py
def step(*args, **kwargs):
    """A decorator used for creating workflow steps.

    Examples:
        >>> from ray import workflow
        >>> Flight, Hotel = ... # doctest: +SKIP
        >>> @workflow.step # doctest: +SKIP
        ... def book_flight(origin: str, dest: str) -> Flight: # doctest: +SKIP
        ...    return Flight(...) # doctest: +SKIP

        >>> @workflow.step(max_retries=3, catch_exceptions=True) # doctest: +SKIP
        ... def book_hotel(dest: str) -> Hotel: # doctest: +SKIP
        ...    return Hotel(...) # doctest: +SKIP

    """
    if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
        options = WorkflowStepRuntimeOptions.make(step_type=StepType.FUNCTION)
        return make_step_decorator(options)(args[0])
    if len(args) != 0:
        raise ValueError(f"Invalid arguments for step decorator {args}")
    max_retries = kwargs.pop("max_retries", None)
    catch_exceptions = kwargs.pop("catch_exceptions", None)
    name = kwargs.pop("name", None)
    metadata = kwargs.pop("metadata", None)
    allow_inplace = kwargs.pop("allow_inplace", False)
    checkpoint = kwargs.pop("checkpoint", None)
    ray_options = kwargs

    options = WorkflowStepRuntimeOptions.make(
        step_type=StepType.FUNCTION,
        catch_exceptions=catch_exceptions,
        max_retries=max_retries,
        allow_inplace=allow_inplace,
        checkpoint=checkpoint,
        ray_options=ray_options,
    )
    return make_step_decorator(options, name, metadata)
A decorator used for creating workflow steps.

    Examples:
        >>> from ray import workflow
        >>> Flight, Hotel = ... # doctest: +SKIP
        >>> @workflow.step # doctest: +SKIP
        ... def book_flight(origin: str, dest: str) -> Flight: # doctest: +SKIP
        ...    return Flight(...) # doctest: +SKIP

        >>> @workflow.step(max_retries=3, catch_exceptions=True) # doctest: +SKIP
        ... def book_hotel(dest: str) -> Hotel: # doctest: +SKIP
        ...    return Hotel(...) # doctest: +SKIP

    
A decorator used for creating workflow steps.
A decorator used for creating workflow steps .
def step(*args, **kwargs):
    if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
        options = WorkflowStepRuntimeOptions.make(step_type=StepType.FUNCTION)
        return make_step_decorator(options)(args[0])
    if len(args) != 0:
        raise ValueError(f"Invalid arguments for step decorator {args}")
    max_retries = kwargs.pop("max_retries", None)
    catch_exceptions = kwargs.pop("catch_exceptions", None)
    name = kwargs.pop("name", None)
    metadata = kwargs.pop("metadata", None)
    allow_inplace = kwargs.pop("allow_inplace", False)
    checkpoint = kwargs.pop("checkpoint", None)
    ray_options = kwargs
    options = WorkflowStepRuntimeOptions.make(
        step_type=StepType.FUNCTION,
        catch_exceptions=catch_exceptions,
        max_retries=max_retries,
        allow_inplace=allow_inplace,
        checkpoint=checkpoint,
        ray_options=ray_options,
    )
    return make_step_decorator(options, name, metadata)
def step ( * args , ** kwargs ) : if len ( args ) == 1 and len ( kwargs ) == 0 and callable ( args [ 0 ] ) : options = WorkflowStepRuntimeOptions . make ( step_type = StepType . FUNCTION ) return make_step_decorator ( options ) ( args [ 0 ] ) if len ( args ) != 0 : raise ValueError ( f"Invalid arguments for step decorator {args}" ) max_retries = kwargs . pop ( "max_retries" , None ) catch_exceptions = kwargs . pop ( "catch_exceptions" , None ) name = kwargs . pop ( "name" , None ) metadata = kwargs . pop ( "metadata" , None ) allow_inplace = kwargs . pop ( "allow_inplace" , False ) checkpoint = kwargs . pop ( "checkpoint" , None ) ray_options = kwargs options = WorkflowStepRuntimeOptions . make ( step_type = StepType . FUNCTION , catch_exceptions = catch_exceptions , max_retries = max_retries , allow_inplace = allow_inplace , checkpoint = checkpoint , ray_options = ray_options , ) return make_step_decorator ( options , name , metadata )
A decorator used for creating workflow steps.
A decorator used for creating workflow steps .
"""A decorator used for creating workflow steps.

    Examples:
        >>> from ray import workflow
        >>> Flight, Hotel = ... # doctest: +SKIP
        >>> @workflow.step # doctest: +SKIP
        ... def book_flight(origin: str, dest: str) -> Flight: # doctest: +SKIP
        ...    return Flight(...) # doctest: +SKIP

        >>> @workflow.step(max_retries=3, catch_exceptions=True) # doctest: +SKIP
        ... def book_hotel(dest: str) -> Hotel: # doctest: +SKIP
        ...    return Hotel(...) # doctest: +SKIP

    """
examples
>>> from ray import workflow
>>> Flight, Hotel = ... # doctest: +SKIP
>>> @workflow.step # doctest: +SKIP
def book_flight(origin: str, dest: str) -> Flight: # doctest: +SKIP
return Flight(...) # doctest: +SKIP

>>> @workflow.step(max_retries=3, catch_exceptions=True) # doctest: +SKIP
def book_hotel(dest: str) -> Hotel: # doctest: +SKIP
return Hotel(...) # doctest: +SKIP
>>> from ray import workflow >>> Flight Hotel = ... # doctest : + SKIP >>> @workflow . step # doctest : + SKIP def book_flight ( origin : str dest : str ) - > Flight : # doctest : + SKIP return Flight ( ... ) # doctest : + SKIP >>> @workflow . step ( max_retries = 3 catch_exceptions = True ) # doctest : + SKIP def book_hotel ( dest : str ) - > Hotel : # doctest : + SKIP return Hotel ( ... ) # doctest : + SKIP