You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@griffin.apache.org by GitBox <gi...@apache.org> on 2019/07/29 03:09:17 UTC

[GitHub] [griffin] ahutsunshine commented on a change in pull request #514: [GRIFFIN-269] Griffin submit job to livy server with Kerberos Authentication

ahutsunshine commented on a change in pull request #514: [GRIFFIN-269] Griffin submit job to livy server with Kerberos Authentication
URL: https://github.com/apache/griffin/pull/514#discussion_r308042738
 
 

 ##########
 File path: service/src/main/java/org/apache/griffin/core/job/LivyTaskSubmitHelper.java
 ##########
 @@ -216,8 +222,105 @@ public void decreaseCurTaskNum(Long scheduleId) {
     private Map<String, Object> getResultByLivyId(Object livyBatchesId, TypeReference<HashMap<String, Object>> type)
             throws IOException {
         Map<String, Object> resultMap = new HashedMap();
-        String newResult = restTemplate.getForObject(uri + "/" + livyBatchesId, String.class);
-        return newResult == null ? resultMap : toEntity(newResult, type);
+        String livyUri = uri + "/" + livyBatchesId;
+        String result = getFromLivy(livyUri);
+        logger.info(result);
+        return result == null ? resultMap : toEntity(result, type);
+    }
+
+    public String postToLivy(String uri) {
+        logger.info("Post To Livy URI is: " + uri);
+        String needKerberos = env.getProperty("livy.need.kerberos");
+        logger.info("Need Kerberos:" + needKerberos);
+
+        HttpHeaders headers = new HttpHeaders();
+        headers.setContentType(MediaType.APPLICATION_JSON);
+        headers.set(REQUEST_BY_HEADER,"admin");
+
+        if (needKerberos == null || needKerberos.isEmpty()) {
+            logger.error("The property \"livy.need.kerberos\" is empty");
+            return null;
+        }
+
 
 Review comment:
   If livy.need.kerberos is empty,  I think users may not need Kerberos. In other words, it's the same as  `livy.need.kerberos = false`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services