Пример #1
0
def _make_workflow_step_function(node: FunctionNode):
    from ray.workflow.step_function import WorkflowStepFunction

    bound_options = node._bound_options.copy()
    workflow_options = bound_options.pop("_metadata",
                                         {}).get(WORKFLOW_OPTIONS, {})
    # "_resolve_like_object_ref_in_args" indicates we should resolve the
    # workflow like an ObjectRef, when included in the arguments of
    # another workflow.
    bound_options["_resolve_like_object_ref_in_args"] = True
    step_options = WorkflowStepRuntimeOptions.make(
        step_type=StepType.FUNCTION,
        catch_exceptions=workflow_options.get("catch_exceptions", None),
        max_retries=workflow_options.get("max_retries", None),
        allow_inplace=workflow_options.get("allow_inplace", False),
        checkpoint=workflow_options.get("checkpoint", None),
        ray_options=bound_options,
    )

    return WorkflowStepFunction(
        node._body,
        step_options=step_options,
        name=workflow_options.get("name", None),
        metadata=workflow_options.pop("metadata", None),
    )
Пример #2
0
 def decorator(func):
     return WorkflowStepFunction(func,
                                 step_options=step_options,
                                 name=name,
                                 metadata=metadata)
Пример #3
0
 def decorator(func):
     return WorkflowStepFunction(func, **step_options)