org.apache.spark

TaskContext

abstract class TaskContext extends Serializable

Contextual information about a task which can be read or mutated during execution. To access the TaskContext for a running task, use:

org.apache.spark.TaskContext.get()
Source
TaskContext.scala
Linear Supertypes
Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. TaskContext
  2. Serializable
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new TaskContext()

Abstract Value Members

  1. abstract def addTaskCompletionListener(listener: TaskCompletionListener): TaskContext

    Adds a (Java friendly) listener to be executed on task completion.

    Adds a (Java friendly) listener to be executed on task completion. This will be called in all situation - success, failure, or cancellation. An example use is for HadoopRDD to register a callback to close the input stream.

    Exceptions thrown by the listener will result in failure of the task.

  2. abstract def addTaskFailureListener(listener: TaskFailureListener): TaskContext

    Adds a listener to be executed on task failure.

    Adds a listener to be executed on task failure. Operations defined here must be idempotent, as onTaskFailure can be called multiple times.

  3. abstract def attemptNumber(): Int

    How many times this task has been attempted.

    How many times this task has been attempted. The first task attempt will be assigned attemptNumber = 0, and subsequent attempts will have increasing attempt numbers.

  4. abstract def getMetricsSources(sourceName: String): Seq[Source]

    ::DeveloperApi:: Returns all metrics sources with the given name which are associated with the instance which runs the task.

    ::DeveloperApi:: Returns all metrics sources with the given name which are associated with the instance which runs the task. For more information see org.apache.spark.metrics.MetricsSystem!.

    Annotations
    @DeveloperApi()
  5. abstract def isCompleted(): Boolean

    Returns true if the task has completed.

  6. abstract def isInterrupted(): Boolean

    Returns true if the task has been killed.

  7. abstract def isRunningLocally(): Boolean

    Returns true if the task is running locally in the driver program.

    Returns true if the task is running locally in the driver program.

    returns

  8. abstract def partitionId(): Int

    The ID of the RDD partition that is computed by this task.

  9. abstract def stageId(): Int

    The ID of the stage that this task belong to.

  10. abstract def taskAttemptId(): Long

    An ID that is unique to this task attempt (within the same SparkContext, no two task attempts will share the same attempt ID).

    An ID that is unique to this task attempt (within the same SparkContext, no two task attempts will share the same attempt ID). This is roughly equivalent to Hadoop's TaskAttemptID.

  11. abstract def taskMetrics(): TaskMetrics

    ::DeveloperApi::

    ::DeveloperApi::

    Annotations
    @DeveloperApi()
  12. abstract def addOnCompleteCallback(f: () ⇒ Unit): Unit

    Adds a callback function to be executed on task completion.

    Adds a callback function to be executed on task completion. An example use is for HadoopRDD to register a callback to close the input stream. Will be called in any situation - success, failure, or cancellation.

    f

    Callback function.

    Annotations
    @deprecated
    Deprecated

    (Since version 1.2.0) use addTaskCompletionListener

  13. abstract def attemptId(): Long

    Annotations
    @deprecated
    Deprecated

    (Since version 1.3.0) use attemptNumber

  14. abstract def runningLocally(): Boolean

    Annotations
    @deprecated
    Deprecated

    (Since version 1.2.0) use isRunningLocally

Concrete Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def addTaskCompletionListener(f: (TaskContext) ⇒ Unit): TaskContext

    Adds a listener in the form of a Scala closure to be executed on task completion.

    Adds a listener in the form of a Scala closure to be executed on task completion. This will be called in all situations - success, failure, or cancellation. An example use is for HadoopRDD to register a callback to close the input stream.

    Exceptions thrown by the listener will result in failure of the task.

  7. def addTaskFailureListener(f: (TaskContext, Throwable) ⇒ Unit): TaskContext

    Adds a listener to be executed on task failure.

    Adds a listener to be executed on task failure. Operations defined here must be idempotent, as onTaskFailure can be called multiple times.

  8. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  9. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  14. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  15. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  19. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  20. def toString(): String

    Definition Classes
    AnyRef → Any
  21. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped