p2pMapReduce.mapreduceModule
Class WrappedReducer.Context

java.lang.Object
  extended by p2pMapReduce.mapreduceModule.Reducer.Context
      extended by p2pMapReduce.mapreduceModule.WrappedReducer.Context
All Implemented Interfaces:
JobContext, MRJobConfig, ReduceContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT>, TaskAttemptContext, TaskInputOutputContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
Enclosing class:
WrappedReducer<KEYIN,VALUEIN,KEYOUT,VALUEOUT>

public class WrappedReducer.Context
extends Reducer.Context


Nested Class Summary
 
Nested classes/interfaces inherited from interface p2pMapReduce.mapreduceModule.ReduceContext
ReduceContext.ValueIterator<VALUEIN>
 
Field Summary
protected  ReduceContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT> reduceContext
           
 
Fields inherited from interface p2pMapReduce.mapreduceModule.MRJobConfig
CACHE_ARCHIVES, CACHE_ARCHIVES_SIZES, CACHE_ARCHIVES_TIMESTAMPS, CACHE_ARCHIVES_VISIBILITIES, CACHE_FILE_TIMESTAMPS, CACHE_FILE_VISIBILITIES, CACHE_FILES, CACHE_FILES_SIZES, CACHE_LOCALARCHIVES, CACHE_LOCALFILES, CACHE_SYMLINK, CLASSPATH_ARCHIVES, CLASSPATH_FILES, COMBINE_CLASS_ATTR, COMPLETED_MAPS_FOR_REDUCE_SLOWSTART, END_NOTIFICATION_RETRIE_INTERVAL, END_NOTIFICATION_RETRIES, END_NOTIFICATION_URL, GROUP_COMPARATOR_CLASS, HISTORY_LOCATION, ID, INPUT_FORMAT_CLASS_ATTR, INPUTSPLIT_CLASS_ATTR, INPUTSPLIT_SIZE, IO_SORT_FACTOR, IO_SORT_MB, JAR, JAR_UNPACK_PATTERN, JOB_ACL_MODIFY_JOB, JOB_ACL_VIEW_JOB, JOB_CANCEL_DELEGATION_TOKEN, JOB_DIR_ATTR, JOB_INPUT_DIR_ATTR, JOB_INPUTSPLIT_DIR_ATTR, JOB_JAR_DIR_ATTR, JOB_JOBTRACKER_ID, JOB_LOCAL_DIR, JOB_NAME, JOB_NAMENODES, JOB_OUTPUT_DIR_ATTR, JVM_NUMTASKS_TORUN, KEY_COMPARATOR, MAP_CLASS_ATTR, MAP_COMBINE_MIN_SPILLS, MAP_DEBUG_SCRIPT, MAP_ENV, MAP_FAILURES_MAX_PERCENT, MAP_INPUT_FILE, MAP_INPUT_PATH, MAP_INPUT_START, MAP_JAVA_OPTS, MAP_LOG_LEVEL, MAP_MAX_ATTEMPTS, MAP_MEMORY_MB, MAP_MEMORY_PHYSICAL_MB, MAP_OUTPUT_COMPRESS, MAP_OUTPUT_COMPRESS_CODEC, MAP_OUTPUT_DIR_ATTR, MAP_OUTPUT_KEY_CLASS, MAP_OUTPUT_KEY_FIELD_SEPERATOR, MAP_OUTPUT_KEY_VALUE_SEPARATOR_ATTR, MAP_OUTPUT_VALUE_CLASS, MAP_SKIP_INCR_PROC_COUNT, MAP_SKIP_MAX_RECORDS, MAP_SORT_SPILL_PERCENT, MAP_SPECULATIVE, MAP_ULIMIT, MAX_TASK_FAILURES_PER_TRACKER, NUM_MAP_PROFILES, NUM_MAPS, NUM_REDUCE_PROFILES, NUM_REDUCES, OUTPUT_FORMAT_CLASS_ATTR, OUTPUT_KEY_CLASS, OUTPUT_VALUE_CLASS, PARTITIONER_CLASS_ATTR, PRESERVE_FAILED_TASK_FILES, PRESERVE_FILES_PATTERN, PRIORITY, QUEUE_NAME, RECORDS_BEFORE_PROGRESS, REDUCE_CLASS_ATTR, REDUCE_DEBUG_SCRIPT, REDUCE_ENV, REDUCE_FAILURES_MAXPERCENT, REDUCE_INPUT_BUFFER_PERCENT, REDUCE_INPUT_DIR_ATTR, REDUCE_JAVA_OPTS, REDUCE_LOG_LEVEL, REDUCE_MARKRESET_BUFFER_PERCENT, REDUCE_MARKRESET_BUFFER_SIZE, REDUCE_MAX_ATTEMPTS, REDUCE_MEMORY_MB, REDUCE_MEMORY_PHYSICAL_MB, REDUCE_MEMORY_TOTAL_BYTES, REDUCE_MEMTOMEM_ENABLED, REDUCE_MEMTOMEM_THRESHOLD, REDUCE_MERGE_INMEM_THRESHOLD, REDUCE_OUTPUT_DIR_ATTR, REDUCE_SKIP_INCR_PROC_COUNT, REDUCE_SKIP_MAXGROUPS, REDUCE_SPECULATIVE, REDUCE_ULIMIT, SETUP_CLEANUP_NEEDED, SHUFFLE_CONNECT_TIMEOUT, SHUFFLE_FETCH_FAILURES, SHUFFLE_INPUT_BUFFER_PERCENT, SHUFFLE_MERGE_EPRCENT, SHUFFLE_NOTIFY_READERROR, SHUFFLE_PARALLEL_COPIES, SHUFFLE_READ_TIMEOUT, SKIP_OUTDIR, SKIP_RECORDS, SKIP_START_ATTEMPTS, SPECULATIVE_SLOWNODE_THRESHOLD, SPECULATIVE_SLOWTASK_THRESHOLD, SPECULATIVECAP, SPLIT_FILE, TASK_ATTEMPT_ID, TASK_DEBUGOUT_LINES, TASK_ID, TASK_ISMAP, TASK_OUTPUT_DIR, TASK_PARTITION, TASK_PROFILE, TASK_PROFILE_PARAMS, TASK_TEMP_DIR, TASK_TIMEOUT, TASK_USERLOG_LIMIT, USER_LOG_RETAIN_HOURS, USER_NAME, WORKING_DIR
 
