Apache Airflow和AWS Glue之间的连接出现问题

Mad*_*ess 4 airflow aws-glue

我在虚拟机Apache Airflow上本地启动,我想连接到Amazon Glue作业以运行它们。我从pull-request获取的源代码:https : //github.com/apache/incubator-airflow/pull/3504/files

那么,我应该在Airflow UI中建立哪些连接来运行Amazon Glue作业?你能告诉我一些文件吗?因为我在官方文档中没有发现任何有用的信息。

对于dag我使用简单的代码:

from datetime import datetime
from airflow import DAG
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python_operator import PythonOperator
from airflow.operators.aws_glue_operator import AWSGlueJobOperator
def print_hello():
    return 'Hello hello!'

dag = DAG('hello_world', description='Simple glue DAG',
          schedule_interval='0 0 * * *',
          start_date=datetime(2018, 6, 28), catchup=False)

awsGlueOperator = AWSGlueJobOperator(job_name='FIRST_JOB', script_location='https://s3.us-east-2.amazonaws.com/path-to-script',s3_bucket='https://s3.console.aws.amazon.com/s3/', iam_role_name='AWSGlueServiceRole', dag=dag)

hello_operator = PythonOperator(task_id='hello_task', python_callable=print_hello, dag=dag)

awsGlueOperator >> hello_operator
Run Code Online (Sandbox Code Playgroud)

先感谢您。

Vir*_*ekh 5

看起来您正在使用的GlueOperator使用AWS Hook。跳入该代码的源代码表明,aws键等可以作为JSON对象进入extras字段。因此,您可能只需要使用Amazon Web ServicesConnection类型并在其中填写适当的值即可。

外观如下所示(在具有更改的颜色和字体的UI中): 在此处输入图片说明