code: def runnable_by_pipeline(run_func):
      """A convenient Decorator
  
      This is a decorator designed to annotate, during pipeline session,
      the methods that downstream managed to
          1. preprocess user inputs, outputs, and configurations
          2. generate the create request
          3. start the job.
      For instance, `Processor.run`, `Estimator.fit`, or `Transformer.transform`.
      This decorator will essentially run 1, and capture the request shape from 2,
      then instead of starting a new job in 3, it will return request shape from 2
      to `sagemaker.workflow.steps.Step`. The request shape will be used to construct
      the arguments needed to compose that particular step as part of the pipeline.
      The job will be started during pipeline execution.
      """
  
      @wraps(run_func)
      def wrapper(*args, **kwargs):
          self_instance = args[0]
          if isinstance(
              self_instance.sagemaker_session, PipelineSession
          ):
              run_func_params = inspect.signature(run_func).parameters
              arg_list = list(args)
  
              override_wait, override_logs = False, False
              for i, (arg_name, _) in enumerate(
                  run_func_params.items()
              ):
                  if i >= len(arg_list):
                      break
                  if arg_name == "wait":
                      override_wait = True
                      arg_list[i] = False
                  elif arg_name == "logs":
                      override_logs = True
                      arg_list[i] = False
  
              args = tuple(arg_list)
  
              if not override_wait and "wait" in run_func_params.keys():
                  kwargs["wait"] = False
              if not override_logs and "logs" in run_func_params.keys():
                  kwargs["logs"] = False
  
              warnings.warn(
                  "Running within a PipelineSession, there will be No Wait, "
                  "No Logs, and No Job being started.",
                  UserWarning,
              )
              if run_func.__name__ in ["register", "create"]:
                  self_instance.sagemaker_session.init_model_step_arguments(
                      self_instance
                  )
                  run_func(*args, **kwargs)
                  context = self_instance.sagemaker_session.context
                  self_instance.sagemaker_session.context = None
                  return context
  
              return _StepArguments(
                  retrieve_caller_name(self_instance),
                  run_func,
                  *args,
                  **kwargs,
              )
  
          return run_func(*args, **kwargs)
  
      return wrapper
  
imports: from __future__ import absolute_import
  import warnings
  import inspect
  from functools import wraps
  from typing import Dict, Optional, Callable
  from sagemaker.session import Session, SessionSettings
  from sagemaker.local import LocalSession
  from sagemaker.workflow.pipeline_definition_config import PipelineDefinitionConfig
label_desc: Use image node_id 1 for calling a global function with example usage: runnable_by_pipeline(run_func) and returns: wrapper, run_func, _StepArguments, context