-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CIMInputFormat is created on each worker node via classForName() or similar. To pass the ch.ninecode.cim.debug flag to each worker this requires a duplicate CIMInputFormatDebug with a fixed debug=true. Error messages about unknown CIM contents (coverage) are now emitted when ch.ninecode.cim.debug=true. Not setting ch.ninecode.cim.debug or setting it to false, now skips the CIMContext coverage step entirely. Unfortunately these coverage messages are only available on each worker separately in the stderr log. A suitablly configured log4j.properties on the driver and each worker is still required.
- Loading branch information
Derrick Oswald
committed
Sep 22, 2020
1 parent
408a3d8
commit dad4edb
Showing
5 changed files
with
81 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
CIMReader/src/main/scala/ch/ninecode/cim/CIMInputFormatDebug.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package ch.ninecode.cim | ||
|
||
import org.apache.commons.logging.{Log, LogFactory} | ||
import org.apache.hadoop.mapreduce.InputSplit | ||
import org.apache.hadoop.mapreduce.JobContext | ||
import org.apache.hadoop.mapreduce.RecordReader | ||
import org.apache.hadoop.mapreduce.TaskAttemptContext | ||
import ch.ninecode.model.Element | ||
|
||
class CIMInputFormatDebug extends CIMInputFormat | ||
{ | ||
val log: Log = LogFactory.getLog (getClass) | ||
|
||
/** | ||
* Generate the list of files and make them into FileSplits. | ||
* | ||
* Logically split the set of input files for the job. | ||
* Each InputSplit is then assigned to an individual Mapper for processing. | ||
* Note: The split is a logical split of the inputs and the input files are not physically split into chunks. | ||
* For e.g. a split could be <input-file-path, start, offset> tuple. | ||
* The InputFormat also creates the RecordReader to consume the InputSplit objects produced. | ||
* | ||
* @param context the job context | ||
* @return the list of FileSplit objects for the job | ||
*/ | ||
override def getSplits (context: JobContext): java.util.List[InputSplit] = | ||
{ | ||
log.info ("getSplits") | ||
val ret = super.getSplits (context) | ||
log.info (s"getSplits: ${ret.size ()} splits returned") | ||
ret | ||
} | ||
|
||
/** | ||
* Create a record reader for a given split. | ||
* | ||
* @param split the split to be read | ||
* @param context the information about the task | ||
* @return a new record reader | ||
*/ | ||
override def createRecordReader (split: InputSplit, context: TaskAttemptContext): RecordReader[String, Element] = | ||
{ | ||
log.info ("createRecordReader") | ||
log.info (s"split: ${split.toString}") | ||
log.info (s"context: ${context.getTaskAttemptID.toString}") | ||
new CIMRecordReader (true) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters