本文整理匯總了Python中pinball.ui.data_builder.DataBuilder.get_executions方法的典型用法代碼示例。如果您正苦於以下問題:Python DataBuilder.get_executions方法的具體用法?Python DataBuilder.get_executions怎麽用?Python DataBuilder.get_executions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pinball.ui.data_builder.DataBuilder
的用法示例。
在下文中一共展示了DataBuilder.get_executions方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: executions
# 需要導入模塊: from pinball.ui.data_builder import DataBuilder [as 別名]
# 或者: from pinball.ui.data_builder.DataBuilder import get_executions [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 [as 別名]
#.........這裏部分代碼省略.........
instance = self._data_builder.get_instance('workflow_0', 'instance_0')
self.assertEqual('workflow_0', instance.workflow)
self.assertEqual('instance_0', instance.instance)
def test_get_instance(self):
self._get_instance()
def test_get_instance_using_cache(self):
self._data_builder.use_cache = True
self._get_instance()
# Running instance should not have been cached.
self.assertEqual([], self._store.read_cached_data_names())
def test_get_jobs_empty(self):
self.assertEqual([],
self._data_builder.get_jobs('does_not_exist',
'does_not_exist'))
def test_get_jobs(self):
self._add_tokens()
jobs = self._data_builder.get_jobs('workflow_0', 'instance_0')
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]