blob: 66edd4659181304c5bc43d7c3567bb87776fe2f3 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_312) on Mon Jul 11 16:23:57 UTC 2022 -->
<title>BarrierTaskContext (Spark 3.2.2 JavaDoc)</title>
<meta name="date" content="2022-07-11">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="BarrierTaskContext (Spark 3.2.2 JavaDoc)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":9,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../org/apache/spark/BarrierCoordinatorMessage.html" title="interface in org.apache.spark"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../org/apache/spark/BarrierTaskInfo.html" title="class in org.apache.spark"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/apache/spark/BarrierTaskContext.html" target="_top">Frames</a></li>
<li><a href="BarrierTaskContext.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.spark</div>
<h2 title="Class BarrierTaskContext" class="title">Class BarrierTaskContext</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>Object</li>
<li>
<ul class="inheritance">
<li><a href="../../../org/apache/spark/TaskContext.html" title="class in org.apache.spark">org.apache.spark.TaskContext</a></li>
<li>
<ul class="inheritance">
<li>org.apache.spark.BarrierTaskContext</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd>java.io.Serializable, org.apache.spark.internal.Logging</dd>
</dl>
<hr>
<br>
<pre>public class <span class="typeNameLabel">BarrierTaskContext</span>
extends <a href="../../../org/apache/spark/TaskContext.html" title="class in org.apache.spark">TaskContext</a>
implements org.apache.spark.internal.Logging</pre>
<div class="block">:: Experimental ::
A <a href="../../../org/apache/spark/TaskContext.html" title="class in org.apache.spark"><code>TaskContext</code></a> with extra contextual info and tooling for tasks in a barrier stage.
Use <a href="../../../org/apache/spark/BarrierTaskContext.html#get--"><code>get()</code></a> to obtain the barrier context for a running barrier task.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../serialized-form.html#org.apache.spark.BarrierTaskContext">Serialized Form</a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code><a href="../../../org/apache/spark/BarrierTaskContext.html" title="class in org.apache.spark">BarrierTaskContext</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/spark/BarrierTaskContext.html#addTaskCompletionListener-org.apache.spark.util.TaskCompletionListener-">addTaskCompletionListener</a></span>(<a href="../../../org/apache/spark/util/TaskCompletionListener.html" title="interface in org.apache.spark.util">TaskCompletionListener</a>&nbsp;listener)</code>
<div class="block">Adds a (Java friendly) listener to be executed on task completion.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code><a href="../../../org/apache/spark/BarrierTaskContext.html" title="class in org.apache.spark">BarrierTaskContext</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/spark/BarrierTaskContext.html#addTaskFailureListener-org.apache.spark.util.TaskFailureListener-">addTaskFailureListener</a></span>(<a href="../../../org/apache/spark/util/TaskFailureListener.html" title="interface in org.apache.spark.util">TaskFailureListener</a>&nbsp;listener)</code>
<div class="block">Adds a listener to be executed on task failure.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>String[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/spark/BarrierTaskContext.html#allGather-java.lang.String-">allGather</a></span>(String&nbsp;message)</code>
<div class="block">:: Experimental ::
Blocks until all tasks in the same stage have reached this routine.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/spark/BarrierTaskContext.html#attemptNumber--">attemptNumber</a></span>()</code>
<div class="block">How many times this task has been attempted.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/spark/BarrierTaskContext.html#barrier--">barrier</a></span>()</code>
<div class="block">:: Experimental ::
Sets a global barrier and waits until all tasks in this stage hit this barrier.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>static <a href="../../../org/apache/spark/BarrierTaskContext.html" title="class in org.apache.spark">BarrierTaskContext</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/spark/BarrierTaskContext.html#get--">get</a></span>()</code>
<div class="block">:: Experimental ::
Returns the currently active BarrierTaskContext.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/spark/BarrierTaskContext.html#getLocalProperty-java.lang.String-">getLocalProperty</a></span>(String&nbsp;key)</code>
<div class="block">Get a local property set upstream in the driver, or null if it is missing.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>scala.collection.Seq&lt;<a href="../../../org/apache/spark/metrics/source/Source.html" title="interface in org.apache.spark.metrics.source">Source</a>&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/spark/BarrierTaskContext.html#getMetricsSources-java.lang.String-">getMetricsSources</a></span>(String&nbsp;sourceName)</code>
<div class="block">::DeveloperApi::
Returns all metrics sources with the given name which are associated with the instance
which runs the task.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code><a href="../../../org/apache/spark/BarrierTaskInfo.html" title="class in org.apache.spark">BarrierTaskInfo</a>[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/spark/BarrierTaskContext.html#getTaskInfos--">getTaskInfos</a></span>()</code>
<div class="block">:: Experimental ::
Returns <a href="../../../org/apache/spark/BarrierTaskInfo.html" title="class in org.apache.spark"><code>BarrierTaskInfo</code></a> for all tasks in this barrier stage, ordered by partition ID.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/spark/BarrierTaskContext.html#isCompleted--">isCompleted</a></span>()</code>
<div class="block">Returns true if the task has completed.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/spark/BarrierTaskContext.html#isInterrupted--">isInterrupted</a></span>()</code>
<div class="block">Returns true if the task has been killed.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/spark/BarrierTaskContext.html#partitionId--">partitionId</a></span>()</code>
<div class="block">The ID of the RDD partition that is computed by this task.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>scala.collection.immutable.Map&lt;String,<a href="../../../org/apache/spark/resource/ResourceInformation.html" title="class in org.apache.spark.resource">ResourceInformation</a>&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/spark/BarrierTaskContext.html#resources--">resources</a></span>()</code>
<div class="block">Resources allocated to the task.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>java.util.Map&lt;String,<a href="../../../org/apache/spark/resource/ResourceInformation.html" title="class in org.apache.spark.resource">ResourceInformation</a>&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/spark/BarrierTaskContext.html#resourcesJMap--">resourcesJMap</a></span>()</code>
<div class="block">(java-specific) Resources allocated to the task.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/spark/BarrierTaskContext.html#stageAttemptNumber--">stageAttemptNumber</a></span>()</code>
<div class="block">How many times the stage that this task belongs to has been attempted.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/spark/BarrierTaskContext.html#stageId--">stageId</a></span>()</code>
<div class="block">The ID of the stage that this task belong to.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/spark/BarrierTaskContext.html#taskAttemptId--">taskAttemptId</a></span>()</code>
<div class="block">An ID that is unique to this task attempt (within the same SparkContext, no two task attempts
will share the same attempt ID).</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>org.apache.spark.executor.TaskMetrics</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/spark/BarrierTaskContext.html#taskMetrics--">taskMetrics</a></span>()</code>&nbsp;</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.org.apache.spark.TaskContext">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;org.apache.spark.<a href="../../../org/apache/spark/TaskContext.html" title="class in org.apache.spark">TaskContext</a></h3>
<code><a href="../../../org/apache/spark/TaskContext.html#addTaskCompletionListener-scala.Function1-">addTaskCompletionListener</a>, <a href="../../../org/apache/spark/TaskContext.html#addTaskFailureListener-scala.Function2-">addTaskFailureListener</a>, <a href="../../../org/apache/spark/TaskContext.html#getPartitionId--">getPartitionId</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;Object</h3>
<code>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.org.apache.spark.internal.Logging">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;org.apache.spark.internal.Logging</h3>
<code>$init$, initializeForcefully, initializeLogIfNecessary, initializeLogIfNecessary, initializeLogIfNecessary$default$2, initLock, isTraceEnabled, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning, org$apache$spark$internal$Logging$$log__$eq, org$apache$spark$internal$Logging$$log_, uninitialize</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="get--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>get</h4>
<pre>public static&nbsp;<a href="../../../org/apache/spark/BarrierTaskContext.html" title="class in org.apache.spark">BarrierTaskContext</a>&nbsp;get()</pre>
<div class="block">:: Experimental ::
Returns the currently active BarrierTaskContext. This can be called inside of user functions to
access contextual information about running barrier tasks.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>(undocumented)</dd>
</dl>
</li>
</ul>
<a name="barrier--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>barrier</h4>
<pre>public&nbsp;void&nbsp;barrier()</pre>
<div class="block">:: Experimental ::
Sets a global barrier and waits until all tasks in this stage hit this barrier. Similar to
MPI_Barrier function in MPI, the barrier() function call blocks until all tasks in the same
stage have reached this routine.
<p>
CAUTION! In a barrier stage, each task must have the same number of barrier() calls, in all
possible code branches. Otherwise, you may get the job hanging or a SparkException after
timeout. Some examples of '''misuses''' are listed below:
1. Only call barrier() function on a subset of all the tasks in the same barrier stage, it
shall lead to timeout of the function call.
<pre><code>
rdd.barrier().mapPartitions { iter =&gt;
val context = BarrierTaskContext.get()
if (context.partitionId() == 0) {
// Do nothing.
} else {
context.barrier()
}
iter
}
</code></pre>
<p>
2. Include barrier() function in a try-catch code block, this may lead to timeout of the
second function call.
<pre><code>
rdd.barrier().mapPartitions { iter =&gt;
val context = BarrierTaskContext.get()
try {
// Do something that might throw an Exception.
doSomething()
context.barrier()
} catch {
case e: Exception =&gt; logWarning("...", e)
}
context.barrier()
iter
}
</code></pre></div>
</li>
</ul>
<a name="allGather-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>allGather</h4>
<pre>public&nbsp;String[]&nbsp;allGather(String&nbsp;message)</pre>
<div class="block">:: Experimental ::
Blocks until all tasks in the same stage have reached this routine. Each task passes in
a message and returns with a list of all the messages passed in by each of those tasks.
<p>
CAUTION! The allGather method requires the same precautions as the barrier method
<p>
The message is type String rather than Array[Byte] because it is more convenient for
the user at the cost of worse performance.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>message</code> - (undocumented)</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>(undocumented)</dd>
</dl>
</li>
</ul>
<a name="getTaskInfos--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTaskInfos</h4>
<pre>public&nbsp;<a href="../../../org/apache/spark/BarrierTaskInfo.html" title="class in org.apache.spark">BarrierTaskInfo</a>[]&nbsp;getTaskInfos()</pre>
<div class="block">:: Experimental ::
Returns <a href="../../../org/apache/spark/BarrierTaskInfo.html" title="class in org.apache.spark"><code>BarrierTaskInfo</code></a> for all tasks in this barrier stage, ordered by partition ID.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>(undocumented)</dd>
</dl>
</li>
</ul>
<a name="isCompleted--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isCompleted</h4>
<pre>public&nbsp;boolean&nbsp;isCompleted()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html#isCompleted--">TaskContext</a></code></span></div>
<div class="block">Returns true if the task has completed.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../org/apache/spark/TaskContext.html#isCompleted--">isCompleted</a></code>&nbsp;in class&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html" title="class in org.apache.spark">TaskContext</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>(undocumented)</dd>
</dl>
</li>
</ul>
<a name="isInterrupted--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isInterrupted</h4>
<pre>public&nbsp;boolean&nbsp;isInterrupted()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html#isInterrupted--">TaskContext</a></code></span></div>
<div class="block">Returns true if the task has been killed.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../org/apache/spark/TaskContext.html#isInterrupted--">isInterrupted</a></code>&nbsp;in class&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html" title="class in org.apache.spark">TaskContext</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>(undocumented)</dd>
</dl>
</li>
</ul>
<a name="addTaskCompletionListener-org.apache.spark.util.TaskCompletionListener-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addTaskCompletionListener</h4>
<pre>public&nbsp;<a href="../../../org/apache/spark/BarrierTaskContext.html" title="class in org.apache.spark">BarrierTaskContext</a>&nbsp;addTaskCompletionListener(<a href="../../../org/apache/spark/util/TaskCompletionListener.html" title="interface in org.apache.spark.util">TaskCompletionListener</a>&nbsp;listener)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html#addTaskCompletionListener-org.apache.spark.util.TaskCompletionListener-">TaskContext</a></code></span></div>
<div class="block">Adds a (Java friendly) listener to be executed on task completion.
This will be called in all situations - success, failure, or cancellation. Adding a listener
to an already completed task will result in that listener being called immediately.
<p>
Two listeners registered in the same thread will be invoked in reverse order of registration if
the task completes after both are registered. There are no ordering guarantees for listeners
registered in different threads, or for listeners registered after the task completes.
Listeners are guaranteed to execute sequentially.
<p>
An example use is for HadoopRDD to register a callback to close the input stream.
<p>
Exceptions thrown by the listener will result in failure of the task.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../org/apache/spark/TaskContext.html#addTaskCompletionListener-org.apache.spark.util.TaskCompletionListener-">addTaskCompletionListener</a></code>&nbsp;in class&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html" title="class in org.apache.spark">TaskContext</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>listener</code> - (undocumented)</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>(undocumented)</dd>
</dl>
</li>
</ul>
<a name="addTaskFailureListener-org.apache.spark.util.TaskFailureListener-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addTaskFailureListener</h4>
<pre>public&nbsp;<a href="../../../org/apache/spark/BarrierTaskContext.html" title="class in org.apache.spark">BarrierTaskContext</a>&nbsp;addTaskFailureListener(<a href="../../../org/apache/spark/util/TaskFailureListener.html" title="interface in org.apache.spark.util">TaskFailureListener</a>&nbsp;listener)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html#addTaskFailureListener-org.apache.spark.util.TaskFailureListener-">TaskContext</a></code></span></div>
<div class="block">Adds a listener to be executed on task failure. Adding a listener to an already failed task
will result in that listener being called immediately.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../org/apache/spark/TaskContext.html#addTaskFailureListener-org.apache.spark.util.TaskFailureListener-">addTaskFailureListener</a></code>&nbsp;in class&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html" title="class in org.apache.spark">TaskContext</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>listener</code> - (undocumented)</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>(undocumented)</dd>
</dl>
</li>
</ul>
<a name="stageId--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>stageId</h4>
<pre>public&nbsp;int&nbsp;stageId()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html#stageId--">TaskContext</a></code></span></div>
<div class="block">The ID of the stage that this task belong to.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../org/apache/spark/TaskContext.html#stageId--">stageId</a></code>&nbsp;in class&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html" title="class in org.apache.spark">TaskContext</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>(undocumented)</dd>
</dl>
</li>
</ul>
<a name="stageAttemptNumber--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>stageAttemptNumber</h4>
<pre>public&nbsp;int&nbsp;stageAttemptNumber()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html#stageAttemptNumber--">TaskContext</a></code></span></div>
<div class="block">How many times the stage that this task belongs to has been attempted. The first stage attempt
will be assigned stageAttemptNumber = 0, and subsequent attempts will have increasing attempt
numbers.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../org/apache/spark/TaskContext.html#stageAttemptNumber--">stageAttemptNumber</a></code>&nbsp;in class&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html" title="class in org.apache.spark">TaskContext</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>(undocumented)</dd>
</dl>
</li>
</ul>
<a name="partitionId--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>partitionId</h4>
<pre>public&nbsp;int&nbsp;partitionId()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html#partitionId--">TaskContext</a></code></span></div>
<div class="block">The ID of the RDD partition that is computed by this task.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../org/apache/spark/TaskContext.html#partitionId--">partitionId</a></code>&nbsp;in class&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html" title="class in org.apache.spark">TaskContext</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>(undocumented)</dd>
</dl>
</li>
</ul>
<a name="attemptNumber--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>attemptNumber</h4>
<pre>public&nbsp;int&nbsp;attemptNumber()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html#attemptNumber--">TaskContext</a></code></span></div>
<div class="block">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.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../org/apache/spark/TaskContext.html#attemptNumber--">attemptNumber</a></code>&nbsp;in class&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html" title="class in org.apache.spark">TaskContext</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>(undocumented)</dd>
</dl>
</li>
</ul>
<a name="taskAttemptId--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>taskAttemptId</h4>
<pre>public&nbsp;long&nbsp;taskAttemptId()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html#taskAttemptId--">TaskContext</a></code></span></div>
<div class="block">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.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../org/apache/spark/TaskContext.html#taskAttemptId--">taskAttemptId</a></code>&nbsp;in class&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html" title="class in org.apache.spark">TaskContext</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>(undocumented)</dd>
</dl>
</li>
</ul>
<a name="getLocalProperty-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getLocalProperty</h4>
<pre>public&nbsp;String&nbsp;getLocalProperty(String&nbsp;key)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html#getLocalProperty-java.lang.String-">TaskContext</a></code></span></div>
<div class="block">Get a local property set upstream in the driver, or null if it is missing. See also
<code>org.apache.spark.SparkContext.setLocalProperty</code>.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../org/apache/spark/TaskContext.html#getLocalProperty-java.lang.String-">getLocalProperty</a></code>&nbsp;in class&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html" title="class in org.apache.spark">TaskContext</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>key</code> - (undocumented)</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>(undocumented)</dd>
</dl>
</li>
</ul>
<a name="taskMetrics--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>taskMetrics</h4>
<pre>public&nbsp;org.apache.spark.executor.TaskMetrics&nbsp;taskMetrics()</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../org/apache/spark/TaskContext.html#taskMetrics--">taskMetrics</a></code>&nbsp;in class&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html" title="class in org.apache.spark">TaskContext</a></code></dd>
</dl>
</li>
</ul>
<a name="getMetricsSources-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMetricsSources</h4>
<pre>public&nbsp;scala.collection.Seq&lt;<a href="../../../org/apache/spark/metrics/source/Source.html" title="interface in org.apache.spark.metrics.source">Source</a>&gt;&nbsp;getMetricsSources(String&nbsp;sourceName)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html#getMetricsSources-java.lang.String-">TaskContext</a></code></span></div>
<div class="block">::DeveloperApi::
Returns all metrics sources with the given name which are associated with the instance
which runs the task. For more information see <code>org.apache.spark.metrics.MetricsSystem</code>.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../org/apache/spark/TaskContext.html#getMetricsSources-java.lang.String-">getMetricsSources</a></code>&nbsp;in class&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html" title="class in org.apache.spark">TaskContext</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>sourceName</code> - (undocumented)</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>(undocumented)</dd>
</dl>
</li>
</ul>
<a name="resources--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>resources</h4>
<pre>public&nbsp;scala.collection.immutable.Map&lt;String,<a href="../../../org/apache/spark/resource/ResourceInformation.html" title="class in org.apache.spark.resource">ResourceInformation</a>&gt;&nbsp;resources()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html#resources--">TaskContext</a></code></span></div>
<div class="block">Resources allocated to the task. The key is the resource name and the value is information
about the resource. Please refer to <a href="../../../org/apache/spark/resource/ResourceInformation.html" title="class in org.apache.spark.resource"><code>ResourceInformation</code></a> for
specifics.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../org/apache/spark/TaskContext.html#resources--">resources</a></code>&nbsp;in class&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html" title="class in org.apache.spark">TaskContext</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>(undocumented)</dd>
</dl>
</li>
</ul>
<a name="resourcesJMap--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>resourcesJMap</h4>
<pre>public&nbsp;java.util.Map&lt;String,<a href="../../../org/apache/spark/resource/ResourceInformation.html" title="class in org.apache.spark.resource">ResourceInformation</a>&gt;&nbsp;resourcesJMap()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html#resourcesJMap--">TaskContext</a></code></span></div>
<div class="block">(java-specific) Resources allocated to the task. The key is the resource name and the value
is information about the resource. Please refer to
<a href="../../../org/apache/spark/resource/ResourceInformation.html" title="class in org.apache.spark.resource"><code>ResourceInformation</code></a> for specifics.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../org/apache/spark/TaskContext.html#resourcesJMap--">resourcesJMap</a></code>&nbsp;in class&nbsp;<code><a href="../../../org/apache/spark/TaskContext.html" title="class in org.apache.spark">TaskContext</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>(undocumented)</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../org/apache/spark/BarrierCoordinatorMessage.html" title="interface in org.apache.spark"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../org/apache/spark/BarrierTaskInfo.html" title="class in org.apache.spark"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/apache/spark/BarrierTaskContext.html" target="_top">Frames</a></li>
<li><a href="BarrierTaskContext.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<script defer="defer" type="text/javascript" src="../../../lib/jquery.js"></script><script defer="defer" type="text/javascript" src="../../../lib/api-javadocs.js"></script></body>
</html>