當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。