Constructor Summary
WrappedReducer.Context(ReduceContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT> reduceContext)
           
 
Method Summary
 java.lang.Class<? extends Reducer<?,?,?,?>> getCombinerClass()
          Get the combiner class for the job.
 Configuration getConfiguration()
          Return the configuration for the job.
 Counter getCounter(java.lang.Enum counterName)
          Get the Counter for the given counterName.
 Counter getCounter(java.lang.String groupName, java.lang.String counterName)
          Get the Counter for the given groupName and counterName.
 KEYIN getCurrentKey()
          Get the current key.
 VALUEIN getCurrentValue()
          Get the current value.
 java.lang.Class<? extends InputFormat<?,?>> getInputFormatClass()
          Get the InputFormat class for the job.
 java.lang.String getJar()
          Get the pathname of the job's jar.
 JobID getJobID()
          Get the unique ID for the job.
 java.lang.String getJobName()
          Get the user-specified job name.
 boolean getJobSetupCleanupNeeded()
          Get whether job-setup and job-cleanup is needed for the job
 java.lang.Class<?> getMapOutputKeyClass()
          Get the key class for the map output data.
 java.lang.Class<?> getMapOutputValueClass()
          Get the value class for the map output data.
 java.lang.Class<? extends Mapper<?,?,?,?>> getMapperClass()
          Get the Mapper class for the job.
 int getMaxMapAttempts()
          Get the configured number of maximum attempts that will be made to run a map task, as specified by the mapred.map.max.attempts property.
 int getMaxReduceAttempts()
          Get the configured number of maximum attempts that will be made to run a reduce task, as specified by the mapred.reduce.max.attempts property.
 int getNumReduceTasks()
          Get configured the number of reduce tasks for this job.
 OutputCommitter getOutputCommitter()
          Get the OutputCommitter for the task-attempt.
 java.lang.Class<? extends OutputFormat<?,?>> getOutputFormatClass()
          Get the OutputFormat class for the job.
 java.lang.Class<?> getOutputKeyClass()
          Get the key class for the job output data.
 java.lang.Class<?> getOutputValueClass()
          Get the value class for job outputs.
 java.lang.Class<? extends Partitioner<?,?>> getPartitionerClass()
          Get the Partitioner class for the job.
 boolean getProfileEnabled()
          Get whether the task profiling is enabled.
 java.lang.String getProfileParams()
          Get the profiler configuration arguments.
 Configuration.IntegerRanges getProfileTaskRange(boolean isMap)
          Get the range of maps or reduces to profile.
 java.lang.Class<? extends Reducer<?,?,?,?>> getReducerClass()
          Get the Reducer class for the job.
 RawComparator<?> getSortComparator()
          Get the RawComparator comparator used to compare keys.
 java.lang.String getStatus()
          Get the last set status message.
 TaskAttemptID getTaskAttemptID()
          Get the unique name for this task attempt.
 java.lang.String getUser()
          Get the reported username for this job.
 java.lang.Iterable<VALUEIN> getValues()
          Iterate through the values for the current key, reusing the same value object, which is stored in the context.
 Path getWorkingDirectory()
          Get the current working directory for the default file system.
 boolean nextKey()
          Start processing next unique key.
 boolean nextKeyValue()
          Advance to the next key, value pair, returning null if at end.
 void setStatus(java.lang.String msg)
          Set the current status of the task to the given string.
 void write(KEYOUT key, VALUEOUT value)
          Generate an output key/value pair.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reduceContext

