本文整理汇总了Python中daos_api.DaosPool.get_attr方法的典型用法代码示例。如果您正苦于以下问题:Python DaosPool.get_attr方法的具体用法?Python DaosPool.get_attr怎么用?Python DaosPool.get_attr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类daos_api.DaosPool
的用法示例。
在下文中一共展示了DaosPool.get_attr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PoolAttributeTest
# 需要导入模块: from daos_api import DaosPool [as 别名]
# 或者: from daos_api.DaosPool import get_attr [as 别名]
#.........这里部分代码省略.........
Test description: Test basic pool attribute tests (sync).
:avocado: tags=regression,pool,pool_attr,attribute,sync_poolattribute
"""
expected_for_param = []
name = self.params.get("name", '/run/attrtests/name_handles/*/')
expected_for_param.append(name[1])
value = self.params.get("value", '/run/attrtests/value_handles/*/')
if value[0] is None:
self.cancel("skipping these tests until DAOS-2170 is fixed")
expected_for_param.append(value[1])
attr_dict = {name[0]:value[0]}
if name[0] is not None:
if "largenumberofattr" in name[0]:
self.create_data_set()
attr_dict = self.large_data_set
expected_result = 'PASS'
for result in expected_for_param:
if result == 'FAIL':
expected_result = 'FAIL'
break
try:
self.pool.set_attr(data=attr_dict)
size, buf = self.pool.list_attr()
verify_list_attr(attr_dict, size.value, buf)
if name[0] is not None:
# Request something that doesn't exist
if "Negative" in name[0]:
name[0] = "rubbish"
# large attr test messes with the dictionary so skip
# the get test
if "largenumberofattr" not in name[0]:
results = {}
results = self.pool.get_attr([name[0]])
verify_get_attr(attr_dict, results)
if expected_result in ['FAIL']:
self.fail("Test was expected to fail but it passed.\n")
except DaosApiError as excep:
print(excep)
print(traceback.format_exc())
if expected_result == 'PASS':
self.fail("Test was expected to pass but it failed.\n")
def test_pool_attribute_asyn(self):
"""
Test ID: DAOS-1359
Test description: Test basic pool attribute tests (async).
:avocado: tags=regression,pool,pool_attr,attribute,async_poolattribute
"""
global GLOB_SIGNAL
global GLOB_RC
expected_for_param = []
name = self.params.get("name", '/run/attrtests/name_handles/*/')
# workaround until async functions are fixed
if name[0] is not None and "Negative" in name[0]:
pass
else:
expected_for_param.append(name[1])
value = self.params.get("value", '/run/attrtests/value_handles/*/')
if value[0] is None:
self.cancel("skipping this test until DAOS-2170 is fixed")
expected_for_param.append(value[1])
attr_dict = {name[0]:value[0]}
if name[0] is not None:
if "largenumberofattr" in name[0]:
self.create_data_set()
attr_dict = self.large_data_set
expected_result = 'PASS'
for result in expected_for_param:
if result == 'FAIL':
expected_result = 'FAIL'
break
try:
GLOB_SIGNAL = threading.Event()
self.pool.set_attr(attr_dict, None, cb_func)
GLOB_SIGNAL.wait()
if expected_result == 'PASS' and GLOB_RC != 0:
self.fail("RC not as expected after set_attr {0}"
.format(GLOB_RC))
if expected_result == 'FAIL' and GLOB_RC == 0:
self.fail("RC not as expected after set_attr {0}"
.format(GLOB_RC))
except DaosApiError as excep:
print (excep)
print (traceback.format_exc())
if expected_result == 'PASS':
self.fail("Test was expected to pass but it failed.\n")