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


Python RestConnection.deploy_function方法代码示例

本文整理汇总了Python中lib.membase.api.rest_client.RestConnection.deploy_function方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.deploy_function方法的具体用法?Python RestConnection.deploy_function怎么用?Python RestConnection.deploy_function使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lib.membase.api.rest_client.RestConnection的用法示例。


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

示例1: EventingBaseTest

# 需要导入模块: from lib.membase.api.rest_client import RestConnection [as 别名]
# 或者: from lib.membase.api.rest_client.RestConnection import deploy_function [as 别名]

#.........这里部分代码省略.........
                log.info("Stats for Node {0} is \n{1} ".format(eventing_node.ip, json.dumps(out, sort_keys=True,
                                                                                          indent=4)))
                log.debug("Full Stats for Node {0} is \n{1} ".format(eventing_node.ip, json.dumps(full_out,
                                                                                                sort_keys=True,
                                                                                                indent=4)))
            raise Exception(
                "Bucket operations from handler code took lot of time to complete or didn't go through. Current : {0} "
                "Expected : {1}  dcp_backlog : {2}  TIMERS_IN_PAST : {3}".format(stats_dst["curr_items"],
                                                                                 expected_dcp_mutations,
                                                                                 total_dcp_backlog,
                                                                                 timers_in_past))
        # TODO : Use the following stats in a meaningful way going forward. Just printing them for debugging.
        # print all stats from all eventing nodes
        # These are the stats that will be used by ns_server and UI
        for eventing_node in eventing_nodes:
            rest_conn = RestConnection(eventing_node)
            out = rest_conn.get_all_eventing_stats()
            full_out = rest_conn.get_all_eventing_stats(seqs_processed=True)
            log.info("Stats for Node {0} is \n{1} ".format(eventing_node.ip, json.dumps(out, sort_keys=True,
                                                                                      indent=4)))
            log.debug("Full Stats for Node {0} is \n{1} ".format(eventing_node.ip, json.dumps(full_out, sort_keys=True,
                                                                                            indent=4)))

    def eventing_stats(self):
        self.sleep(30)
        content=self.rest.get_all_eventing_stats()
        js=json.loads(content)
        log.info("execution stats: {0}".format(js))
        # for j in js:
        #     print j["function_name"]
        #     print j["execution_stats"]["on_update_success"]
        #     print j["failure_stats"]["n1ql_op_exception_count"]

    def deploy_function(self, body, deployment_fail=False, wait_for_bootstrap=True):
        body['settings']['deployment_status'] = True
        body['settings']['processing_status'] = True
        # save the function so that it appears in UI
        content = self.rest.save_function(body['appname'], body)
        # deploy the function
        log.info("Deploying the following handler code")
        log.info("\n{0}".format(body['appcode']))
        content1 = self.rest.deploy_function(body['appname'], body)
        log.info("deploy Application : {0}".format(content1))
        if deployment_fail:
            res = json.loads(content1)
            if not res["compile_success"]:
                return
            else:
                raise Exception("Deployment is expected to be failed but no message of failure")
        if wait_for_bootstrap:
            # wait for the function to come out of bootstrap state
            self.wait_for_bootstrap_to_complete(body['appname'])

    def undeploy_and_delete_function(self, body):
        self.undeploy_function(body)
        self.delete_function(body)

    def undeploy_function(self, body):
        body['settings']['deployment_status'] = False
        body['settings']['processing_status'] = False
        # save the function so that it disappears from UI
        content = self.rest.save_function(body['appname'], body)
        # undeploy the function
        content1 = self.rest.set_settings_for_function(body['appname'], body['settings'])
        log.info("Undeploy Application : {0}".format(content1))
        return content, content1
开发者ID:membase,项目名称:testrunner,代码行数:70,代码来源:eventing_base.py


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