本文整理汇总了Python中qiita_db.logger.LogEntry.newest_records方法的典型用法代码示例。如果您正苦于以下问题:Python LogEntry.newest_records方法的具体用法?Python LogEntry.newest_records怎么用?Python LogEntry.newest_records使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qiita_db.logger.LogEntry
的用法示例。
在下文中一共展示了LogEntry.newest_records方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from qiita_db.logger import LogEntry [as 别名]
# 或者: from qiita_db.logger.LogEntry import newest_records [as 别名]
def post(self):
self.check_access()
numentries = int(self.get_argument("numrecords"))
if numentries <= 0:
numentries = 100
logentries = LogEntry.newest_records(numentries)
self.render("error_log.html", logentries=logentries)
示例2: post
# 需要导入模块: from qiita_db.logger import LogEntry [as 别名]
# 或者: from qiita_db.logger.LogEntry import newest_records [as 别名]
def post(self):
numentries = int(self.get_argument("numrecords"))
if numentries < 0:
numentries = 100
logentries = LogEntry.newest_records(numentries)
self.render("error_log.html", logentries=logentries,
user=self.current_user)
示例3: get
# 需要导入模块: from qiita_db.logger import LogEntry [as 别名]
# 或者: from qiita_db.logger.LogEntry import newest_records [as 别名]
def get(self):
self.check_access()
logentries = LogEntry.newest_records()
self.render("error_log.html", logentries=logentries)
示例4: test_complete_job
# 需要导入模块: from qiita_db.logger import LogEntry [as 别名]
# 或者: from qiita_db.logger.LogEntry import newest_records [as 别名]
def test_complete_job(self):
# Complete success
pt = npt.assert_warns(
QiitaDBWarning, PrepTemplate.create,
pd.DataFrame({'new_col': {'1.SKD6.640190': 1}}),
Study(1), '16S')
c_job = ProcessingJob.create(
User('[email protected]'),
Parameters.load(
Command.get_validator('BIOM'),
values_dict={'template': pt.id,
'files': dumps({'BIOM': ['file']}),
'artifact_type': 'BIOM'}), True)
c_job._set_status('running')
fd, fp = mkstemp(suffix='_table.biom')
close(fd)
with open(fp, 'w') as f:
f.write('\n')
self._clean_up_files.append(fp)
exp_artifact_count = get_count('qiita.artifact') + 1
payload = dumps(
{'success': True, 'error': '',
'artifacts': {'OTU table': {'filepaths': [(fp, 'biom')],
'artifact_type': 'BIOM'}}})
job = self._create_job('complete_job', {'job_id': c_job.id,
'payload': payload})
private_task(job.id)
self.assertEqual(job.status, 'success')
self.assertEqual(c_job.status, 'success')
self.assertEqual(get_count('qiita.artifact'), exp_artifact_count)
# Complete job error
payload = dumps({'success': False, 'error': 'Job failure'})
job = self._create_job(
'complete_job', {'job_id': 'bcc7ebcd-39c1-43e4-af2d-822e3589f14d',
'payload': payload})
private_task(job.id)
self.assertEqual(job.status, 'success')
c_job = ProcessingJob('bcc7ebcd-39c1-43e4-af2d-822e3589f14d')
self.assertEqual(c_job.status, 'error')
self.assertEqual(c_job.log, LogEntry.newest_records(numrecords=1)[0])
self.assertEqual(c_job.log.msg, 'Job failure')
# Complete internal error
pt = npt.assert_warns(
QiitaDBWarning, PrepTemplate.create,
pd.DataFrame({'new_col': {'1.SKD6.640190': 1}}),
Study(1), '16S')
c_job = ProcessingJob.create(
User('[email protected]'),
Parameters.load(
Command.get_validator('BIOM'),
values_dict={'template': pt.id,
'files': dumps({'BIOM': ['file']}),
'artifact_type': 'BIOM'}), True)
c_job._set_status('running')
fp = '/surprised/if/this/path/exists.biom'
payload = dumps(
{'success': True, 'error': '',
'artifacts': {'OTU table': {'filepaths': [(fp, 'biom')],
'artifact_type': 'BIOM'}}})
job = self._create_job('complete_job', {'job_id': c_job.id,
'payload': payload})
private_task(job.id)
self.assertEqual(job.status, 'success')
self.assertEqual(c_job.status, 'error')
self.assertIn('No such file or directory', c_job.log.msg)
示例5: get
# 需要导入模块: from qiita_db.logger import LogEntry [as 别名]
# 或者: from qiita_db.logger.LogEntry import newest_records [as 别名]
def get(self):
logentries = LogEntry.newest_records()
self.render("error_log.html", logentries=logentries,
user=self.current_user)