Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 每当文件在S3中着陆时,踢胶水爬虫_Python_Amazon S3_Aws Lambda_Aws Glue - Fatal编程技术网

Python 每当文件在S3中着陆时,踢胶水爬虫

Python 每当文件在S3中着陆时,踢胶水爬虫,python,amazon-s3,aws-lambda,aws-glue,Python,Amazon S3,Aws Lambda,Aws Glue,我有下面的代码可以在文件到达S3存储桶时启动glue crawler。我添加了触发器,并用s3put对象给出了bucket的位置。但是,lambda不会在文件到达时自动启动爬虫程序。但是,如果我单击lambda函数上的test,它将启动Glue Crawler。请告诉我这里有什么问题 import json import boto3 print('Loading function') glue = boto3.client(service_name='glue', region_na

我有下面的代码可以在文件到达S3存储桶时启动glue crawler。我添加了触发器,并用s3put对象给出了bucket的位置。但是,lambda不会在文件到达时自动启动爬虫程序。但是,如果我单击lambda函数上的test,它将启动Glue Crawler。请告诉我这里有什么问题

    import json
import boto3

print('Loading function')

glue = boto3.client(service_name='glue', region_name='us-east-1',endpoint_url='https://glue.us-east-1.amazonaws.com')

def lambda_handler(event, context):
    #print("Received event: " + json.dumps(event, indent=2))

    try:
       glue.start_crawler(Name='test')
    except Exception as e:
        print(e)
        print('Error starting crawler')
        raise e

在AWS Lambda->添加触发器->在触发器配置中选择S3->选择存储桶名称,等等

添加触发器后,当文件上传到bucket时,lambda将被触发