本文整理汇总了Python中service.Service.run方法的典型用法代码示例。如果您正苦于以下问题:Python Service.run方法的具体用法?Python Service.run怎么用?Python Service.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类service.Service
的用法示例。
在下文中一共展示了Service.run方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: service_create
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import run [as 别名]
def service_create(image, name, start, target_num_instances, instance_size, run_command, env, ports, exposes,
volumes, links, namespace, scaling_info, custom_domain_name, region_name):
image_name, image_tag = util.parse_image_name_tag(image)
instance_ports, port_list = util.parse_instance_ports(ports)
expose_list = util.merge_internal_external_ports(port_list, exposes)
instance_ports.extend(expose_list)
instance_envvars = util.parse_envvars(env)
links = util.parse_links(links)
volumes = util.parse_volumes(volumes)
scaling_mode, scaling_cfg = util.parse_autoscale_info(scaling_info)
if scaling_mode is None:
scaling_mode = 'MANUAL'
service = Service(name=name,
image_name=image_name,
image_tag=image_tag,
target_num_instances=target_num_instances,
instance_size=instance_size,
run_command=run_command,
instance_ports=instance_ports,
instance_envvars=instance_envvars,
volumes=volumes,
links=links,
namespace=namespace,
scaling_mode=scaling_mode,
autoscaling_config=scaling_cfg,
custom_domain_name=custom_domain_name,
region_name=region_name)
if start:
service.run()
else:
service.create()
示例2: main
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import run [as 别名]
def main(argv):
root = None
if len(argv) > 0:
root = argv[0]
services = dict()
config = yaml.safe_load(open('/vagrant/services/config.yml'))
for name, config in list(config.items()):
service = Service(name, config)
services[name] = service
graph = build_graph(services, root)
for name in reversed(graph):
service = services[name]
print("REMOVE %s ..." % name)
service.rmi()
for name in graph:
service = services[name]
print("BUILD %s ..." % name)
service.build()
print("RUN %s ..." % name)
service.run()
示例3: yoback
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import run [as 别名]
@app.route('/yoback/<service_id>')
def yoback(service_id, methods=('POST',)):
print 'got yo'
oid = None
try:
oid = ObjectId(service_id)
except Exception, e:
return abort(404)
cursor = db.services.find({'_id': oid})
if cursor.count() == 0:
return abort(404)
s = Service(cursor.next())
data = {x: request.args[x] for x in request.args
if x in ['username', 'link', 'location']}
s.run(db, data)
db.services.update({'_id': s._id}, {'$inc': {'rating': 1}})
return 'yo'
# Initialize flask-login
init_login()
# Create admin
admin = admin.Admin(app, 'Accounts', index_view=MyAdminIndexView(),
base_template='my_master.html')
if __name__ == '__main__':
# Start app