Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- URI clientURI = new URI(/*My Livy Server Url*/);
- File file = new File(/*class path of my jar with spark job*/);
- LivyClient client = new LivyClientBuilder(true).setURI(clientURI).build();
- Object str = client.uploadJar(file);
- JobHandle<int[]> handle = client.submit(new SparkJob("dbname","tablename"));
- // I am expecting the dbname and tablename to be sent to sparkJob through Livy. Is this the correct way?
- handle.get();
- private String dbName, tableName;
- public SparkJob(String dbName, String tableName) {
- this.dbName = dbName;
- this.tableName = tableName;
- }
- @Override
- public int[] call(JobContext jc) throws Exception {
- //What logic should I write here?
- }
- }
Add Comment
Please, Sign In to add comment