On Sat, Jan 12, 2013 at 9:39 PM, John Lilley <[EMAIL PROTECTED]> wrote:
> I am trying to understand how one can make a “side process” cooperate with
> the Hadoop MapReduce task scheduler. Suppose that I have an application
> that is not directly integrated with MapReduce (i.e., it is not a MapReduce
> job at all; there are no mappers or reducers). This application could
> access HDFS as an external client, but it would be limited in its
> throughput. I want to run this application in parallel on HDFS nodes to
> realize the benefits of parallel computation and data locality. But I want
> to cooperate in resource management with Hadoop. But I don’t want the
> *data* to get pushed through MapReduce, because the nature of the
> application doesn’t lend itself nicely to MR integration.
Apache Hadoop has moved past plain MR onto YARN. YARN allows MR
(called MR2) and also allows other forms of generic, distributed apps
to be developed for any other purposes.
> Perhaps if I explain why I think this is not suitable for regular MR jobs it
> may help. Suppose that I have stored into HDFS a very large file for which
> there is no Java library. JNI could be an option, but wrapping the complex
> function of legacy application code into JNI may be more work than it is
> worth. The application performs some very complex processing, and this is
> something that we don’t necessarily want to redesign to fit the MR paradigm.
> Obviously the data file is “splittable” or this approach wouldn’t work at
> all. So perhaps it is possible to hook into MR at the Splitter level, and
> use that to create a series of mapper tasks where the mappers don’t actually
> read the data directly, but hand off the corresponding data block to the
> legacy application for processing?
Yes if you're stuck on a platform that just has MR and you want to
somehow leverage a map-only distribution to do this, you should tweak
your job to (a) use empty splits and (b) run infinitely. For (a), take
a look at the Sleep Job example  that utilizes empty splits - no
data, but you can control number of mappers, etc. and have mapper
logic do work. For (b), study the SleepJob's mapper to see how it
periodically reports progress or status changes (can be done via a
daemon thread too) such that the framework does not think it has died
or gone unresponsive.
But ideally, you'd want to leverage YARN for this. Libraries such as
Kitten  help along in this task.
 - https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1/src/examples/org/apache/hadoop/examples/SleepJob.java
 - https://github.com/cloudera/kitten/