本文整理匯總了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