protected ReduceContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT> reduceContext
Constructor Detail

WrappedReducer.Context

public WrappedReducer.Context(ReduceContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT> reduceContext)
Method Detail

getCurrentKey

public KEYIN getCurrentKey()
                    throws java.io.IOException,
                           java.lang.InterruptedException
Description copied from interface: TaskInputOutputContext
Get the current key.

Returns:
the current key object or null if there isn't one
Throws:
java.io.IOException
java.lang.InterruptedException

getCurrentValue

public VALUEIN getCurrentValue()
                        throws java.io.IOException,
                               java.lang.InterruptedException
Description copied from interface: TaskInputOutputContext
Get the current value.

Returns:
the value object that was read into
Throws:
java.io.IOException
java.lang.InterruptedException

nextKeyValue

public boolean nextKeyValue()
                     throws java.io.IOException,
                            java.lang.InterruptedException
Description copied from interface: TaskInputOutputContext
Advance to the next key, value pair, returning null if at end.

Returns:
the key object that was read into, or null if no more
Throws:
java.io.IOException
java.lang.InterruptedException

getCounter

public Counter getCounter(java.lang.Enum counterName)
Description copied from interface: TaskInputOutputContext
Get the Counter for the given counterName.

Parameters:
counterName - counter name
Returns:
the Counter for the given counterName

getCounter

public Counter getCounter(java.lang.String groupName,
                          java.lang.String counterName)
Description copied from interface: TaskInputOutputContext
Get the Counter for the given groupName and counterName.

counterName - counter name
Returns:
the Counter for the given groupName and counterName

getOutputCommitter

public OutputCommitter getOutputCommitter()
Description copied from interface: TaskInputOutputContext
Get the OutputCommitter for the task-attempt.

Returns:
the OutputCommitter for the task-attempt

write

public void write(KEYOUT key,
                  VALUEOUT value)
           throws java.io.IOException,
                  java.lang.InterruptedException
Description copied from interface: TaskInputOutputContext
Generate an output key/value pair.

Throws:
java.io.IOException
java.lang.InterruptedException

getStatus

public java.lang.String getStatus()
Description copied from interface: TaskAttemptContext
Get the last set status message.

Returns:
the current status message

getTaskAttemptID

public TaskAttemptID getTaskAttemptID()
Description copied from interface: TaskAttemptContext
Get the unique name for this task attempt.


setStatus

public void setStatus(java.lang.String msg)
Description copied from interface: TaskAttemptContext
Set the current status of the task to the given string.


getCombinerClass

public java.lang.Class<? extends Reducer<?,?,?,?>> getCombinerClass()
                                                             throws java.lang.ClassNotFoundException
Description copied from interface: JobContext
Get the combiner class for the job.

Returns:
the combiner class for the job.
Throws:
java.lang.ClassNotFoundException

getConfiguration

public Configuration getConfiguration()
Description copied from interface: JobContext
Return the configuration for the job.

Returns:
the shared configuration object

getInputFormatClass

public java.lang.Class<? extends InputFormat<?,?>> getInputFormatClass()
                                                                throws java.lang.ClassNotFoundException
Description copied from interface: JobContext
Get the InputFormat class for the job.

Returns:
the InputFormat class for the job.
Throws:
java.lang.ClassNotFoundException

getJar

public java.lang.String getJar()
Description copied from interface: JobContext
Get the pathname of the job's jar.

Returns:
the pathname

getJobID

public JobID getJobID()
Description copied from interface: JobContext
Get the unique ID for the job.

Returns:
the object with the job id

getJobName

public java.lang.String getJobName()
Description copied from interface: JobContext
Get the user-specified job name. This is only used to identify the job to the user.

Returns:
the job's name, defaulting to "".

getJobSetupCleanupNeeded

public boolean getJobSetupCleanupNeeded()
Description copied from interface: JobContext
Get whether job-setup and job-cleanup is needed for the job

Returns:
boolean

getMapOutputKeyClass

public java.lang.Class<?> getMapOutputKeyClass()
Description copied from interface: JobContext
Get the key class for the map output data. If it is not set, use the (final) output key class. This allows the map output key class to be different than the final output key class.

