我使用Softlayer PythonAPI来获取硬件细节。脚本中途退出,出现以下API错误。我已经将服务器的数量限制在10台以下,但仍然存在错误。在
有没有办法可以关闭/断开与api的连接? 例如,如何在下面显式关闭“客户机”? 有什么可以克服的吗?在
client = SoftLayer.Client(username=USER, api_key=API_KEY,timeout = 1000)
hardware = client['Account'].getHardware(mask='id, fullyQualifiedDomainName,operatingSystem.softwareLicense.softwareDescription.longDescription,hardwareChassis.manufacturer,hardwareChassis.name,hardwareChassis.version,networkComponents.primaryIpAddress,processorCount,datacenter.name,primaryBackendIpAddress,motherboard.hardwareComponentModel.longDescription,processors.hardwareComponentModel.longDescription,memory.hardwareComponentModel.longDescription,memory.hardwareComponentModel.capacity,raidControllers.hardwareComponentModel.longDescription,hardDrives.hardwareComponentModel.longDescription',limit=limit,offset=offset);
File "/usr/local/bin/inv.py", line 90, in fetch_hw
hardware = client['Account'].getHardware(mask='id, fullyQualifiedDomainName,operatingSystem.softwareLicense.softwareDescription.longDescription,hardwareChassis.manufacturer,hardwareChassis.name,hardwareChassis.version,networkComponents.primaryIpAddress,processorCount,datacenter.name,primaryBackendIpAddress,motherboard,processors,memory,raidControllers,hardDrives',limit=limit,offset=offset);
File "/usr/local/lib/python2.7/site-packages/SoftLayer/API.py", line 392, in call_handler
return self(name, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/SoftLayer/API.py", line 360, in call
return self.client.call(self.name, name, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/SoftLayer/API.py", line 263, in call
return self.transport(request)
File "/usr/local/lib/python2.7/site-packages/SoftLayer/transports.py", line 199, in __call__
raise exceptions.TransportError(0, str(ex))
SoftLayer.exceptions.TransportError: TransportError(0): ("Connection broken: error(104, 'Connection reset by peer')", error(104, 'Connection reset by peer'))
当进程正在运行时,无法关闭/断开客户端。在
我能够用超过150个硬件项目重现错误,而不是更少。有时需要更多的时间来获取所有的数据,因为你的面具很长,我建议你尽量减少它。在
互联网连接可能会影响到你的结果,我建议你重新审视一下。在
如果你想得到所有的BMS,你可以试着一部分一部分地得到所有的BMS,下面你可以看到一个例子。 如果错误仍然存在,您可以尝试逐个检索它们(限制=1)
我希望这对你有帮助。在
敬上。在
相关问题 更多 >
编程相关推荐