当前位置: 首页>>代码示例>>Python>>正文


Python Dart.save_trigger方法代码示例

本文整理汇总了Python中dart.client.python.dart_client.Dart.save_trigger方法的典型用法代码示例。如果您正苦于以下问题:Python Dart.save_trigger方法的具体用法?Python Dart.save_trigger怎么用?Python Dart.save_trigger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dart.client.python.dart_client.Dart的用法示例。


在下文中一共展示了Dart.save_trigger方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestTriggerCrud

# 需要导入模块: from dart.client.python.dart_client import Dart [as 别名]
# 或者: from dart.client.python.dart_client.Dart import save_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!')
开发者ID:chrisborg,项目名称:dart,代码行数:32,代码来源:test_trigger.py

示例2: Action

# 需要导入模块: from dart.client.python.dart_client import Dart [as 别名]
# 或者: from dart.client.python.dart_client.Dart import save_trigger [as 别名]
            datastore.id,
            state=WorkflowState.ACTIVE,
            on_failure_email=['[email protected]'],
            on_success_email=['[email protected]'],
            on_started_email=['[email protected]'],
        )
    ), datastore.id)
    print 'created workflow: %s' % workflow.id

    a0, a1 = dart.save_actions([
        Action(data=ActionData('start_datastore', 'start_datastore', state=ActionState.TEMPLATE)),
        Action(data=ActionData('load_dataset', 'load_dataset', state=ActionState.TEMPLATE, args={
            'dataset_id': dataset.id,
            's3_path_start_prefix_inclusive': 's3://example-bucket/prd/beacon/native_app/v2/parquet/snappy/createdpartition=2015-06-27',
        })),
    ], workflow_id=workflow.id)
    print 'created action: %s' % a0.id
    print 'created action: %s' % a1.id

    event = dart.save_event(Event(data=EventData('beacon_native_app_to_parquet_emr_job_completion', state=EventState.ACTIVE)))
    print 'created event: %s' % event.id

    trigger = dart.save_trigger(Trigger(data=TriggerData(
        'beacon_native_app_to_parquet_emr_job_completion_trigger',
        'event',
        [workflow.id],
        {'event_id': event.id}))
    )
    print 'created trigger: %s' % trigger.id

开发者ID:RetailMeNotSandbox,项目名称:dart,代码行数:31,代码来源:beacon_native_app_parquet.py

示例3: Action

# 需要导入模块: from dart.client.python.dart_client import Dart [as 别名]
# 或者: from dart.client.python.dart_client.Dart import save_trigger [as 别名]
            )
        ),
        datastore_id=datastore.id
    )
    print 'created workflow: %s' % workflow.id

    wf_actions = dart.save_actions(
        actions=[
            Action(data=ActionData('consume_subscription', 'consume_subscription', state=ActionState.TEMPLATE, args={
                'subscription_id': subscription.id,
                'target_file_format': FileFormat.PARQUET,
                'target_row_format': RowFormat.NONE,
                'target_compression': Compression.SNAPPY,
            })),
        ],
        workflow_id=workflow.id
    )
    print 'created workflow action: %s' % wf_actions[0].id

    trigger = dart.save_trigger(Trigger(data=TriggerData(
        name='rmn_direct_trigger_DW-3307',
        trigger_type_name='subscription_batch',
        workflow_ids=[workflow.id],
        args={
            'subscription_id': subscription.id,
            'unconsumed_data_size_in_bytes': 1000000
        },
        state=TriggerState.ACTIVE
    )))
    print 'created trigger: %s' % trigger.id
开发者ID:RetailMeNotSandbox,项目名称:dart,代码行数:32,代码来源:rmn_direct_parquet.py

示例4: Action

# 需要导入模块: from dart.client.python.dart_client import Dart [as 别名]
# 或者: from dart.client.python.dart_client.Dart import save_trigger [as 别名]
                on_started_email=['[email protected]'],
            )
        ),
        datastore_id=datastore.id
    )
    print 'created workflow: %s' % workflow.id

    a2 = dart.save_actions(
        actions=[
            Action(data=ActionData('consume_subscription', 'consume_subscription', state=ActionState.TEMPLATE, args={
                'subscription_id': subscription.id,
                'target_file_format': FileFormat.PARQUET,
                'target_row_format': RowFormat.NONE,
                'target_compression': Compression.SNAPPY,
            })),
        ],
        workflow_id=workflow.id
    )[0]
    print 'created workflow action: %s' % a2.id

    trigger = dart.save_trigger(Trigger(data=TriggerData(
        name='owen_eu_parquet_trigger_DW-3213_v3',
        trigger_type_name='subscription_batch',
        workflow_ids=[workflow.id],
        args={
            'subscription_id': subscription.id,
            'unconsumed_data_size_in_bytes': 16000000
        }
    )))
    print 'created trigger: %s' % trigger.id
开发者ID:RetailMeNotSandbox,项目名称:dart,代码行数:32,代码来源:owen_eu_rcfile.py


注:本文中的dart.client.python.dart_client.Dart.save_trigger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。