org.apache.tez.runtime.api
Interface TezTaskContext

All Known Subinterfaces:
TezInputContext, TezOutputContext, TezProcessorContext

public interface TezTaskContext

Base interface for Context classes used to initialize the Input, Output and Processor instances.


Method Summary
 void fatalError(Throwable exception, String message)
          Report a fatal error to the framework.
 org.apache.hadoop.yarn.api.records.ApplicationId getApplicationId()
          Get the ApplicationId for the running app
 TezCounters getCounters()
           
 int getDAGAttemptNumber()
          Get the current DAG Attempt Number
 String getDAGName()
          Get the name of the DAG
 ByteBuffer getServiceConsumerMetaData(String serviceName)
          Returns meta-data for the specified service.
 ByteBuffer getServiceProviderMetaData(String serviceName)
          Return Provider meta-data for the specified service As an example, when the MR ShuffleHandler is used - this would return the shuffle port serialized as bytes
 int getTaskAttemptNumber()
          Get the current Task Attempt Number
 int getTaskIndex()
          Get the index of this Task among the tasks of this vertex
 int getTaskVertexIndex()
          Get the index of this task's vertex in the set of vertices in the DAG.
 String getTaskVertexName()
          Get the name of the Vertex in which the task is running
 long getTotalMemoryAvailableToTask()
          Gets the total memory available to all components of the running task.
 String getUniqueIdentifier()
          Returns an identifier which is unique to the specific Input, Processor or Output
 byte[] getUserPayload()
          Get the User Payload for the Input/Output/Processor
 String[] getWorkDirs()
          Get the work diectories for the Input/Output/Processor
 void requestInitialMemory(long size, MemoryUpdateCallback callbackHandler)
          Request a specific amount of memory during initialization (initialize(..*Context)) The requester is notified of allocation via the provided callback handler.
 void sendEvents(List<Event> events)
          Send Events to the AM and/or dependent Vertices
 

Method Detail

getApplicationId

org.apache.hadoop.yarn.api.records.ApplicationId getApplicationId()
Get the ApplicationId for the running app

Returns:
the ApplicationId

getDAGAttemptNumber

int getDAGAttemptNumber()
Get the current DAG Attempt Number

Returns:
DAG Attempt Number

getTaskIndex

int getTaskIndex()
Get the index of this Task among the tasks of this vertex

Returns:
Task Index

getTaskAttemptNumber

int getTaskAttemptNumber()
Get the current Task Attempt Number

Returns:
Task Attempt Number

getDAGName

String getDAGName()
Get the name of the DAG

Returns:
the DAG name

getTaskVertexName

String getTaskVertexName()
Get the name of the Vertex in which the task is running

Returns:
Vertex Name

getTaskVertexIndex

int getTaskVertexIndex()
Get the index of this task's vertex in the set of vertices in the DAG. This is consistent and valid across all tasks/vertices in the same DAG.

Returns:
index

getCounters

TezCounters getCounters()

sendEvents

void sendEvents(List<Event> events)
Send Events to the AM and/or dependent Vertices

Parameters:
events - Events to be sent

getUserPayload

byte[] getUserPayload()
Get the User Payload for the Input/Output/Processor

Returns:
User Payload

getWorkDirs

String[] getWorkDirs()
Get the work diectories for the Input/Output/Processor

Returns:
an array of work dirs

getUniqueIdentifier

String getUniqueIdentifier()
Returns an identifier which is unique to the specific Input, Processor or Output

Returns:
a unique identifier

fatalError

void fatalError(Throwable exception,
                String message)
Report a fatal error to the framework. This will cause the entire task to fail and should not be used for reporting temporary or recoverable errors

Parameters:
exception - an exception representing the error

getServiceConsumerMetaData

ByteBuffer getServiceConsumerMetaData(String serviceName)
Returns meta-data for the specified service. As an example, when the MR ShuffleHandler is used - this would return the jobToken serialized as bytes

Parameters:
serviceName - the name of the service for which meta-data is required
Returns:
a ByteBuffer representing the meta-data

getServiceProviderMetaData

ByteBuffer getServiceProviderMetaData(String serviceName)
Return Provider meta-data for the specified service As an example, when the MR ShuffleHandler is used - this would return the shuffle port serialized as bytes

Parameters:
serviceName - the name of the service for which provider meta-data is required
Returns:
a ByteBuffer representing the meta-data

requestInitialMemory

void requestInitialMemory(long size,
                          MemoryUpdateCallback callbackHandler)
Request a specific amount of memory during initialization (initialize(..*Context)) The requester is notified of allocation via the provided callback handler. Currently, (post TEZ-668) the caller will be informed about the available memory after initialization (I/P/O initialize(...)), and before the start/run invocation. There will be no other invocations on the callback. This method can be called only once by any component. Calling it multiple times from within the same component will result in an error. Each Input / Output must request memory. For Inputs / Outputs which do not have a specific ask, a null callback handler can be specified with a request size of 0.

Parameters:
size - request size in bytes.
callbackHandler - the callback handler to be invoked once memory is assigned

getTotalMemoryAvailableToTask

long getTotalMemoryAvailableToTask()
Gets the total memory available to all components of the running task. This values will always be constant, and does not factor in any allocations.

Returns:
the total available memory for all components of the task


Copyright © 2014 Apache Software Foundation. All rights reserved.