本文整理汇总了Python中lib.membase.api.rest_client.RestConnection.save_function方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.save_function方法的具体用法?Python RestConnection.save_function怎么用?Python RestConnection.save_function使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.membase.api.rest_client.RestConnection
的用法示例。
在下文中一共展示了RestConnection.save_function方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EventingBaseTest
# 需要导入模块: from lib.membase.api.rest_client import RestConnection [as 别名]
# 或者: from lib.membase.api.rest_client.RestConnection import save_function [as 别名]
class EventingBaseTest(QueryHelperTests, BaseTestCase):
panic_count = 0
def setUp(self):
if self._testMethodDoc:
log.info("\n\nStarting Test: %s \n%s" % (self._testMethodName, self._testMethodDoc))
else:
log.info("\n\nStarting Test: %s" % (self._testMethodName))
self.input = TestInputSingleton.input
self.input.test_params.update({"default_bucket": False})
super(EventingBaseTest, self).setUp()
self.master = self.servers[0]
self.server = self.master
self.restServer = self.get_nodes_from_services_map(service_type="eventing")
self.rest = RestConnection(self.restServer)
self.log.info(
"Setting the min possible memory quota so that adding mode nodes to the cluster wouldn't be a problem.")
self.rest.set_service_memoryQuota(service='memoryQuota', memoryQuota=330)
self.rest.set_service_memoryQuota(service='indexMemoryQuota', memoryQuota=INDEX_QUOTA)
# self.rest.set_service_memoryQuota(service='eventingMemoryQuota', memoryQuota=EVENTING_QUOTA)
self.src_bucket_name = self.input.param('src_bucket_name', 'src_bucket')
self.eventing_log_level = self.input.param('eventing_log_level', 'TRACE')
self.dst_bucket_name = self.input.param('dst_bucket_name', 'dst_bucket')
self.dst_bucket_name1 = self.input.param('dst_bucket_name1', 'dst_bucket1')
self.metadata_bucket_name = self.input.param('metadata_bucket_name', 'metadata')
self.create_functions_buckets = self.input.param('create_functions_buckets', True)
self.docs_per_day = self.input.param("doc-per-day", 1)
random.seed(datetime.time)
self.function_name = "Function_{0}_{1}".format(random.randint(1, 1000000000), self._testMethodName)
def tearDown(self):
# catch panics and print it in the test log
self.check_eventing_logs_for_panic()
super(EventingBaseTest, self).tearDown()
def create_save_function_body(self, appname, appcode, description="Sample Description",
checkpoint_interval=10000, cleanup_timers=False,
dcp_stream_boundary="everything", deployment_status=True,
rbacpass="password", rbacrole="admin", rbacuser="cbadminbucket",
skip_timer_threshold=86400,
sock_batch_size=1, tick_duration=5000, timer_processing_tick_interval=500,
timer_worker_pool_size=3, worker_count=3, processing_status=True,
cpp_worker_thread_count=1, multi_dst_bucket=False, execution_timeout=3,
data_chan_size=10000, worker_queue_cap=100000):
body = {}
body['appname'] = appname
script_dir = os.path.dirname(__file__)
abs_file_path = os.path.join(script_dir, appcode)
fh = open(abs_file_path, "r")
body['appcode'] = fh.read()
fh.close()
body['depcfg'] = {}
body['depcfg']['buckets'] = []
body['depcfg']['buckets'].append({"alias": self.dst_bucket_name, "bucket_name": self.dst_bucket_name})
if multi_dst_bucket:
body['depcfg']['buckets'].append({"alias": self.dst_bucket_name1, "bucket_name": self.dst_bucket_name1})
body['depcfg']['metadata_bucket'] = self.metadata_bucket_name
body['depcfg']['source_bucket'] = self.src_bucket_name
body['settings'] = {}
body['settings']['checkpoint_interval'] = checkpoint_interval
body['settings']['cleanup_timers'] = cleanup_timers
body['settings']['dcp_stream_boundary'] = dcp_stream_boundary
body['settings']['deployment_status'] = deployment_status
body['settings']['description'] = description
body['settings']['log_level'] = self.eventing_log_level
body['settings']['rbacpass'] = rbacpass
body['settings']['rbacrole'] = rbacrole
body['settings']['rbacuser'] = rbacuser
body['settings']['skip_timer_threshold'] = skip_timer_threshold
body['settings']['sock_batch_size'] = sock_batch_size
body['settings']['tick_duration'] = tick_duration
body['settings']['timer_processing_tick_interval'] = timer_processing_tick_interval
body['settings']['timer_worker_pool_size'] = timer_worker_pool_size
body['settings']['worker_count'] = worker_count
body['settings']['processing_status'] = processing_status
body['settings']['cpp_worker_thread_count'] = cpp_worker_thread_count
body['settings']['execution_timeout'] = execution_timeout
body['settings']['data_chan_size'] = data_chan_size
body['settings']['worker_queue_cap'] = worker_queue_cap
return body
def wait_for_bootstrap_to_complete(self, name):
result = self.rest.get_deployed_eventing_apps()
count = 0
while name not in result and count < 20:
self.sleep(30, message="Waiting for eventing node to come out of bootstrap state...")
count += 1
result = self.rest.get_deployed_eventing_apps()
if count == 20:
raise Exception(
'Eventing took lot of time to come out of bootstrap state or did not successfully bootstrap')
def wait_for_undeployment(self, name):
result = self.rest.get_deployed_eventing_apps()
count = 0
while name in result and count < 20:
self.sleep(30, message="Waiting for undeployment of function...")
count += 1
result = self.rest.get_deployed_eventing_apps()
if count == 20:
#.........这里部分代码省略.........