简体   繁体   中英

How to run MapReduceIndexerTool job from Java?

I want to run MapReduceIndexerTool from Java.

Right now I do it from command line using hadoop jar as you can see here , but I want to check it's status (to see if it's finalized, in progress, etc.) from Java code.

So basically I want to run it from Java in order to be able to check it's status from Java. Is there a way to run it from command line and check it's status from Java?

Also, there is a way to make Map Reduce to send an event (on a callback for example) when a job is completed? Something like a webhook?

As far as I know Tool interface exposes only int run(String[] args) method, so in general you would create new instance, form proper argument string and call that method.

From other hand, MapReduceIndexerTool has int run(Options options) method, that could be used to run it without forming shell-style argument. However, this method is protected, so this will need to have calling class to be created in same package as MapReduceIndexerTool .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM