本文整理汇总了Python中omero.gateway.BlitzGateway._waitOnCmd方法的典型用法代码示例。如果您正苦于以下问题:Python BlitzGateway._waitOnCmd方法的具体用法?Python BlitzGateway._waitOnCmd怎么用?Python BlitzGateway._waitOnCmd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类omero.gateway.BlitzGateway
的用法示例。
在下文中一共展示了BlitzGateway._waitOnCmd方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testFakeImport
# 需要导入模块: from omero.gateway import BlitzGateway [as 别名]
# 或者: from omero.gateway.BlitzGateway import _waitOnCmd [as 别名]
def testFakeImport(self):
# TODO: should likely be in the "fs" namespace
req = omero.cmd.OriginalMetadataRequest()
client = self.new_client()
rsp = self.fullImport(client) # Note: fake test produces no metadata!
image = rsp.objects[0]
req.imageId = image.id.val
gateway = BlitzGateway(client_obj=client)
# Load via the gateway
image = gateway.getObject("Image", image.id.val)
assert 3 == len(image.loadOriginalMetadata())
# Load via raw request
handle = client.sf.submit(req)
try:
gateway._waitOnCmd(handle, failonerror=True)
rsp = handle.getResponse()
assert dict == type(rsp.globalMetadata)
assert dict == type(rsp.seriesMetadata)
finally:
handle.close()
示例2: testSimpleDelete
# 需要导入模块: from omero.gateway import BlitzGateway [as 别名]
# 或者: from omero.gateway.BlitzGateway import _waitOnCmd [as 别名]
def testSimpleDelete(self):
filename = self.unique_dir + "/file.txt"
mrepo = self.getManagedRepo()
ofile = self.createFile(mrepo, filename)
gateway = BlitzGateway(client_obj=self.client)
# Assert contents of file
rfs = mrepo.fileById(ofile.id.val)
try:
assert "hi" == rfs.read(0, 2)
finally:
rfs.close()
handle = gateway.deleteObjects("/OriginalFile", [ofile.id.val])
try:
gateway._waitOnCmd(handle)
finally:
handle.close()
# Trying to open the file should not throw an UnregisteredFileException
# But should just be an empty file.
rfs = mrepo.file(filename, "rw")
try:
assert "\x00\x00" == rfs.read(0, 2)
finally:
rfs.close()
示例3: testCmdDeleteCantDeleteDirectories
# 需要导入模块: from omero.gateway import BlitzGateway [as 别名]
# 或者: from omero.gateway.BlitzGateway import _waitOnCmd [as 别名]
def testCmdDeleteCantDeleteDirectories(self):
id = self.dir_map[self.dir_key]["id"]
gateway = BlitzGateway(client_obj=self.client)
handle = gateway.deleteObjects("/OriginalFile", [id])
try:
with pytest.raises(CmdError):
gateway._waitOnCmd(handle, failonerror=True)
finally:
handle.close()
示例4: chmodGroupAs
# 需要导入模块: from omero.gateway import BlitzGateway [as 别名]
# 或者: from omero.gateway.BlitzGateway import _waitOnCmd [as 别名]
def chmodGroupAs(self, user, perms):
client = self.clients[user]
if True: # Note: deprecated
client.sf.getAdminService().changePermissions(
self.group, omero.model.PermissionsI(perms))
else:
from omero.gateway import BlitzGateway
from omero.cmd import ERR
gateway = BlitzGateway(client_obj=client)
handle = gateway.chmodGroup(self.group.id.val, perms)
cb = gateway._waitOnCmd(handle)
rsp = cb.getResponse()
if isinstance(rsp, ERR):
raise Exception(rsp)
示例5: return
# 需要导入模块: from omero.gateway import BlitzGateway [as 别名]
# 或者: from omero.gateway.BlitzGateway import _waitOnCmd [as 别名]
return (repository, description)
raise AttributeError(
'Repository of type %s with optional name %s unavailable' %
(klass, name))
def getDirectory(dirpath):
user = conn.getUser()
return os.path.join('%s_%s' % (user.getName(), user.getId()), dirpath)
repository, description = get_repository('ManagedRepository')
name = 'delete_test_%s' % time.time()
directory = getDirectory(name)
repository.makeDir(directory, True)
for i in range(count):
name = os.path.join(directory, 'file%s.txt' % i)
print "Creating", name
targetfile = repository.file(name, 'rw')
targetfile.truncate(0)
targetfile.write('ABC123', 0, 6)
targetfile.close()
handle = repository.deletePaths([directory], True, True)
try:
conn._waitOnCmd(handle, loops=timeout * 2) # loops are 500ms
finally:
handle.close()