Every time i run a hadoop job inside my main method, the only thing my main does is complete the job. For example lets say i have this main method:
public static void main(String[] args)
{
System.out.println("before");
//code for creating job
//run job
System.out.println("after");
}
At first i could only run the job, without any of these messages appear. I tried to run the job through a separate thread but the only thing that i accomplished is to have both messages appear before my job being submitted and completed . Is there any way that i can print "before", do the job and then print "after"??
This is a dummy example. What i really want to do is to run jobs in a while(true) loop, have some conditions inside and run other jobs based on those conditions, until a break appears. I think those 2 problems i mentioned are similar is some way, so by solving the dummy example, i think i can solve my real problem.
I am not looking for something like Oozie, because i am sure there is a simpler way to do this. Thanks.
Yes you can.
Here is how:
job.waitForCompletion(true);
Usually, when you submit your job if you do this, it will submit it and not exit the thread until it has received confirmation. You should be able to see the printout then.