Class/Object

org.apache.spark

TaskContext

Related Docs: object TaskContext | package spark

Permalink

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
Visibility
  1. Public
  2. All

Instance Constructors

  1. new TaskContext()

    Permalink

Abstract Value Members

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

    Permalink

    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

    Permalink

    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

    Permalink

    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 getLocalProperty(key: String): String

    Permalink

    Get a local property set upstream in the driver, or null if it is missing.

    Get a local property set upstream in the driver, or null if it is missing. See also org.apache.spark.SparkContext.setLocalProperty.

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

    Permalink

    ::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()
  6. abstract def isCompleted(): Boolean

    Permalink

    Returns true if the task has completed.

  7. abstract def isInterrupted(): Boolean

    Permalink

    Returns true if the task has been killed.

  8. abstract def partitionId(): Int

    Permalink

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

  9. abstract def stageId(): Int

    Permalink

    The ID of the stage that this task belong to.

  10. abstract def taskAttemptId(): Long

    Permalink

    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

    Permalink
    Annotations
    @DeveloperApi()
  12. abstract def isRunningLocally(): Boolean

    Permalink

    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

    false

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) Local execution was removed, so this always returns false

Concrete Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. def addTaskCompletionListener(f: (TaskContext) ⇒ Unit): TaskContext

    Permalink

    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.

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

    Permalink

    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.

  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def clone(): AnyRef

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
  15. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  16. final def notifyAll(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  18. def toString(): String

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped