本文整理汇总了Python中net.grinder.script.Test.record方法的典型用法代码示例。如果您正苦于以下问题:Python Test.record方法的具体用法?Python Test.record怎么用?Python Test.record使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.grinder.script.Test
的用法示例。
在下文中一共展示了Test.record方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Instrumented
# 需要导入模块: from net.grinder.script import Test [as 别名]
# 或者: from net.grinder.script.Test import record [as 别名]
class Instrumented(object):
next_test = 1
def __init__(self, partition):
grinder.logger.output('Selected dataset %s' % dataset_url)
self.test = Test(Instrumented.next_test,
'Partition into %d slices' % partition)
self.test_tot = Test(100 + Instrumented.next_test,
'Total for %d slices' % partition)
Instrumented.next_test += 1
self.requests = generate_subset_requests(variable, {'time': partition})
# Create a fresh callable to instrument
def f(req):
return req()
self.test.record(f)
self.f = f
def f2():
for req in self.requests:
grinder.logger.output('Requesting %s' % req)
data = self.f(req)
grinder.logger.output('Data returned of shape %s' % data.shape)
self.test_tot.record(f2)
self.f2 = f2
def __call__(self):
self.f2()
示例2: __call__
# 需要导入模块: from net.grinder.script import Test [as 别名]
# 或者: from net.grinder.script.Test import record [as 别名]
def __call__(self):
try:
test = Test(TestID.PTG_ASYNC, "StoRM ptg-async without release or file transfer")
test.record(do_prepare_to_get)
do_prepare_to_get(self.SRMclient)
except Exception:
error("Error executing ptg-async: %s" % traceback.format_exc())
示例3: __call__
# 需要导入模块: from net.grinder.script import Test [as 别名]
# 或者: from net.grinder.script.Test import record [as 别名]
def __call__(self):
test = Test(1, "StoRM srmLs")
client = SRMClientFactory.newSRMClient(SRM_ENDPOINT, PROXY_FILE)
surl_range = range(1, random.randrange(NUM_FILES))
surls = []
for i in surl_range:
surls.append(SURL_PREFIX + "/f" + str(i))
test.record(client)
log("Listing %d surls..." % surl_range[-1])
res = client.srmLs(surls,
MAX_WAITING_TIME_IN_MSEC)
log("List result: %s: %s" % (res.returnStatus.statusCode,
res.returnStatus.explanation))
statuses = res.getDetails().getPathDetailArray()
for s in statuses:
log("%s -> %s" %(s.getPath(),
s.getStatus().getStatusCode()))
示例4: __call__
# 需要导入模块: from net.grinder.script import Test [as 别名]
# 或者: from net.grinder.script.Test import record [as 别名]
def __call__(self):
test = Test(TestID.ATLAS_RENAMING, "Atlas renaming")
test.record(atlas_renaming)
debug("WEBDAV_ENDPOINT: %s" % WEBDAV_ENDPOINT)
atlas_renaming(HTTP_CLIENT)
示例5: __call__
# 需要导入模块: from net.grinder.script import Test [as 别名]
# 或者: from net.grinder.script.Test import record [as 别名]
def __call__(self):
try:
test = Test(TestID.TXFER_OUT, "StoRM file-transfer OUT")
test.record(file_transfer_out)
file_transfer_out(self.SRMclient, self.HTTPclient, self.local_file_path, self.target_file_surl, self.transfer_protocol)
cleanup(self.SRMclient, self.target_file_surl)
except Exception, e:
error("Error executing file-transfer-out: %s" % traceback.format_exc())
示例6: __call__
# 需要导入模块: from net.grinder.script import Test [as 别名]
# 或者: from net.grinder.script.Test import record [as 别名]
def __call__(self):
try:
test = Test(TestID.MIX_DAV, "StoRM Mix WebDAV test")
test.record(mix_dav)
mix_dav(self.HTTP_Client, self.local_file_path)
except Exception, e:
error("Error executing mix-dav: %s" % traceback.format_exc())
示例7: __call__
# 需要导入模块: from net.grinder.script import Test [as 别名]
# 或者: from net.grinder.script.Test import record [as 别名]
def __call__(self):
if (self.isFirstRun()):
self.initBarrier.await()
try:
test = Test(TestID.PUT_DAV, "StoRM PUT WebDAV test")
test.record(put_dav)
put_dav(self.remote_URL)
except Exception, e:
error("Error executing put-dav: %s" % traceback.format_exc())
示例8: __call__
# 需要导入模块: from net.grinder.script import Test [as 别名]
# 或者: from net.grinder.script.Test import record [as 别名]
def __call__(self):
if (grinder.runNumber == 0):
self.initBarrier.await()
try:
test = Test(TestID.GET_DAV, "StoRM GET WebDAV test")
test.record(get_dav)
get_dav(random.choice(FILE_URLS))
except Exception, e:
error("Error executing get-dav: %s" % traceback.format_exc())
示例9: __call__
# 需要导入模块: from net.grinder.script import Test [as 别名]
# 或者: from net.grinder.script.Test import record [as 别名]
def __call__(self, url, client):
test = Test(TestID.DELETE, "DELETE")
test.record(delete)
try:
return delete(url, client)
except Exception:
error("Error executing DELETE: %s" % traceback.format_exc())
raise
示例10: __call__
# 需要导入模块: from net.grinder.script import Test [as 别名]
# 或者: from net.grinder.script.Test import record [as 别名]
def __call__(self, url, client):
test = Test(TestID.MKCOL, "MKCOL")
test.record(mkcol)
try:
return mkcol(url, client)
except Exception:
error("Error executing MKCOL: %s" % traceback.format_exc())
raise
示例11: __call__
# 需要导入模块: from net.grinder.script import Test [as 别名]
# 或者: from net.grinder.script.Test import record [as 别名]
def __call__(self):
try:
test = Test(TestID.RM_MULTI, "StoRM srmRm multiple calls")
test.record(rm_files)
surls = setup(SRM_CLIENT, TEST_NUMFILES)
rm_files(SRM_CLIENT, surls)
except Exception, e:
error("Error executing rm-multi: %s" % traceback.format_exc())
示例12: __call__
# 需要导入模块: from net.grinder.script import Test [as 别名]
# 或者: from net.grinder.script.Test import record [as 别名]
def __call__(self, src_url, dest_url, client):
test = Test(TestID.MOVE, "MOVE")
test.record(move)
try:
return move(src_url, dest_url, client)
except Exception:
error("Error executing MOVE: %s" % traceback.format_exc())
raise
示例13: __call__
# 需要导入模块: from net.grinder.script import Test [as 别名]
# 或者: from net.grinder.script.Test import record [as 别名]
def __call__(self):
try:
if (SETUP_ONCE != "yes"):
self.target_file_surl = setup(self.SRMclient)
test = Test(TestID.TXFER_IN, "StoRM file-transfer IN")
test.record(file_transfer_in)
file_transfer_in(self.SRMclient, self.HTTPclient, self.target_file_surl, TRANSFER_PROTOCOL)
if (SETUP_ONCE != "yes"):
cleanup(self.SRMclient, self.target_file_surl)
except Exception, e:
error("Error executing file-transfer-in: %s" % traceback.format_exc())
示例14: __call__
# 需要导入模块: from net.grinder.script import Test [as 别名]
# 或者: from net.grinder.script.Test import record [as 别名]
def __call__(self, surls, transport_protocols, client):
if client is None:
raise Exception("Please set a non-null SRM client!")
test = Test(TestID.PTG, "StoRM PTG")
test.record(ptg)
try:
return ptg(surls, transport_protocols, client)
except Exception:
error("Error executing ptg: %s" % traceback.format_exc())
raise
示例15: test
# 需要导入模块: from net.grinder.script import Test [as 别名]
# 或者: from net.grinder.script.Test import record [as 别名]
def test(function):
"""
Decorator that creates a Grinder Test object for each function
and instruments it.
"""
global _testCounter
description = dedent(function.__doc__).strip()
testObject = Test(_testCounter, description)
_testCounter = _testCounter + 1
testObject.record(function)
return function