我应该如何在气流中使用正确的所有者任务? [英] how should I use the right owner task in airflow?

查看:31
本文介绍了我应该如何在气流中使用正确的所有者任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不了解气流中的所有者".ower 的注释是任务的所有者,建议使用 unix 用户名".我写了一些以下代码.

I dont understand the "owner" in airflow. the comment of ower is "the owner of the task, using the unix username is recommended". I wrote some the following code.

   Default_args = {
'owner': 'max',
'depends_on_past': False,
'start_date': datetime(2016, 7, 14),
'email': ['max@test.com'],
'email_on_failure': False,
'email_on_retry': False,
'retries': 1,
'retry_delay': timedelta(minutes=5),  

}

dag = DAG('dmp-annalect', default_args=default_args,
                schedule_interval='30 0 * * *')

pigjob_basedata = """{local_dir}/src/basedata/basedata.sh > 
{local_dir}/log/basedata/run_log &
""".format(local_dir=WORKSPACE)

task1_pigjob_basedata = BashOperator(
task_id='task1_pigjob_basedata',owner='max',
bash_command=pigjob_basedata ,
dag=dag)

但是我使用了命令airflow test dagid taskid 2016-07-20",出现了一些错误,...{bash_operator.py:77} 信息 - 放置:权限被拒绝:用户=气流,....

But I used the command "airflow test dagid taskid 2016-07-20" , I got some error, ... {bash_operator.py:77} INFO - put: Permission denied: user=airflow, ....

我以为我的工作使用最大"用户运行,但显然,使用气流"用户运行测试.

I thought that my job ran with "max" user, but apperently , ran test using 'airflow' user .

我希望如果我使用 'max' 用户运行我的任务,我该怎么做.

I hope if I run my task using 'max' user, how should I do.

推荐答案

我发现了这个问题.因为我在/home/airflow/设置了AIRFLOW_HOME,所以只有airflow可以访问这个文件目录.

I figured out this issue. Because I set the AIRFLOW_HOME in /home/airflow/, only airflow can access this file directory.

这篇关于我应该如何在气流中使用正确的所有者任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