拒绝抄袭,从我做起,可以借鉴,必有说明
今天学习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."