【发布时间】:2020-06-16 23:05:17
【问题描述】:
尝试运行 AWS Glue Python Shell 作业,但出现连接超时错误
【问题讨论】:
-
图片中有相关信息。如果他们离线,问题的上下文将会丢失。此外,其他人不会搜索相同的问题。
标签: amazon-web-services etl aws-glue
尝试运行 AWS Glue Python Shell 作业,但出现连接超时错误
【问题讨论】:
标签: amazon-web-services etl aws-glue
您似乎没有将 secretsmanager 端点添加到您的 VPC。由于流量不会离开AWS network,因此您的 Glue 作业的 VPC 内将无法访问 Internet。因此,如果您想连接到 secretsmanager,则需要将其添加到您的 VPC。
【讨论】:
嗨, 我们让 AWS Glue Python Shell 与所有依赖项一起工作,如下所示。 Glue 具有 awscli 依赖项以及 boto3
在 Glue 作业执行期间将 awscli 和 boto3 whl 文件添加到 Python 库路径。这个选项很慢,因为它必须下载和安装依赖项。
参考:AWS Wrangler Glue dependency build
colorama==0.4.3 docutils==0.15.2 rsa==4.5.0 s3transfer==0.3.3 PyYAML==5.3.1 botocore==1.19.23 pyasn1==0.4.8 jmespath==0.10.0 urllib3==1.26.2 python_dateutil==2.8.1 six==1.15.0
pip download -r requirements.txt -d libs
cd libs zip ../boto3-depends.zip *
将 boto3-depends.zip 上传到 s3 并将路径添加到 Glue 作业 参考文件路径 注意:它是引用文件路径,而不是Python 库路径
用于安装最新的 awcli 和 boto3 并加载到 AWS Python Glue Shell 的占位符代码。
import os.path import subprocess import sys # borrowed from https://stackoverflow.com/questions/48596627/how-to-import-referenced-files-in-etl-scripts def get_referenced_filepath(file_name, matchFunc=os.path.isfile): for dir_name in sys.path: candidate = os.path.join(dir_name, file_name) if matchFunc(candidate): return candidate raise Exception("Can't find file: ".format(file_name)) zip_file = get_referenced_filepath("awswrangler-depends.zip") subprocess.run() # Can't install --user, or without "-t ." because of permissions issues on the filesystem subprocess.run(, shell=True) #Additonal code as part of AWS Thread https://forums.aws.amazon.com/thread.jspa?messageID=954344 sys.path.insert(0, '/glue/lib/installation') keys = for k in keys: if 'boto' in k: del sys.modules[k] import boto3 print('boto3 version') print(boto3.__version__)
谢谢 萨拉特
【讨论】: