class_docstr: Implementation of Kubernetes Task Scheduler.
class_docstr_tok: ["Implementation","of","Kubernetes","Task","Scheduler","."]
docstr: Retreive Executable Spec and Execution Info for run.
docstr_tok: ["Retreive","Executable","Spec","and","Execution","Info","for","run","."]
code: def schedule(self) -> task_scheduler.TaskSchedulerResult:
      """Retreive Executable Spec and Execution Info for run."""
      depl_config = pipeline_pb2.IntermediateDeploymentConfig()
      self.pipeline.deployment_config.Unpack(depl_config)
      executor_spec_any = depl_config.executor_specs.get(
          self.task.node_uid.node_id
      )
  
      if not executor_spec_any:
          return task_scheduler.TaskSchedulerResult(
              status=status_lib.Status(
                  code=status_lib.Code.INVALID_ARGUMENT,
                  message="Unknown executable spec type.",
              )
          )
  
      if executor_spec_any.Is(
          executable_spec_pb2.PythonClassExecutableSpec.DESCRIPTOR
      ):
          executable_spec = (
              executable_spec_pb2.PythonClassExecutableSpec()
          )
          executor_spec_any.Unpack(executable_spec)
      elif executor_spec_any.Is(
          executable_spec_pb2.BeamExecutableSpec.DESCRIPTOR
      ):
          executable_spec = executable_spec_pb2.BeamExecutableSpec()
          executor_spec_any.Unpack(executable_spec)
      else:
          return task_scheduler.TaskSchedulerResult(
              status=status_lib.Status(
                  code=status_lib.Code.INVALID_ARGUMENT,
                  message="Unknown executable spec type.",
              )
          )
  
      node = _get_pipeline_node(
          self.pipeline, self.task.node_uid.node_id
      )
      execution_invocation = _create_execution_invocation_proto(
          self.pipeline, self.task, node
      )
      execution_info = data_types.ExecutionInfo.from_proto(
          execution_invocation
      )
  
      return self._runner.run(execution_info, executable_spec)
  
file_path: tfx/tfx/orchestration/experimental/centralized_kubernetes_orchestrator/kubernetes_task_scheduler.py
imports: import threading
  from tfx.orchestration import data_types_utils
  from tfx.orchestration import metadata
  from tfx.orchestration.experimental.centralized_kubernetes_orchestrator import kubernetes_job_runner
  from tfx.orchestration.experimental.core import task
  from tfx.orchestration.experimental.core import task_scheduler
  from tfx.orchestration.portable import data_types
  from tfx.proto.orchestration import executable_spec_pb2
  from tfx.proto.orchestration import execution_invocation_pb2
  from tfx.proto.orchestration import pipeline_pb2
  from tfx.utils import status
label_desc: Use image node_id 2 for calling the KubernetesTaskScheduler obj's underlying member method code with example usage: obj.schedule() and returns: self, task_scheduler, task_scheduler