def _resume_workflow_step_executor( job_id: str, workflow_id: str, step_id: "StepID", current_output: [ray.ObjectRef], ) -> Tuple[ray.ObjectRef, ray.ObjectRef]: with workflow_context.workflow_logging_context(job_id): # TODO (yic): We need better dependency management for virtual actor # The current output will always be empty for normal workflow # For virtual actor, if it's not empty, it means the previous job is # running. This is a really bad one. for ref in current_output: try: while isinstance(ref, ray.ObjectRef): ref = ray.get(ref) except Exception: pass try: r = _construct_resume_workflow_from_step(workflow_id, step_id) except Exception as e: raise WorkflowNotResumableError(workflow_id) from e if not isinstance(r, Workflow): return r, None with workflow_context.workflow_step_context( workflow_id, last_step_of_workflow=True): from ray.workflow.step_executor import execute_workflow result = execute_workflow(job_id, r) return result.persisted_output, result.volatile_output
def resume_workflow_step( job_id: str, workflow_id: str, task_id: Optional[TaskID] = None, ) -> WorkflowExecutionState: """Resume a step of a workflow. Args: job_id: The ID of the job that submits the workflow execution. The ID is used to identify the submitter of the workflow. workflow_id: The ID of the workflow job. The ID is used to identify the workflow. task_id: The step to resume in the workflow. Raises: WorkflowNotResumableException: fail to resume the workflow. Returns: The execution result of the workflow, represented by Ray ObjectRef. """ with workflow_context.workflow_logging_context(job_id): try: return workflow_state_from_storage.workflow_state_from_storage( workflow_id, task_id ) except Exception as e: raise WorkflowNotResumableError(workflow_id) from e
def _workflow_step_executor_remote( func: Callable, context: "WorkflowStepContext", job_id: str, task_id: "TaskID", baked_inputs: "_BakedWorkflowInputs", runtime_options: "WorkflowStepRuntimeOptions", ) -> Any: """The remote version of '_workflow_step_executor'.""" with workflow_context.workflow_logging_context(job_id): return _workflow_step_executor(func, context, task_id, baked_inputs, runtime_options)