[英]AWS Lambda trigger on S3 bucket to Neptune "Failed to start new load for the source"
I wrote a lambda function which will trigger python code when a create event happens in S3 and Python script is supposed to read files from S3 and post them to Neptune server. I wrote a lambda function which will trigger python code when a create event happens in S3 and Python script is supposed to read files from S3 and post them to Neptune server.
When I test that, I am getting the following error.当我测试它时,我收到以下错误。
{
"requestId":"xxxxxxxx-1234-5678-9012-xxxxxxxxxxxxx",
"code":"ThrottlingException",
"detailedMessage":"Failed to start new load for the source s3://my-s3-url/file.ttl.
Max concurrent load limit breached. Limit is 1"
}
Code:代码:
def lambda_handler(event, context):
file_names = ["a.ttl", "b.ttl", "c.ttl"]
source_url = "s3://my-s3.aws.com/"
role = "my-role"
neptune_url = "https://my-neptune-server.aws.com/loader"
headers = {"Content-Type": "application/json"}
for name in file_names:
file = source_url+name
data = {"source": file, "iamRoleArn": role, "region": "region-1", "failOnError": "FALSE", "format": "turtle"}
loop = asyncio.get_event_loop()
task = loop.create_task(post_async(neptune_url, json.dumps(data), headers))
resp = loop.run_until_complete(task)
print(resp)
async def post_async(neptune_url, data, headers):
async with aiohttp.ClientSession() as session:
async with session.post(neptune_url, data=data, headers=headers) as response:
result = await response.text()
return result
I tried both Synchronous and Asynchronous ways.我尝试了同步和异步方式。 I am getting limited documentation in the web.
我在 web 中获得了有限的文档。 Can some one point me right direction?
有人能指出我正确的方向吗?
According to documentation: Max concurrent load limit is one根据文档: 最大并发负载限制为一
So probably you need to introduce some queue in your upload process.因此,您可能需要在上传过程中引入一些队列。 Or it may be
或者它可能是
According to documentation https://docs.aws.amazon.com/neptune/latest/userguide/load-api-reference-load.html ,根据文档https://docs.aws.amazon.com/neptune/latest/userguide/load-api-reference-load.html ,
Max concurrent load limit breached (HTTP 400)
If a load request is submitted without "queueRequest" : "TRUE",
and a load job is currently running, the request will fail with this error
you can add the following field to your payload,您可以将以下字段添加到您的有效负载中,
data = {
"source": file,
"iamRoleArn": role,
"region": "region-1",
"failOnError": "FALSE",
"format": "turtle",
"queueRequest" : "TRUE"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.