Guest User

Untitled

a guest
Jan 24th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. URI clientURI = new URI(/*My Livy Server Url*/);
  2. File file = new File(/*class path of my jar with spark job*/);
  3.  
  4.  
  5. LivyClient client = new LivyClientBuilder(true).setURI(clientURI).build();
  6. Object str = client.uploadJar(file);
  7.  
  8. JobHandle<int[]> handle = client.submit(new SparkJob("dbname","tablename"));
  9. // I am expecting the dbname and tablename to be sent to sparkJob through Livy. Is this the correct way?
  10. handle.get();
  11.  
  12. private String dbName, tableName;
  13.  
  14. public SparkJob(String dbName, String tableName) {
  15. this.dbName = dbName;
  16. this.tableName = tableName;
  17. }
  18.  
  19. @Override
  20. public int[] call(JobContext jc) throws Exception {
  21.  
  22. //What logic should I write here?
  23.  
  24. }
  25. }
Add Comment
Please, Sign In to add comment