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


Python router.ROUTER类代码示例

本文整理汇总了Python中qubell.api.provider.router.ROUTER的典型用法代码示例。如果您正苦于以下问题:Python ROUTER类的具体用法?Python ROUTER怎么用?Python ROUTER使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ROUTER类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: schedule_workflow

 def schedule_workflow(self, name, timestamp, parameters=None):
     if not parameters: parameters = {}
     log.info("Scheduling workflow %s on instance %s (%s), timestamp: %s" % (name, self.name, self.id, timestamp))
     log.debug("Parameters: %s" % parameters)
     payload = {'parameters': parameters, 'timestamp':timestamp}
     router.post_instance_workflow_schedule(org_id=self.organizationId, instance_id=self.instanceId, wf_name=name, data=json.dumps(payload))
     return True
开发者ID:netvl,项目名称:contrib-python-qubell-client,代码行数:7,代码来源:instance.py

示例2: run_workflow

 def run_workflow(self, name, parameters=None):
     if not parameters: parameters = {}
     log.info("Running workflow %s on instance %s (%s)" % (name, self.name, self.id))
     log.debug("Parameters: %s" % parameters)
     self._last_workflow_started_time = time.gmtime(time.time())
     router.post_instance_workflow(org_id=self.organizationId, instance_id=self.instanceId, wf_name=name, data=json.dumps(parameters))
     return True
开发者ID:netvl,项目名称:contrib-python-qubell-client,代码行数:7,代码来源:instance.py

示例3: add_as_service

 def add_as_service(self, environments=None, environment_ids=None):
     if not environments or environment_ids:
         # Use default if not set
         environments = [self.environment,]
     if environments:
         data = [env.environmentId for env in environments]
     else:
         assert isinstance(environment_ids, list)
         data = environment_ids
     router.post_instance_services(org_id=self.organizationId, instance_id=self.instanceId, data=json.dumps(data))
开发者ID:rkh-popcorn,项目名称:contrib-python-qubell-client,代码行数:10,代码来源:instance.py

示例4: connect

    def connect(tenant, user, password):

        router.base_url = tenant
        router.connect(user, password)

        #todo: remove auth mimics when routes are used everywhere
        router.tenant = tenant
        router.user = user
        router.password = password
        return QubellPlatform(auth=router)
开发者ID:rkh-popcorn,项目名称:contrib-python-qubell-client,代码行数:10,代码来源:platform.py

示例5: get_activitylog

    def get_activitylog(self, after=None, severity=None, start=None, end=None):
        """
        Returns activitylog object
        severity - filter severity ('INFO', DEBUG')
        start/end - time or log text

        """
        if after:
            log = router.get_instance_activitylog(org_id=self.organizationId, instance_id=self.instanceId, timestamp=after).json()
        log = router.get_instance_activitylog(org_id=self.organizationId, instance_id=self.instanceId).json()

        return activityLog(log, severity=severity, start=start, end=end)
开发者ID:netvl,项目名称:contrib-python-qubell-client,代码行数:12,代码来源:instance.py

示例6: new

    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,代码行数:29,代码来源:instance.py

示例7: update

    def update(self, **kwargs):
        if kwargs.get('manifest'):
            self.upload(kwargs.pop('manifest'))
        log.info("Updating application: %s" % self.name)

        data = json.dumps(kwargs)
        resp = router.put_application(org_id=self.organizationId, app_id=self.applicationId, data=data)
        return resp.json()
开发者ID:rkh-popcorn,项目名称:contrib-python-qubell-client,代码行数:8,代码来源:application.py

示例8: list_instances_json

 def list_instances_json(self, application=None):
     """ Get list of instances in json format converted to list"""
     if application:  # todo: application should not be parameter here. Application should do its own list
         warnings.warn("organization.list_instances_json(app) is deprecated, use app.list_instances_json", DeprecationWarning, stacklevel=2)
         instances = application.list_instances_json()
     else:  # Return all instances in organization
         instances = router.get_instances(org_id=self.organizationId).json()
     return [ins for ins in instances if ins['status'] not in DEAD_STATUS]
