本文整理汇总了Python中biomaj.bank.Bank类的典型用法代码示例。如果您正苦于以下问题:Python Bank类的具体用法?Python Bank怎么用?Python Bank使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Bank类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_update_hardlinks
def test_update_hardlinks(self):
"""
Update a bank twice with hard links^. Files copied from previous release
must be links.
"""
b = Bank('local')
b.config.set('keep.old.version', '3')
b.config.set('use_hardlinks', '1')
# First update
b.update()
self.assertTrue(b.session.get('update'))
old_release = b.session.get_full_release_directory()
# Update test.fasta to force update (not that this file is modified in the
# source tree)
remote_file = b.session.config.get('remote.dir') + 'test.fasta.gz'
stat = os.stat(remote_file)
one_day = 3600 * 24
os.utime(remote_file, (stat.st_atime + one_day, stat.st_atime + one_day))
# Second update
b.update()
self.assertTrue(b.session.get('update'))
new_release = b.session.get_full_release_directory()
# Test that test2.fasta in both release are the same file (we can't use
# test.fasta because it is uncompressed and then not the same file)
file_old_release = os.path.join(old_release, 'flat', 'test2.fasta')
file_new_release = os.path.join(new_release, 'flat', 'test2.fasta')
try:
self.assertTrue(os.path.samefile(file_old_release, file_new_release))
except AssertionError:
msg = "In %s: copy worked but hardlinks were not used." % self.id()
logging.info(msg)
# Restore date (otherwise repeated tests fail)
os.utime(remote_file, (stat.st_atime, stat.st_atime))
示例2: test_computed_ref_release
def test_computed_ref_release(self):
b = Bank('computed2')
res = b.update(True)
self.assertTrue(b.session.get('update'))
b2 = Bank('computed2')
res = b2.update(True)
self.assertFalse(b2.session.get('update'))
示例3: test_new_session
def test_new_session(self):
"""
Checks an empty session is created
"""
b = Bank("alu")
b.load_session(UpdateWorkflow.FLOW)
for key in b.session._session["status"].keys():
self.assertFalse(b.session.get_status(key))
示例4: bank_status
def bank_status(request):
bank = Bank(request.matchdict['id'], no_log=True)
if not can_read_bank(request, bank.bank):
return HTTPForbidden('Not authorized to access this resource')
if 'status' not in bank.bank:
return HTTPNotFound('no current status')
return bank.get_status()
示例5: test_new_session
def test_new_session(self):
'''
Checks an empty session is created
'''
b = Bank('alu')
b.load_session(UpdateWorkflow.FLOW)
for key in b.session._session['status'].keys():
self.assertFalse(b.session.get_status(key))
示例6: test_extract_release_from_file_content
def test_extract_release_from_file_content(self):
b = Bank("local")
b.load_session(UpdateWorkflow.FLOW)
b.session.config.set("release.file", "test_100\.txt")
b.session.config.set("release.regexp", "Release\s*(\d+)")
w = UpdateWorkflow(b)
w.wf_release()
self.assertTrue(b.session.get("release") == "103")
示例7: test_extract_release_from_file_content
def test_extract_release_from_file_content(self):
b = Bank('local')
b.load_session(UpdateWorkflow.FLOW)
b.session.config.set('release.file', 'test_100\.txt')
b.session.config.set('release.regexp', 'Release\s*(\d+)')
w = UpdateWorkflow(b)
w.wf_release()
self.assertTrue(b.session.get('release') == '103')
示例8: test_computed_nofile
def test_computed_nofile(self):
b = Bank('computed2')
b.load_session(UpdateWorkflow.FLOW)
b.session.config.set('protocol', 'none')
b.session.config.set('sub1.files.move', 'flat/test_.*')
res = b.update(True)
self.assertTrue(res)
self.assertTrue(os.path.exists(b.session.get_full_release_directory()+'/sub1/flat/test_100.txt'))
示例9: test_computed_ref_release
def test_computed_ref_release(self):
b = Bank("computed2")
res = b.update(True)
b2 = Bank("sub1")
b2release = b2.bank["production"][len(b2.bank["production"]) - 1]["release"]
brelease = b.bank["production"][len(b.bank["production"]) - 1]["release"]
self.assertTrue(res)
self.assertTrue(brelease == b2release)
示例10: test_stats
def test_stats(self):
b = Bank('local')
b.update()
rel = b.session.get('release')
stats = Bank.get_banks_disk_usage()
self.assertTrue(stats[0]['size']>0)
for release in stats[0]['releases']:
if release['name'] == rel:
self.assertTrue(release['size']>0)
示例11: test_remoterelease_check
def test_remoterelease_check(self):
b = Bank('local')
b.load_session(ReleaseCheckWorkflow.FLOW)
b.session.config.set('release.file', 'test_(\d+)\.txt')
b.session.config.set('release.regexp', '')
workflow = ReleaseCheckWorkflow(b)
res = workflow.start()
remoterelease = b.session.get('remoterelease')
self.assertTrue(remoterelease == '100')
示例12: test_stats
def test_stats(self):
b = Bank("local")
b.update()
rel = b.session.get("release")
stats = Bank.get_banks_disk_usage()
self.assertTrue(stats[0]["size"] > 0)
for release in stats[0]["releases"]:
if release["name"] == rel:
self.assertTrue(release["size"] > 0)
示例13: bank_locked
def bank_locked(request):
bank = Bank(request.matchdict['id'], no_log=True)
if not can_read_bank(request, bank.bank):
return HTTPForbidden('Not authorized to access this resource')
if bank.is_locked():
return {'status': 1}
else:
return {'status': 0}
示例14: test_no_update
def test_no_update(self):
'''
Try updating twice, at second time, bank should not be updated
'''
b = Bank('local')
b.update()
self.assertTrue(b.session.get('update'))
b.update()
self.assertFalse(b.session.get('update'))
self.assertFalse(b.session.get_status(Workflow.FLOW_POSTPROCESS))
示例15: test_get_release
def test_get_release(self):
"""
Get release
"""
b = Bank("alu")
b.load_session(UpdateWorkflow.FLOW)
res = b.update()
self.assertTrue(b.session.get("update"))
self.assertTrue(res)
self.assertTrue(b.session._session["release"] is not None)