本文整理匯總了Python中pinball.ui.data_builder.DataBuilder.is_signal_set方法的典型用法代碼示例。如果您正苦於以下問題:Python DataBuilder.is_signal_set方法的具體用法?Python DataBuilder.is_signal_set怎麽用?Python DataBuilder.is_signal_set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pinball.ui.data_builder.DataBuilder
的用法示例。
在下文中一共展示了DataBuilder.is_signal_set方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: status
# 需要導入模塊: from pinball.ui.data_builder import DataBuilder [as 別名]
# 或者: from pinball.ui.data_builder.DataBuilder import is_signal_set [as 別名]
def status(request):
try:
workflow = request.GET.get('workflow')
instance = request.GET.get('instance')
data_builder = DataBuilder(DbStore())
status = []
if data_builder.is_signal_set(workflow, instance, Signal.EXIT):
status = ['exiting']
elif data_builder.is_signal_set(workflow, instance, Signal.ABORT):
status = ['aborting']
elif data_builder.is_signal_set(workflow, instance, Signal.DRAIN):
status = ['draining']
if not _is_master_alive():
status.append('no master at %s:%d' % (socket.gethostname(),
PinballConfig.MASTER_PORT))
status_json = json.dumps(status)
except:
LOG.exception('')
return HttpResponseServerError(traceback.format_exc())
else:
return HttpResponse(status_json, mimetype='application/json')
示例2: DataBuilderTestCase
# 需要導入模塊: from pinball.ui.data_builder import DataBuilder [as 別名]
# 或者: from pinball.ui.data_builder.DataBuilder import is_signal_set [as 別名]
#.........這裏部分代碼省略.........
self.assertRaises(PinballException,
self._data_builder.get_token_paths,
'')
def test_get_token_paths(self):
self._add_tokens()
token_paths = self._data_builder.get_token_paths(
'/workflow/workflow_0/instance_0/job/waiting/')
self.assertEqual(2, len(token_paths))
paths = ['/workflow/workflow_0/instance_0/job/waiting/job_0',
'/workflow/workflow_0/instance_0/job/waiting/job_1']
for token_path in token_paths:
self.assertEqual(1, token_path.count)
paths.remove(token_path.path)
self.assertEqual([], paths)
def test_get_token_empty(self):
self.assertRaises(PinballException,
self._data_builder.get_token,
'/does_not_exist')
def test_get_token(self):
self._add_tokens()
token = self._data_builder.get_token(
'/workflow/workflow_0/instance_0/job/waiting/job_0')
self.assertEqual('/workflow/workflow_0/instance_0/job/waiting/job_0',
token.name)
self.assertIsNone(token.owner)
self.assertIsNone(token.expiration_time)
self.assertEqual(0, token.priority)
self.assertIsNotNone(token.data)
def test_signal_not_set(self):
self.assertFalse(self._data_builder.is_signal_set('does_not_exist', 0,
Signal.DRAIN))
def test_signal_set(self):
self._add_tokens()
self.assertTrue(self._data_builder.is_signal_set('workflow_0', 0,
Signal.DRAIN))
# Workflow status should be the running instance
def test_workflow_data_from_instances_data1(self):
wf_instance_list = [
WorkflowInstanceData('wf', '22346', Status.ABORTED, 12346, 54321),
WorkflowInstanceData('wf', '22345', Status.RUNNING, 12345, None),
WorkflowInstanceData('wf', '22347', Status.SUCCESS, 12347, 12390),
WorkflowInstanceData('wf', '22348', Status.RUNNING, 12348, None),
]
wf_data = DataBuilder._workflow_data_from_instances_data(
wf_instance_list)
self.assertEquals(wf_data.workflow, 'wf')
self.assertEquals(wf_data.status, Status.RUNNING)
self.assertEquals(wf_data.last_instance, '22348')
self.assertEquals(wf_data.last_start_time, 12348)
self.assertEquals(wf_data.last_end_time, None)
self.assertEquals(wf_data.running_instance_number, 2)
# Workflow status should be the running instance even if some instance ended
# at sys.maxint time
def test_workflow_data_from_instances_data2(self):
wf_instance_list = [
WorkflowInstanceData('wf', '22346', Status.ABORTED, 12355, sys.maxint),
WorkflowInstanceData('wf', '22347', Status.SUCCESS, 12365, 12390),
WorkflowInstanceData('wf', '22345', Status.RUNNING, 12345, None),
]