Created
March 15, 2017 14:02
-
-
Save juriad/8cc355bcbe381ccfaa658e6844c6e0d8 to your computer and use it in GitHub Desktop.
Start processing in yarn-cluster mode and await the end
This file contains hidden or 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
| public void run(String planFileOnHdfs) throws IOException, InterruptedException { | |
| SparkLauncher sparkLauncher = new SparkLauncher(); | |
| SparkAppHandle handle = sparkLauncher | |
| .setAppResource("cif.hadoop.boot.jar") | |
| .setMainClass("com.ataccama.dqc.hadoop.launcher.HadoopClusterLauncher") | |
| .setMaster("yarn-cluster") | |
| .addAppArgs(planFileOnHdfs) | |
| .startApplication(); | |
| CountDownLatch countDownLatch = new CountDownLatch(1); | |
| handle.addListener(new SparkAppHandle.Listener() { | |
| @Override | |
| public void stateChanged(SparkAppHandle handle) { | |
| if (handle.getState().isFinal()) { | |
| countDownLatch.countDown(); | |
| } | |
| } | |
| @Override | |
| public void infoChanged(SparkAppHandle handle) { | |
| } | |
| }); | |
| countDownLatch.await(); | |
| System.out.println(handle.getAppId() + " ended in state " + handle.getState()); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment