本文整理匯總了Python中vol.VolMgr.configure方法的典型用法代碼示例。如果您正苦於以下問題:Python VolMgr.configure方法的具體用法?Python VolMgr.configure怎麽用?Python VolMgr.configure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vol.VolMgr
的用法示例。
在下文中一共展示了VolMgr.configure方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from vol import VolMgr [as 別名]
# 或者: from vol.VolMgr import configure [as 別名]
def __init__(self):
LoggerMixin.configure()
db.configure()
Compute.configure()
SessContainer.configure()
VolMgr.configure()
JBoxAsyncJob.configure()
JBoxAsyncJob.init(JBoxAsyncJob.MODE_PUB)
self.application = tornado.web.Application(handlers=[
(r"/", MainHandler),
(r"/jboxadmin/", AdminHandler),
(r"/jboxping/", PingHandler),
(r"/jboxcors/", CorsHandler)
])
JBPluginHandler.add_plugin_handlers(self.application)
JBPluginUI.create_include_files()
# cookie_secret = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in xrange(32))
# use sesskey as cookie secret to be able to span multiple tornado servers
self.application.settings["cookie_secret"] = JBoxCfg.get('sesskey')
self.application.settings["plugin_features"] = JBox.get_pluggedin_features()
self.application.listen(JBoxCfg.get('interactive.manager_port'), address=socket.gethostname())
self.application.listen(JBoxCfg.get('interactive.manager_port'), address='localhost')
self.ioloop = tornado.ioloop.IOLoop.instance()
# run container maintainence every 5 minutes
run_interval = 5 * 60 * 1000
self.log_info("Container maintenance every " + str(run_interval / (60 * 1000)) + " minutes")
self.ct = tornado.ioloop.PeriodicCallback(JBox.do_housekeeping, run_interval, self.ioloop)
self.sigct = tornado.ioloop.PeriodicCallback(JBox.do_signals, 1000, self.ioloop)
示例2: __init__
# 需要導入模塊: from vol import VolMgr [as 別名]
# 或者: from vol.VolMgr import configure [as 別名]
def __init__(self):
dckr = docker.Client()
cfg = read_config()
cloud_cfg = cfg['cloud_host']
user_activation_cfg = cfg['user_activation']
LoggerMixin.setup_logger(level=cfg['root_log_level'])
LoggerMixin.DEFAULT_LEVEL = cfg['jbox_log_level']
db.configure_db(cfg)
CloudHost.configure(has_s3=cloud_cfg['s3'],
has_dynamodb=cloud_cfg['dynamodb'],
has_cloudwatch=cloud_cfg['cloudwatch'],
has_autoscale=cloud_cfg['autoscale'],
has_route53=cloud_cfg['route53'],
has_ebs=cloud_cfg['ebs'],
has_ses=cloud_cfg['ses'],
scale_up_at_load=cloud_cfg['scale_up_at_load'],
scale_up_policy=cloud_cfg['scale_up_policy'],
autoscale_group=cloud_cfg['autoscale_group'],
route53_domain=cloud_cfg['route53_domain'],
region=cloud_cfg['region'],
install_id=cloud_cfg['install_id'])
VolMgr.configure(dckr, cfg)
JBoxContainer.configure(dckr, cfg['docker_image'], cfg['mem_limit'], cfg['cpu_limit'],
cfg['numlocalmax'], cfg['async_job_port'], async_mode=JBoxAsyncJob.MODE_SUB)
self.log_debug("Backup daemon listening on port: " + str(cfg['async_job_port']))
self.queue = JBoxContainer.ASYNC_JOB
JBoxd.MAX_ACTIVATIONS_PER_SEC = user_activation_cfg['max_activations_per_sec']
JBoxd.MAX_AUTO_ACTIVATIONS_PER_RUN = user_activation_cfg['max_activations_per_run']
JBoxd.ACTIVATION_SUBJECT = user_activation_cfg['mail_subject']
JBoxd.ACTIVATION_BODY = user_activation_cfg['mail_body']
JBoxd.ACTIVATION_SENDER = user_activation_cfg['sender']
示例3: __init__
# 需要導入模塊: from vol import VolMgr [as 別名]
# 或者: from vol.VolMgr import configure [as 別名]
def __init__(self):
dckr = docker.Client()
cfg = JBox.cfg = read_config()
cloud_cfg = cfg['cloud_host']
LoggerMixin.setup_logger(level=cfg['root_log_level'])
LoggerMixin.DEFAULT_LEVEL = cfg['jbox_log_level']
JBoxHandler.configure(cfg)
db.configure_db(cfg)
CloudHost.configure(has_s3=cloud_cfg['s3'],
has_dynamodb=cloud_cfg['dynamodb'],
has_cloudwatch=cloud_cfg['cloudwatch'],
has_autoscale=cloud_cfg['autoscale'],
has_route53=cloud_cfg['route53'],
has_ebs=cloud_cfg['ebs'],
has_ses=cloud_cfg['ses'],
scale_up_at_load=cloud_cfg['scale_up_at_load'],
scale_up_policy=cloud_cfg['scale_up_policy'],
autoscale_group=cloud_cfg['autoscale_group'],
route53_domain=cloud_cfg['route53_domain'],
region=cloud_cfg['region'],
install_id=cloud_cfg['install_id'])
VolMgr.configure(dckr, cfg)
JBoxAsyncJob.configure(cfg)
JBoxContainer.configure(dckr, cfg['docker_image'], cfg['mem_limit'], cfg['cpu_limit'],
cfg['numlocalmax'], cfg['async_job_ports'])
self.application = tornado.web.Application([
(r"/", MainHandler),
(r"/hostlaunchipnb/", AuthHandler),
(r"/hostadmin/", AdminHandler),
(r"/ping/", PingHandler),
(r"/cors/", CorsHandler),
(r"/hw/", HomeworkHandler)
])
cookie_secret = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in xrange(32))
self.application.settings["cookie_secret"] = cookie_secret
self.application.settings["google_oauth"] = cfg["google_oauth"]
self.application.listen(cfg["port"])
self.ioloop = tornado.ioloop.IOLoop.instance()
# run container maintainence every 5 minutes
run_interval = 5 * 60 * 1000
self.log_info("Container maintenance every " + str(run_interval / (60 * 1000)) + " minutes")
self.ct = tornado.ioloop.PeriodicCallback(JBox.do_housekeeping, run_interval, self.ioloop)
示例4: __init__
# 需要導入模塊: from vol import VolMgr [as 別名]
# 或者: from vol.VolMgr import configure [as 別名]
def __init__(self):
LoggerMixin.configure()
db.configure()
Compute.configure()
SessContainer.configure()
APIContainer.configure()
VolMgr.configure()
JBoxAsyncJob.configure()
JBoxAsyncJob.init(JBoxAsyncJob.MODE_SUB)
self.log_debug("Container manager listening on ports: %s", repr(JBoxCfg.get('container_manager_ports')))
JBoxd.QUEUE = JBoxAsyncJob.get()
JBoxd.MAX_ACTIVATIONS_PER_SEC = JBoxCfg.get('user_activation.max_activations_per_sec')
JBoxd.MAX_AUTO_ACTIVATIONS_PER_RUN = JBoxCfg.get('user_activation.max_activations_per_run')
JBoxd.ACTIVATION_SUBJECT = JBoxCfg.get('user_activation.mail_subject')
JBoxd.ACTIVATION_BODY = JBoxCfg.get('user_activation.mail_body')
JBoxd.ACTIVATION_SENDER = JBoxCfg.get('user_activation.sender')
示例5: init
# 需要導入模塊: from vol import VolMgr [as 別名]
# 或者: from vol.VolMgr import configure [as 別名]
def init():
dckr = docker.Client()
cfg = read_config()
cloud_cfg = cfg['cloud_host']
cloud_cfg['backup_bucket'] = "juliabox_userbackup"
LoggerMixin.setup_logger(level=cfg['root_log_level'])
LoggerMixin.DEFAULT_LEVEL = cfg['jbox_log_level']
CloudHost.configure(has_s3=True, #cloud_cfg['s3'],
has_dynamodb=cloud_cfg['dynamodb'],
has_cloudwatch=cloud_cfg['cloudwatch'],
has_autoscale=cloud_cfg['autoscale'],
has_route53=cloud_cfg['route53'],
has_ebs=cloud_cfg['ebs'],
has_ses=cloud_cfg['ses'],
scale_up_at_load=cloud_cfg['scale_up_at_load'],
scale_up_policy=cloud_cfg['scale_up_policy'],
autoscale_group=cloud_cfg['autoscale_group'],
route53_domain=cloud_cfg['route53_domain'],
region=cloud_cfg['region'],
install_id=cloud_cfg['install_id'])
VolMgr.configure(dckr, cfg)
示例6:
# 需要導入模塊: from vol import VolMgr [as 別名]
# 或者: from vol.VolMgr import configure [as 別名]
CloudHost.configure(has_s3=cloud_cfg['s3'],
has_dynamodb=cloud_cfg['dynamodb'],
has_cloudwatch=cloud_cfg['cloudwatch'],
has_autoscale=cloud_cfg['autoscale'],
has_route53=cloud_cfg['route53'],
has_ebs=cloud_cfg['ebs'],
has_ses=cloud_cfg['ses'],
scale_up_at_load=cloud_cfg['scale_up_at_load'],
scale_up_policy=cloud_cfg['scale_up_policy'],
autoscale_group=cloud_cfg['autoscale_group'],
route53_domain=cloud_cfg['route53_domain'],
region=cloud_cfg['region'],
install_id=cloud_cfg['install_id'])
VolMgr.configure(dckr, cfg)
ts = JBoxVol._get_user_home_timestamp()
VolMgr.log_debug("user_home_timestamp: %s", ts.strftime("%Y%m%d_%H%M"))
img_dir, img_file = os.path.split(JBoxVol.USER_HOME_IMG)
new_img_file_name = 'user_home_' + ts.strftime("%Y%m%d_%H%M") + '.tar.gz'
new_img_file = os.path.join(img_dir, new_img_file_name)
shutil.copyfile(JBoxVol.USER_HOME_IMG, new_img_file)
VolMgr.log_debug("new image file is at : %s", new_img_file)
bucket = 'juliabox-user-home-templates'
VolMgr.log_debug("pushing new image file to s3 at: %s", bucket)
CloudHost.push_file_to_s3(bucket, new_img_file)