本文整理汇总了Python中pinball.ui.data_builder.DataBuilder.get_executions_across_instances方法的典型用法代码示例。如果您正苦于以下问题:Python DataBuilder.get_executions_across_instances方法的具体用法?Python DataBuilder.get_executions_across_instances怎么用?Python DataBuilder.get_executions_across_instances使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pinball.ui.data_builder.DataBuilder
的用法示例。
在下文中一共展示了DataBuilder.get_executions_across_instances方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: executions
# 需要导入模块: from pinball.ui.data_builder import DataBuilder [as 别名]
# 或者: from pinball.ui.data_builder.DataBuilder import get_executions_across_instances [as 别名]
def executions(request):
try:
workflow = request.GET['workflow']
instance = request.GET.get('instance')
job = request.GET['job']
data_builder = DataBuilder(DbStore())
if instance:
executions_data = data_builder.get_executions(workflow,
instance,
job)
else:
executions_data = data_builder.get_executions_across_instances(
workflow, job)
executions_json = _serialize(executions_data)
except:
LOG.exception('')
return HttpResponseServerError(traceback.format_exc())
else:
return HttpResponse(executions_json, mimetype='application/json')
示例2: DataBuilderTestCase
# 需要导入模块: from pinball.ui.data_builder import DataBuilder [as 别名]
# 或者: from pinball.ui.data_builder.DataBuilder import get_executions_across_instances [as 别名]
#.........这里部分代码省略.........
self.assertEqual(2, len(jobs))
for job in jobs:
self.assertEqual('workflow_0', job.workflow)
self.assertEqual('instance_0', job.instance)
self.assertEqual('ShellJob', job.job_type)
self.assertTrue(job.info.startswith('command=some command'))
self.assertEqual(Status.FAILURE, job.status)
self.assertEqual([(0, ''), (1, 'SUCCESS'), (9, 'FAILURE')],
jobs[0].progress)
self.assertEqual([(89, ''), (1, 'SUCCESS'), (9, 'FAILURE')],
jobs[1].progress)
def test_get_executions_empty(self):
self.assertEqual([],
self._data_builder.get_executions('does_not_exist',
'does_not_exist',
'does_not_exist'))
def test_get_executions(self):
self._add_tokens()
executions = self._data_builder.get_executions('workflow_0',
'instance_0',
'job_0')
self.assertEqual(2, len(executions))
exit_codes = [0, 1]
for execution in executions:
self.assertEqual('workflow_0', execution.workflow)
self.assertEqual('instance_0', execution.instance)
self.assertEqual('job_0', execution.job)
self.assertTrue(execution.info.startswith('some_command'))
exit_codes.remove(execution.exit_code)
self.assertEqual(2, len(execution.logs))
def test_get_executions_across_instances_empty(self):
self.assertEqual([],
self._data_builder.get_executions_across_instances(
'does_not_exist',
'does_not_exist'))
def test_get_executions_across_instances(self):
self._add_tokens()
executions = self._data_builder.get_executions_across_instances(
'workflow_0', 'job_0')
self.assertEqual(2 * 2, len(executions))
exit_codes = [0, 0, 1, 1]
for execution in executions:
self.assertEqual('workflow_0', execution.workflow)
self.assertEqual('job_0', execution.job)
self.assertTrue(execution.info.startswith('some_command'))
exit_codes.remove(execution.exit_code)
self.assertEqual(2, len(execution.logs))
def test_get_execution_empty(self):
self.assertIsNone(self._data_builder.get_execution('does_not_exist',
'does_not_exist',
'does_not_exist',
0))
def test_get_execution(self):
self._add_tokens()
execution = self._data_builder.get_execution('workflow_0',
'instance_0',
'job_0',
1)
self.assertEqual('workflow_0', execution.workflow)
self.assertEqual('instance_0', execution.instance)