拒絕抄襲,從我做起,可以借鑒,必有說明
今天學習azkaban的condition判斷
建立一個.flow檔案我是condition.flow
nodes:
- name: JobA
type: command
config:
command: bash /home/devuser/chenchi/azkaban.sh
- name: JobB
type: command
dependsOn:
- JobA
config:
command: echo "This is JobB."
param1: "AAA"
condition: ${JobA:param1} == "AAA"
- name: JobC
type: command
dependsOn:
- JobA
config:
command: echo "This is JobC."
condition: ${JobA:param1} == "BBB"
- name: JobD
type: command
dependsOn:
- JobB
- JobC
config:
command: echo "This is JobD."
condition: one_success
在建一個.project檔案我是condition.project檔案,備注我是azkaban3.81版本
azkaban-flow-version: 2.0
伺服器上
[[email protected] ~/chenchi]$ cat azkaban.sh
echo '{"param1":"AAA"}' > $JOB_OUTPUT_PROP_FILE
[[email protected] ~/chenchi]$
這裡我說明下 $JOB_OUTPUT_PROP_FILE 這個不要改成xx.txt這種。。。。
condition.flow 裡的jobB和C的condition裡擷取的${jobA:param1}就是這裡的json值
把兩個檔案達成zip包
上傳到azkaban後執行
還有一種說是嵌入式https://my.oschina.net/remainsu/blog/3072763
1、建立一個xx.flow和一個xx.project
2、打包zip上傳
3、exec
config:
param.test: param_test
nodes:
- name: jobC
type: command
config:
command: echo ${param.test} "This is jobC, embedded on embedded_flow."
dependsOn:
- embedded_flow
- name: embedded_flow
type: flow
config:
param.flow.test: param_flow_test
nodes:
- name: jobB
type: command
config:
command: echo "This is jobB."
dependsOn:
- jobA
- name: jobA
type: command
config:
command: echo ${param.flow.test} "This is jobA."