class_docstr: Interface for task schedulers.
class_docstr_tok: ["Interface","for","task","schedulers","."]
docstr: Cancels task scheduler.
  
  This method will be invoked from a different thread than the thread that's
  blocked on call to `schedule`. `cancel` must be non-blocking.
  Upon cancellation, `schedule` method is expected to stop any ongoing work,
  clean up and return as soon as possible. It's technically possible for
  `cancel` to be invoked before `schedule`; scheduler implementations should
  handle this case by returning from `schedule` immediately.
  
  Args:
    cancel_task: The task of this cancellation.
docstr_tok: ["Cancels","task","scheduler",".","This","method","will","be","invoked","from","a","different","thread","than","the","thread","that's","blocked","on","call","to","`","schedule","`",".","`","cancel","`","must","be","non-blocking",".","Upon","cancellation",",","`","schedule","`","method","is","expected","to","stop","any","ongoing","work",",","clean","up","and","return","as","soon","as","possible",".","It","'s","technically","possible","for","`","cancel","`","to","be","invoked","before","`","schedule","`",";","scheduler","implementations","should","handle","this","case","by","returning","from","`","schedule","`","immediately",".","Args",":","cancel_task",":","The","task","of","this","cancellation","."]
code: def cancel(self, cancel_task: task_lib.CancelTask) -> None:
      """Cancels task scheduler.
  
      This method will be invoked from a different thread than the thread that's
      blocked on call to `schedule`. `cancel` must be non-blocking.
      Upon cancellation, `schedule` method is expected to stop any ongoing work,
      clean up and return as soon as possible. It's technically possible for
      `cancel` to be invoked before `schedule`; scheduler implementations should
      handle this case by returning from `schedule` immediately.
  
      Args:
        cancel_task: The task of this cancellation.
      """
  
imports: import abc
  from typing import Callable, Dict, Generic, List, Optional, Type, TypeVar, Union
  import attr
  from tfx import types
  from tfx.orchestration import metadata
  from tfx.orchestration.experimental.core import task
  from tfx.proto.orchestration import execution_result_pb2
  from tfx.proto.orchestration import pipeline_pb2
  from tfx.utils import status
label_desc: Use image node_id 3 for calling the TaskScheduler obj's underlying member method code with example usage: obj.cancel(cancel_task) without return types