Returns:
the map output key class.

getMapOutputValueClass

public java.lang.Class<?> getMapOutputValueClass()
Description copied from interface: JobContext
Get the value class for the map output data. If it is not set, use the (final) output value class This allows the map output value class to be different than the final output value class.

Returns:
the map output value class.

getMapperClass

public java.lang.Class<? extends Mapper<?,?,?,?>> getMapperClass()
                                                          throws java.lang.ClassNotFoundException
Description copied from interface: JobContext
Get the Mapper class for the job.

Returns:
the Mapper class for the job.
Throws:
java.lang.ClassNotFoundException

getMaxMapAttempts

public int getMaxMapAttempts()
Description copied from interface: JobContext
Get the configured number of maximum attempts that will be made to run a map task, as specified by the mapred.map.max.attempts property. If this property is not already set, the default is 4 attempts.

Returns:
the max number of attempts per map task.

getMaxReduceAttempts

public int getMaxReduceAttempts()
Description copied from interface: JobContext
Get the configured number of maximum attempts that will be made to run a reduce task, as specified by the mapred.reduce.max.attempts property. If this property is not already set, the default is 4 attempts.

Returns:
the max number of attempts per reduce task.

getNumReduceTasks

public int getNumReduceTasks()
Description copied from interface: JobContext
Get configured the number of reduce tasks for this job. Defaults to 1.

Returns:
the number of reduce tasks for this job.

getOutputFormatClass

public java.lang.Class<? extends OutputFormat<?,?>> getOutputFormatClass()
                                                                  throws java.lang.ClassNotFoundException
Description copied from interface: JobContext
Get the OutputFormat class for the job.

Returns:
the OutputFormat class for the job.
Throws:
java.lang.ClassNotFoundException

getOutputKeyClass

public java.lang.Class<?> getOutputKeyClass()
Description copied from interface: JobContext
Get the key class for the job output data.

Returns:
the key class for the job output data.

getOutputValueClass

public java.lang.Class<?> getOutputValueClass()
Description copied from interface: JobContext
Get the value class for job outputs.

Returns:
the value class for job outputs.

getPartitionerClass

public java.lang.Class<? extends Partitioner<?,?>> getPartitionerClass()
                                                                throws java.lang.ClassNotFoundException
Description copied from interface: JobContext
Get the Partitioner class for the job.

Returns:
the Partitioner class for the job.
Throws:
java.lang.ClassNotFoundException

getReducerClass

public java.lang.Class<? extends Reducer<?,?,?,?>> getReducerClass()
                                                            throws java.lang.ClassNotFoundException
Description copied from interface: JobContext
Get the Reducer class for the job.

Returns:
the Reducer class for the job.
Throws:
java.lang.ClassNotFoundException

getSortComparator

public RawComparator<?> getSortComparator()
Description copied from interface: JobContext
Get the RawComparator comparator used to compare keys.

Returns:
the RawComparator comparator used to compare keys.

getWorkingDirectory

public Path getWorkingDirectory()
                         throws java.io.IOException
Description copied from interface: JobContext
Get the current working directory for the default file system.

Returns:
the directory name.
Throws:
java.io.IOException

getValues

public java.lang.Iterable<VALUEIN> getValues()
                                      throws java.io.IOException,
                                             java.lang.InterruptedException
Description copied from interface: ReduceContext
Iterate through the values for the current key, reusing the same value object, which is stored in the context.

Returns:
the series of values associated with the current key. All of the objects returned directly and indirectly from this method are reused.
Throws:
java.io.IOException
java.lang.InterruptedException

nextKey

public boolean nextKey()
                throws java.io.IOException,
                       java.lang.InterruptedException
Description copied from interface: ReduceContext
Start processing next unique key.

Throws:
java.io.IOException
java.lang.InterruptedException

getProfileEnabled

public boolean getProfileEnabled()
Description copied from interface: JobContext
Get whether the task profiling is enabled.

Returns:
true if some tasks will be profiled

getProfileParams

public java.lang.String getProfileParams()
Description copied from interface: JobContext
Get the profiler configuration arguments. The default value for this property is "-agentlib:hprof=cpu=samples,heap=sites,force=n,thread=y,verbose=n,file=%s"

Returns:
the parameters to pass to the task child to configure profiling

getProfileTaskRange

public Configuration.IntegerRanges getProfileTaskRange(boolean isMap)
Description copied from interface: JobContext
Get the range of maps or reduces to profile.

Parameters:
isMap - is the task a map?
Returns:
the task ranges

getUser

public java.lang.String getUser()
Description copied from interface: JobContext
Get the reported username for this job.

Returns:
the username