OOZIE-2807 Oozie gets RM delegation token even for checking job status (satishsaley)
Project: http://git-wip-us.apache.org/repos/asf/oozie/repo Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/9c051660 Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/9c051660 Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/9c051660 Branch: refs/heads/oya Commit: 9c0516608bdd0787b1fac3a69ccfe9d36cbb2d15 Parents: abb2e18 Author: satishsaley <satishsa...@apache.org> Authored: Fri Mar 10 14:28:26 2017 -0800 Committer: satishsaley <satishsa...@apache.org> Committed: Fri Mar 10 14:28:26 2017 -0800 ---------------------------------------------------------------------- .../oozie/action/hadoop/JavaActionExecutor.java | 5 +---- .../oozie/service/HadoopAccessorService.java | 23 ++++++++++++++++++-- release-log.txt | 1 + 3 files changed, 23 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oozie/blob/9c051660/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java b/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java index cc27fa0..39daca7 100644 --- a/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java +++ b/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java @@ -1151,10 +1151,7 @@ public class JavaActionExecutor extends ActionExecutor { LOG.debug("Submitting the job through Job Client for action " + action.getId()); // setting up propagation of the delegation token. - HadoopAccessorService has = Services.get().get(HadoopAccessorService.class); - Token<DelegationTokenIdentifier> mrdt = jobClient.getDelegationToken(has - .getMRDelegationTokenRenewer(launcherJobConf)); - launcherJobConf.getCredentials().addToken(HadoopAccessorService.MR_TOKEN_ALIAS, mrdt); + Services.get().get(HadoopAccessorService.class).addRMDelegationToken(jobClient, launcherJobConf); // insert credentials tokens to launcher job conf if needed if (needInjectCredentials() && credentialsConf != null) { http://git-wip-us.apache.org/repos/asf/oozie/blob/9c051660/core/src/main/java/org/apache/oozie/service/HadoopAccessorService.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/service/HadoopAccessorService.java b/core/src/main/java/org/apache/oozie/service/HadoopAccessorService.java index 5377127..23a9d92 100644 --- a/core/src/main/java/org/apache/oozie/service/HadoopAccessorService.java +++ b/core/src/main/java/org/apache/oozie/service/HadoopAccessorService.java @@ -514,8 +514,6 @@ public class HadoopAccessorService implements Service { return new JobClient(conf); } }); - Token<DelegationTokenIdentifier> mrdt = jobClient.getDelegationToken(getMRDelegationTokenRenewer(conf)); - conf.getCredentials().addToken(MR_TOKEN_ALIAS, mrdt); return jobClient; } catch (InterruptedException ex) { @@ -527,6 +525,27 @@ public class HadoopAccessorService implements Service { } /** + * Get the RM delegation token using jobClient and add it to conf + * + * @param jobClient + * @param conf + * @throws HadoopAccessorException + */ + public void addRMDelegationToken(JobClient jobClient, JobConf conf) throws HadoopAccessorException { + Token<DelegationTokenIdentifier> mrdt; + try { + mrdt = jobClient.getDelegationToken(getMRDelegationTokenRenewer(conf)); + } + catch (IOException e) { + throw new HadoopAccessorException(ErrorCode.E0902, e.getMessage(), e); + } + catch (InterruptedException e) { + throw new HadoopAccessorException(ErrorCode.E0902, e.getMessage(), e); + } + conf.getCredentials().addToken(MR_TOKEN_ALIAS, mrdt); + } + + /** * Return a FileSystem created with the provided user for the specified URI. * * http://git-wip-us.apache.org/repos/asf/oozie/blob/9c051660/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index b5365f8..2542f33 100644 --- a/release-log.txt +++ b/release-log.txt @@ -1,5 +1,6 @@ -- Oozie 4.4.0 release (trunk - unreleased) +OOZIE-2807 Oozie gets RM delegation token even for checking job status (satishsaley) OOZIE-1887 Remove the utils dir (kvntrieu via rkanter) OOZIE-2540 Create a PySpark example (abhishekbafna via rkanter) OOZIE-807 Docs can be explicit about multiple sub-workflow definitions being possible (qwertymaniac via rkanter)