当气流试图在S3上写日志时,我得到一个错误。实际上,S3中不存在实际的日志文件。
我在额外字段中创建了类型为s3且具有密钥和机密的连接。 也将以下设置添加到airflow.cfg
remote_logging = True
remote_log_conn_id = MyS3Conn
remote_base_log_folder = s3://org-airflow-logs/logs
encrypt_s3_logs = False
我的错误越来越严重了。
worker_1 | [2018-11-21 18:20:38,211] {{connectionpool.py:735}} INFO - Starting new HTTPS connection (4): org-airflow-logs.s3.amazonaws.com
worker_1 | [2018-11-21 18:20:39,845] {{connectionpool.py:735}} INFO - Starting new HTTPS connection (3): org-airflow-logs.s3.amazonaws.com
worker_1 | [2018-11-21 18:20:43,177] {{connectionpool.py:735}} INFO - Starting new HTTPS connection (4): org-airflow-logs.s3.amazonaws.com
worker_1 | [2018-11-21 18:20:44,478] {{connectionpool.py:735}} INFO - Starting new HTTPS connection (5): org-airflow-logs.s3.amazonaws.com
[2018-11-21 15:34:08,456] {{s3_task_handler.py:173}} ERROR - Could not write logs to s3://org-airflow-logs/logs/tutorial/templated/2015-06-27T00:00:00+00:00/1.log
worker_1 | Traceback (most recent call last):
worker_1 | File "/usr/local/lib/python3.6/site-packages/airflow/utils/log/s3_task_handler.py", line 170, in s3_write
worker_1 | encrypt=configuration.conf.getboolean('core', 'ENCRYPT_S3_LOGS'),
worker_1 | File "/usr/local/lib/python3.6/site-packages/airflow/hooks/S3_hook.py", line 359, in load_string
worker_1 | encrypt=encrypt)
worker_1 | File "/usr/local/lib/python3.6/site-packages/airflow/hooks/S3_hook.py", line 399, in load_bytes
worker_1 | client.upload_fileobj(filelike_buffer, bucket_name, key, ExtraArgs=extra_args)
worker_1 | File "/usr/local/lib/python3.6/site-packages/boto3/s3/inject.py", line 539, in upload_fileobj
worker_1 | return future.result()
worker_1 | File "/usr/local/lib/python3.6/site-packages/s3transfer/futures.py", line 73, in result
worker_1 | return self._coordinator.result()
worker_1 | File "/usr/local/lib/python3.6/site-packages/s3transfer/futures.py", line 233, in result
worker_1 | raise self._exception
worker_1 | File "/usr/local/lib/python3.6/site-packages/s3transfer/tasks.py", line 126, in __call__
worker_1 | return self._execute_main(kwargs)
worker_1 | File "/usr/local/lib/python3.6/site-packages/s3transfer/tasks.py", line 150, in _execute_main
worker_1 | return_value = self._main(**kwargs)
worker_1 | File "/usr/local/lib/python3.6/site-packages/s3transfer/upload.py", line 692, in _main
worker_1 | client.put_object(Bucket=bucket, Key=key, Body=body, **extra_args)
worker_1 | File "/usr/local/lib/python3.6/site-packages/botocore/client.py", line 314, in _api_call
worker_1 | return self._make_api_call(operation_name, kwargs)
worker_1 | File "/usr/local/lib/python3.6/site-packages/botocore/client.py", line 599, in _make_api_call
worker_1 | operation_model, request_dict)
worker_1 | File "/usr/local/lib/python3.6/site-packages/botocore/endpoint.py", line 148, in make_request
worker_1 | return self._send_request(request_dict, operation_model)
worker_1 | File "/usr/local/lib/python3.6/site-packages/botocore/endpoint.py", line 177, in _send_request
worker_1 | success_response, exception):
worker_1 | File "/usr/local/lib/python3.6/site-packages/botocore/endpoint.py", line 273, in _needs_retry
worker_1 | caught_exception=caught_exception, request_dict=request_dict)
worker_1 | File "/usr/local/lib/python3.6/site-packages/botocore/hooks.py", line 227, in emit
worker_1 | return self._emit(event_name, kwargs)
worker_1 | File "/usr/local/lib/python3.6/site-packages/botocore/hooks.py", line 360, in _emit
worker_1 | aliased_event_name, kwargs, stop_on_response
worker_1 | File "/usr/local/lib/python3.6/site-packages/botocore/hooks.py", line 210, in _emit
worker_1 | response = handler(**kwargs)
worker_1 | File "/usr/local/lib/python3.6/site-packages/botocore/retryhandler.py", line 183, in __call__
worker_1 | if self._checker(attempts, response, caught_exception):
worker_1 | File "/usr/local/lib/python3.6/site-packages/botocore/retryhandler.py", line 251, in __call__
worker_1 | caught_exception)
worker_1 | File "/usr/local/lib/python3.6/site-packages/botocore/retryhandler.py", line 277, in _should_retry
worker_1 | return self._checker(attempt_number, response, caught_exception)
worker_1 | File "/usr/local/lib/python3.6/site-packages/botocore/retryhandler.py", line 317, in __call__
worker_1 | caught_exception)
worker_1 | File "/usr/local/lib/python3.6/site-packages/botocore/retryhandler.py", line 223, in __call__
worker_1 | attempt_number, caught_exception)
worker_1 | File "/usr/local/lib/python3.6/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
worker_1 | raise caught_exception
worker_1 | botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://org-airflow-logs.s3.amazonaws.com/logs/tutorial/templated/2015-06-27T00%3A00%3A00%2B00%3A00/1.log"
感谢您的帮助。