开发者ID:rkh-popcorn,项目名称:contrib-python-qubell-client,代码行数:8,代码来源:organization.py

示例9: new

    def new(organization, name, manifest):
        log.info("Creating application: %s" % name)

        resp = router.post_organization_application(org_id=organization.organizationId,
                                                    files={'path': manifest.content},
                                                    data={'manifestSource': 'upload', 'name': name})
        app = Application(organization, resp.json()['id'])
        app.manifest = manifest
        return app
开发者ID:rkh-popcorn,项目名称:contrib-python-qubell-client,代码行数:9,代码来源:application.py

示例10: new

 def new(organization, name, zone=None, default=False):
     log.info("Creating environment: %s" % name)
     if not zone:
         zone = organization.zone.zoneId
     data = {'isDefault': default,
             'name': name,
             'backend': zone,
             'organizationId': organization.organizationId}
     resp = router.post_organization_environment(org_id=organization.organizationId, data=json.dumps(data)).json()
     return Environment(organization, id=resp['id'])
开发者ID:rkh-popcorn,项目名称:contrib-python-qubell-client,代码行数:10,代码来源:environment.py

示例11: json

    def json(self):
        '''
        return __cached_json, if accessed withing 300 ms.
        This allows to optimize calls when many parameters of entity requires withing short time.
        '''

        if self.fresh():
            return self.__cached_json
        self.__last_read_time = time.time()
        self.__cached_json = router.get_instance(org_id=self.organizationId, instance_id=self.instanceId).json()
        return self.__cached_json
开发者ID:rkh-popcorn,项目名称:contrib-python-qubell-client,代码行数:11,代码来源:instance.py

示例12: create_revision

 def create_revision(self, name, instance, parameters=[], version=None):
     if not version:
         version=self.get_manifest()['manifestVersion']
     payload = json.dumps({ 'name': name,
                 'parameters': parameters,
                 'submoduleRevisions': {},
                 'returnValues': [],
                 'applicationId': self.applicationId,
                 'applicationName': self.name,
                 'version': version,
                 'instanceId': instance.instanceId})
     resp = router.post_revision(org_id=self.organizationId, app_id=self.applicationId, data=payload)
     return self.get_revision(id=resp.json()['id'])
开发者ID:rkh-popcorn,项目名称:contrib-python-qubell-client,代码行数:13,代码来源:application.py

示例13: new

 def new(organization, name, zone_id=None, default=False):
     log.info("Creating environment: %s" % name)
     if not zone_id:
         zone_id = organization.zone.zoneId
     data = {'isDefault': default,
             'name': name,
             'backend': zone_id,
             'organizationId': organization.organizationId}
     log.debug(data)
     resp = router.post_organization_environment(org_id=organization.organizationId, data=json.dumps(data)).json()
     env = Environment(organization, id=resp['id'])
     log.info("Environment created: %s (%s)" % (name,env.environmentId))
     return env
开发者ID:netvl,项目名称:contrib-python-qubell-client,代码行数:13,代码来源:environment.py

示例14: reconfigure

    def reconfigure(self, revision=None, parameters=None, submodules=None):
        #note: be carefull refactoring this, or you might have unpredictable results
        #todo: private api seems requires at least presence of submodule names if exist
        payload = {}
        payload['parameters'] = self.parameters

        if revision:
            payload['revisionId'] = revision.id

        if submodules:
            payload['submodules'] = submodules
        if parameters is not None:
            payload['parameters'] = parameters

        resp = router.put_instance_configuration(org_id=self.organizationId, instance_id=self.instanceId, data=json.dumps(payload))
        return resp.json()
开发者ID:netvl,项目名称:contrib-python-qubell-client,代码行数:16,代码来源:instance.py

示例15: new

    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,代码行数:19,代码来源:instance.py


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