本文整理汇总了Python中service.Service.fetch方法的典型用法代码示例。如果您正苦于以下问题:Python Service.fetch方法的具体用法?Python Service.fetch怎么用?Python Service.fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类service.Service
的用法示例。
在下文中一共展示了Service.fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_service_list
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import fetch [as 别名]
def _get_service_list(self, namespace):
service_list = []
for service_level in self.services:
for service in service_level:
try:
service_list.append(Service.fetch(service.name, namespace))
except AlaudaServerError:
continue
return service_list
示例2: _wait_services_ready
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import fetch [as 别名]
def _wait_services_ready(self, service_list):
services = copy.copy(service_list)
start_time = int(time.time())
while len(services) > 0:
time.sleep(5)
for i in range(len(services))[::-1]:
service = Service.fetch(services[i].name)
state = service.get_state()
if state == 'Deploying':
print 'Service {} is deploying'.format(services[i].name)
continue
elif state == 'Running':
print 'Start service {} success!'.format(services[i].name)
services.remove(services[i])
continue
elif state == 'Stopped' and int(time.time()) - start_time < MAX_ERROR_TIME:
continue
else:
return 'Create/Start {0} fail! State is: {1}'.format(services[i].name, state)
current_time = int(time.time())
if current_time - start_time > MAX_CREATE_TIME:
return 'Time out'
return None
示例3: scale
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import fetch [as 别名]
def scale(self, scale_dict, namespace):
for name, number in scale_dict.items():
service = Service.fetch(name, namespace)
service.scale(number)
示例4: service_stop
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import fetch [as 别名]
def service_stop(name, namespace):
service = Service.fetch(name, namespace)
service.stop()
示例5: service_inspect
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import fetch [as 别名]
def service_inspect(name, namespace):
service = Service.fetch(name, namespace)
result = service.inspect()
util.print_json_result(result)
示例6: service_start
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import fetch [as 别名]
def service_start(name, namespace):
service = Service.fetch(name, namespace)
service.start()
示例7: instance_logs
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import fetch [as 别名]
def instance_logs(name, uuid, namespace, start_time=None, end_time=None):
service = Service.fetch(name, namespace)
instance = service.get_instance(uuid)
result = instance.logs(start_time, end_time)
util.print_logs(result)
示例8: backup_create
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import fetch [as 别名]
def backup_create(name, service_name, mounted_dir, namespace):
service = Service.fetch(service_name, namespace)
backup = Backup(service=service, name=name, mounted_dir=mounted_dir)
backup.create()
示例9: instance_ps
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import fetch [as 别名]
def instance_ps(name, namespace):
service = Service.fetch(name, namespace)
instance_list = service.list_instances()
util.print_instance_ps_output(instance_list)
示例10: instance_inspect
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import fetch [as 别名]
def instance_inspect(name, uuid, namespace):
service = Service.fetch(name, namespace)
instance = service.get_instance(uuid)
result = instance.inspect()
util.print_json_result(result)
示例11: service_logs
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import fetch [as 别名]
def service_logs(name, namespace, start_time, end_time):
service = Service.fetch(name, namespace)
result = service.logs(start_time, end_time)
util.print_logs(result)
示例12: service_disable_autoscaling
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import fetch [as 别名]
def service_disable_autoscaling(name, namespace, target_num_instances):
service = Service.fetch(name, namespace)
service.disable_autoscaling(target_num_instances)
示例13: service_enable_autoscaling
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import fetch [as 别名]
def service_enable_autoscaling(name, namespace, autoscaling_config):
_, scaling_cfg = util.parse_autoscale_info(("AUTO", autoscaling_config))
service = Service.fetch(name, namespace)
service.enable_autoscaling(scaling_cfg)
示例14: service_scale
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import fetch [as 别名]
def service_scale(descriptor, namespace):
scale_dict = util.parse_scale(descriptor)
for service_name, service_num in scale_dict.items():
service = Service.fetch(service_name, namespace)
service.scale(service_num)
示例15: service_ports
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import fetch [as 别名]
def service_ports(name, namespace):
service = Service.fetch(name, namespace)
util.print_ports(service)