Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract all yarn related methods to azkaban-common as shared util library #3145

Merged

Conversation

tsangz2013
Copy link
Collaborator

@tsangz2013 tsangz2013 commented Sep 6, 2022

Issue to solve: A part of the fixing / upgrade of the yarn application killing logic: make it easier to add and reuse "call yarn cluster for application ids" method later on

Changes made: Some simple refactor of the code, extract all the yarn-client related methods to an azkaban-common util s class

Testing done:

  • Added unit tests for killAppOnCluster() method;
  • Tested in the bare metal exec-server on a spark flow:
  1. upload both jar for az-hadoop-jobtype-plugin.jar and azkaban-common.jar to a cluster machine
  2. restarted a exec-server
  3. trigger the sparkFlow execution and kill it after the yarn application is created
  4. verify the job log that the yarn app is killed

final String logFilePath = jobProps.getString(CommonJobProperties.JOB_LOG_FILE);
logger.info("Log file path is: " + logFilePath);

HadoopJobUtils.proxyUserKillAllSpawnedHadoopJobs(logFilePath, jobProps, tokenFile, logger);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not good: duplicated info in the 2 parameters

@@ -0,0 +1,71 @@
package azkaban.utils;
Copy link
Collaborator Author

@tsangz2013 tsangz2013 Sep 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically moved from old HadoopJobUtils, but follow the idea of yarnClient can be passed in

@tsangz2013 tsangz2013 force-pushed the zhzeng/extract-yarn-methods-to-utils branch from 74f379a to 9716e64 Compare September 6, 2022 23:51
Comment on lines 60 to 85
public static YarnClient createYarnClient(Props props) {
final YarnConfiguration yarnConf = new YarnConfiguration();
final YarnClient yarnClient = YarnClient.createYarnClient();
if (props.containsKey(YARN_CONF_DIRECTORY_PROPERTY)) {
yarnConf.addResource(
new Path(props.get(YARN_CONF_DIRECTORY_PROPERTY) + "/" + YARN_CONF_FILENAME));
}
yarnClient.init(yarnConf);
yarnClient.start();
return yarnClient;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate yarnclient creation for later reuse

@codecov
Copy link

codecov bot commented Sep 6, 2022

Codecov Report

Merging #3145 (c108ec2) into master (f7ad185) will increase coverage by 0.14%.
The diff coverage is 46.87%.

@@             Coverage Diff              @@
##             master    #3145      +/-   ##
============================================
+ Coverage     41.73%   41.87%   +0.14%     
- Complexity     4712     4740      +28     
============================================
  Files           600      606       +6     
  Lines         40397    40564     +167     
  Branches       4703     4709       +6     
============================================
+ Hits          16860    16988     +128     
- Misses        22134    22172      +38     
- Partials       1403     1404       +1     
Impacted Files Coverage Δ
.../src/main/java/azkaban/jobtype/HadoopJobUtils.java 34.07% <0.00%> (+2.79%) ⬆️
...gin/src/main/java/azkaban/jobtype/HadoopProxy.java 18.33% <0.00%> (+0.59%) ⬆️
...-common/src/main/java/azkaban/utils/YarnUtils.java 62.50% <62.50%> (ø)
...a/azkaban/imagemgmt/servlets/ImageTypeServlet.java 7.36% <0.00%> (-0.08%) ⬇️
az-core/src/main/java/azkaban/Constants.java 20.00% <0.00%> (ø)
...n/java/azkaban/imagemgmt/utils/ConverterUtils.java 42.30% <0.00%> (ø)
...mgmt/exception/ImageMgmtInvalidInputException.java 50.00% <0.00%> (ø)
...n/imagemgmt/services/ImageRampRuleServiceImpl.java 86.66% <0.00%> (ø)
...n/java/azkaban/imagemgmt/models/ImageRampRule.java 75.00% <0.00%> (ø)
... and 13 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@tsangz2013 tsangz2013 marked this pull request as ready for review September 7, 2022 18:48
@tsangz2013 tsangz2013 force-pushed the zhzeng/extract-yarn-methods-to-utils branch from 9716e64 to a35ff0e Compare September 7, 2022 23:10
@NancyXie2022
Copy link
Collaborator

looks good to me now, ship it.

NancyXie2022
NancyXie2022 previously approved these changes Sep 8, 2022
@tsangz2013 tsangz2013 force-pushed the zhzeng/extract-yarn-methods-to-utils branch from ca8481a to a35ff0e Compare September 8, 2022 20:55
Copy link
Member

@djaiswal83 djaiswal83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on refactor and adding test. The test file is missing the copy right header.

Copy link
Member

@djaiswal83 djaiswal83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tsangz2013 tsangz2013 merged commit a31c30d into azkaban:master Sep 9, 2022
@tsangz2013 tsangz2013 deleted the zhzeng/extract-yarn-methods-to-utils branch September 9, 2022 01:15
tsangz2013 added a commit to tsangz2013/azkaban that referenced this pull request Sep 15, 2022
tsangz2013 added a commit that referenced this pull request Sep 15, 2022
…util library (#3145)" (#3154)

This reverts commit a31c30d.
Reason: this change doesn't work with containerization, will fix the issue and raise a new PR for this.
tsangz2013 added a commit to tsangz2013/azkaban that referenced this pull request Sep 24, 2022
set HADOOP_TOKEN_FILE_LOCATION to token file
add logging around tokens
remove the token-file deletion code
Extract all yarn related methods to azkaban-common as shared util library (azkaban#3145)

* Extract all yarn related methods to azkaban-common as shared util library

* extract duplicate code to a static method

* amend header for test file
tsangz2013 added a commit that referenced this pull request Sep 29, 2022
…il library (#3145)

* Extract all yarn related methods to azkaban-common as shared util library

* extract duplicate code to a static method

* amend header for test file
tsangz2013 added a commit that referenced this pull request Sep 29, 2022
…il library (#3145) (#3164)

* Extract all yarn related methods to azkaban-common as shared util library

* extract duplicate code to a static method

* amend header for test file
NancyXie2022 pushed a commit that referenced this pull request May 26, 2023
…rary (#3145)

* Extract all yarn related methods to azkaban-common as shared util library

* extract duplicate code to a static method

* amend header for test file

RB=3636861
G=azkabandev-reviewers
R=anath1,ypadron,angoel,adsharma,jakhani,areznik,gsalia,apruthi,sarumuga,prkhande,abtiwari,djaiswal,sshardoo
A=bijiang
NancyXie2022 pushed a commit that referenced this pull request May 26, 2023
…util library (#3145)" (#3154)

This reverts commit a31c30d.
Reason: this change doesn't work with containerization, will fix the issue and raise a new PR for this.

3637010
RB=3637010
G=azkabandev-reviewers
R=ypadron,jakhani,prkhande,sarumuga,angoel,adsharma,abtiwari,gsalia,djaiswal,apruthi,anath1,sshardoo,areznik
A=bijiang
NancyXie2022 pushed a commit that referenced this pull request May 26, 2023
…il library (#3145) (#3164)

* Extract all yarn related methods to azkaban-common as shared util library

* extract duplicate code to a static method

* amend header for test file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants