本文整理汇总了Python中qubell.api.provider.router.ROUTER.post_organization_instance方法的典型用法代码示例。如果您正苦于以下问题:Python ROUTER.post_organization_instance方法的具体用法?Python ROUTER.post_organization_instance怎么用?Python ROUTER.post_organization_instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qubell.api.provider.router.ROUTER
的用法示例。
在下文中一共展示了ROUTER.post_organization_instance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: new
# 需要导入模块: from qubell.api.provider.router import ROUTER [as 别名]
# 或者: from qubell.api.provider.router.ROUTER import post_organization_instance [as 别名]
def new(application, revision=None, environment=None, name=None, parameters=None, submodules=None, destroyInterval=None):
if not environment:
environment = application.organization.defaultEnvironment
if not parameters: parameters = {}
conf = {}
conf['parameters'] = parameters
conf['environmentId'] = environment.environmentId
if name:
conf['instanceName'] = name
if destroyInterval:
conf['destroyInterval'] = destroyInterval
if revision:
conf['revisionId'] = revision.id
conf['submodules'] = submodules or {}
log.info("Starting instance: %s\n Application: %s (%s)\n Environment: %s (%s)\n Submodules: %s\n destroyInterval: %s" %
(name,
application.name, application.applicationId,
environment.name, environment.environmentId,
submodules, destroyInterval))
log.debug("Instance configuration: %s" % conf)
data = json.dumps(conf)
before_creation = time.gmtime(time.time())
resp = router.post_organization_instance(org_id=application.organizationId, app_id=application.applicationId, data=data)
instance = Instance(organization=application.organization, id=resp.json()['id'])
instance._last_workflow_started_time = before_creation
log.debug("Instance %s (%s) started." % (instance.name, instance.id))
return instance
示例2: new
# 需要导入模块: from qubell.api.provider.router import ROUTER [as 别名]
# 或者: from qubell.api.provider.router.ROUTER import post_organization_instance [as 别名]
def new(application, revision=None, environment=None, name=None, parameters=None, destroyInterval=None):
if not parameters: parameters = {}
if environment: # if environment set, it overrides parameter
parameters['environmentId'] = environment.environmentId
elif not 'environmentId' in parameters.keys(): # if not set and not in params, use default
parameters['environmentId'] = application.organization.defaultEnvironment.environmentId
if name:
parameters['instanceName'] = name
if destroyInterval:
parameters['destroyInterval'] = str(destroyInterval)
if revision:
parameters['revisionId'] = revision.revisionId
data = json.dumps(parameters)
before_creation = time.gmtime(time.time())
resp = router.post_organization_instance(org_id=application.organizationId, app_id=application.applicationId, data=data)
instance = Instance(organization=application.organization, id=resp.json()['id'])
instance._last_workflow_started_time = before_creation
return instance