Libcloud ECS访问

时间:2017-11-19 17:32:06

标签: driver amazon-ecs libcloud

尝试为项目测试libcloud的ECS驱动程序。

我写了一个简单的测试:

Traceback (most recent call last):
  File "launch.py", line 32, in <module>
    cluster = conn.create_cluster('pippo',data['region'])
  File "/home/sergio/anaconda2/lib/python2.7/site-packages/libcloud/container/drivers/ecs.py", line 151, in create_cluster
    headers=self._get_headers('CreateCluster')
  File "/home/sergio/anaconda2/lib/python2.7/site-packages/libcloud/common/base.py", line 604, in request
    headers=headers, stream=stream)
  File "/home/sergio/anaconda2/lib/python2.7/site-packages/libcloud/http.py", line 212, in request
    verify=self.verification
  File "/home/sergio/anaconda2/lib/python2.7/site-packages/requests/sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/sergio/anaconda2/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/home/sergio/anaconda2/lib/python2.7/site-packages/requests/adapters.py", line 437, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ecs.%s.amazonaws.com', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5f16dca950>: Failed to establish a new connection: [Errno -2] Name or service not known',))

但运行它会产生此错误:

/libcloud/container/drivers/ecs.py

我认为问题在于主机字符串,包含%s。在库中挖掘看起来像该字符串是在文件中初始化的虚拟字符串:

headers: {'Host': u'ecs.us-east-1.amazonaws.com', 'User-Agent': 'libcloud/2.2.1 (Amazon Elastic Container Service) ', 'Content-Type': 'application/x-amz-json-1.1', 'Accept-Encoding': 'gzip,deflate', 'x-amz-target': 'AmazonEC2ContainerServiceV20141113.CreateCluster'}

我认为这些文件中应该有一个函数应该覆盖基本字符串,由于某些原因可能不会被调用但是,作为libcloud库的新手,它很难找到罪魁祸首。

奇怪的是,检查正在发送的标头,看起来它们包含正确的(?)地址:

                Date    Open    High     Low   Close
1    2017.01.30 07:00 1.25735 1.25761 1.25680 1.25698
2    2017.01.30 08:00 1.25697 1.25702 1.25615 1.25619
3    2017.01.30 09:00 1.25618 1.25669 1.25512 1.25533
4    2017.01.30 10:00 1.25536 1.25571 1.25093 1.25105
5    2017.01.30 11:00 1.25104 1.25301 1.25093 1.25262
6    2017.01.30 12:00 1.25260 1.25479 1.25229 1.25361
7    2017.01.30 13:00 1.25362 1.25417 1.25096 1.25177
8    2017.01.30 14:00 1.25177 1.25219 1.24900 1.25071
9    2017.01.30 15:00 1.25070 1.25307 1.24991 1.25238
10   2017.01.30 16:00 1.25238 1.25358 1.25075 1.25159

df = read.table(file = "GBPUSD60.csv", sep="," , header = TRUE)
dates = as.character(df$Date)
df$Date = NULL
Sept17 = xts(df, as.POSIXct(dates, format="%Y-%m-%d %H:%M"))

任何有经验的人都能指出我正确的方向吗?非常感谢。

1 个答案:

答案 0 :(得分:0)

这看起来像一个错误,这不是你做过的事情。