本文整理汇总了Python中dart.client.python.dart_client.Dart.get_trigger方法的典型用法代码示例。如果您正苦于以下问题:Python Dart.get_trigger方法的具体用法?Python Dart.get_trigger怎么用?Python Dart.get_trigger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dart.client.python.dart_client.Dart
的用法示例。
在下文中一共展示了Dart.get_trigger方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestTriggerCrud
# 需要导入模块: from dart.client.python.dart_client import Dart [as 别名]
# 或者: from dart.client.python.dart_client.Dart import get_trigger [as 别名]
class TestTriggerCrud(unittest.TestCase):
def setUp(self):
self.dart = Dart(host='localhost', port=5000)
args = {'action_sleep_time_in_seconds': 0}
dst = Datastore(data=DatastoreData('test-datastore', 'no_op_engine', args=args, state=DatastoreState.TEMPLATE))
self.datastore = self.dart.save_datastore(dst)
wf = Workflow(data=WorkflowData('test-workflow', self.datastore.id, state=WorkflowState.ACTIVE))
self.workflow = self.dart.save_workflow(wf, self.datastore.id)
def tearDown(self):
self.dart.delete_datastore(self.datastore.id)
self.dart.delete_workflow(self.workflow.id)
def test_crud(self):
args = {'completed_workflow_id': self.workflow.id}
tr = Trigger(data=TriggerData('test-trigger', 'workflow_completion', [self.workflow.id], args))
posted_tr = self.dart.save_trigger(tr)
self.assertEqual(posted_tr.data.to_dict(), tr.data.to_dict())
trigger = self.dart.get_trigger(posted_tr.id)
self.assertEqual(posted_tr.to_dict(), trigger.to_dict())
self.dart.delete_trigger(trigger.id)
try:
self.dart.get_trigger(trigger.id)
except DartRequestException as e:
self.assertEqual(e.response.status_code, 404)
return
self.fail('trigger should have been missing after delete!')
示例2: Dart
# 需要导入模块: from dart.client.python.dart_client import Dart [as 别名]
# 或者: from dart.client.python.dart_client.Dart import get_trigger [as 别名]
from dart.client.python.dart_client import Dart
if __name__ == '__main__':
dart = Dart('localhost', 5000)
assert isinstance(dart, Dart)
trigger = ''
dataset_id = ''
datastore_id = ''
trigger = dart.get_trigger(trigger)
for workflow_id in trigger.data.workflow_ids:
for wfi in dart.get_workflow_instances(workflow_id):
datastore_id = wfi.data.datastore_id
for a in dart.get_actions(datastore_id=datastore_id):
dart.delete_action(a.id)
dart.delete_workflow_instances(workflow_id)
dart.delete_workflow(workflow_id)
if datastore_id:
dart.delete_datastore(datastore_id)
if dataset_id:
dart.delete_dataset(dataset_id)