当前位置: 首页>>代码示例>>Python>>正文


Python ROUTER.post_organization_instance方法代码示例

本文整理汇总了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
开发者ID:netvl,项目名称:contrib-python-qubell-client,代码行数:31,代码来源:instance.py

示例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
开发者ID:rkh-popcorn,项目名称:contrib-python-qubell-client,代码行数:21,代码来源:instance.py


注:本文中的qubell.api.provider.router.ROUTER.post_organization_instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。