-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-yarn-dev-tools-aliases.sh
executable file
·71 lines (58 loc) · 3.11 KB
/
setup-yarn-dev-tools-aliases.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
function setup-vars {
# HADOOP_DEV_DIR and CLOUDERA_HADOOP_ROOT need to be defined
export UPSTREAM_HADOOP_DIR=${HADOOP_DEV_DIR}
export DOWNSTREAM_HADOOP_DIR=${CLOUDERA_HADOOP_ROOT}
# Replace this with the dir of your choice
export YARNDEVTOOLS_ROOT="$HOME/.yarndevtools"
}
function yarndevtools {
ORIG_PYTHONPATH=$PYTHONPATH
unset PYTHONPATH
source $YARNDEVTOOLS_ROOT/venv/bin/activate
export HADOOP_DEV_DIR && export CLOUDERA_HADOOP_ROOT
python -m yarndevtools.yarn_dev_tools "$@"
# Cleanup
deactivate
PYTHONPATH=$ORIG_PYTHONPATH
}
function print-yarn-dev-tools-aliases {
echo "============================================YARNDEVTOOLS SETUP============================================\n\n"
echo "CLOUDERA_HADOOP_ROOT=$CLOUDERA_HADOOP_ROOT"
echo "HADOOP_DEV_DIR=$HADOOP_DEV_DIR"
echo "YARN_DEV_TOOLS_DIR=$YARN_DEV_TOOLS_DIR"
echo "YARN_DEV_TOOLS_ENV=export HADOOP_DEV_DIR;export CLOUDERA_HADOOP_ROOT"
echo "Aliases: "
alias | grep -e '^yarn-.*='
echo "\n"
echo "============================================YARNDEVTOOLS SETUP============================================"
}
function setup-aliases-yarndevtools-source {
YARN_DEV_TOOLS_DIR="$HOME/development/my-repos/yarn-dev-tools"
YARN_DEV_TOOLS_ENV="export HADOOP_DEV_DIR;export CLOUDERA_HADOOP_ROOT"
alias yarn-backport="cd $YARN_DEV_TOOLS_DIR;$YARN_DEV_TOOLS_ENV; poetry run exec-yarndevtools BACKPORT; popd"
alias yarn-save-patch="cd $YARN_DEV_TOOLS_DIR;$YARN_DEV_TOOLS_ENV; poetry run exec-yarndevtools SAVE_PATCH; popd"
alias yarn-create-review-branch="cd $YARN_DEV_TOOLS_DIR;$YARN_DEV_TOOLS_ENV; poetry run exec-yarndevtools CREATE_REVIEW_BRANCH; popd"
alias yarn-upstream-commit-pr="cd $YARN_DEV_TOOLS_DIR;$YARN_DEV_TOOLS_ENV; poetry run exec-yarndevtools UPSTREAM_PR_FETCH; popd"
alias yarn-diff-patches="cd $YARN_DEV_TOOLS_DIR;$YARN_DEV_TOOLS_ENV; poetry run exec-yarndevtools DIFF_PATCHES_OF_JIRA; popd"
alias yarn-save-diff-as-patches="cd $YARN_DEV_TOOLS_DIR;$YARN_DEV_TOOLS_ENV; poetry run exec-yarndevtools SAVE_DIFF_AS_PATCHES; popd"
alias yarn-get-umbrella-data="cd $YARN_DEV_TOOLS_DIR;$YARN_DEV_TOOLS_ENV; poetry run exec-yarndevtools FETCH_JIRA_UMBRELLA_DATA; popd"
if [[ $LINUXENV_DEBUG_YARNDEVTOOLS == 1 ]]; then
print-yarn-dev-tools-aliases
fi
}
function setup-aliases-yarndevtools-package {
YARN_DEV_TOOLS_ENV="export HADOOP_DEV_DIR;export CLOUDERA_HADOOP_ROOT"
alias yarn-backport="$YARN_DEV_TOOLS_ENV; yarndevtools BACKPORT"
alias yarn-save-patch="$YARN_DEV_TOOLS_ENV; yarndevtools SAVE_PATCH"
alias yarn-create-review-branch="$YARN_DEV_TOOLS_ENV; yarndevtools CREATE_REVIEW_BRANCH"
alias yarn-upstream-commit-pr="$YARN_DEV_TOOLS_ENV; yarndevtools UPSTREAM_PR_FETCH"
alias yarn-diff-patches="$YARN_DEV_TOOLS_ENV; yarndevtools DIFF_PATCHES_OF_JIRA"
alias yarn-save-diff-as-patches="$YARN_DEV_TOOLS_ENV; yarndevtools SAVE_DIFF_AS_PATCHES"
alias yarn-get-umbrella-data="$YARN_DEV_TOOLS_ENV; yarndevtools FETCH_JIRA_UMBRELLA_DATA"
if [[ $LINUXENV_DEBUG_YARNDEVTOOLS == 1 ]]; then
print-yarn-dev-tools-aliases
fi
}
setup-vars
setup-aliases-yarndevtools-package