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


Python Dart.save_subgraph_definition方法代码示例

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


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

示例1: add_emr_engine_sub_graphs

# 需要导入模块: from dart.client.python.dart_client import Dart [as 别名]
# 或者: from dart.client.python.dart_client.Dart import save_subgraph_definition [as 别名]
def add_emr_engine_sub_graphs(config):
    engine_config = config['engines']['emr_engine']
    opts = engine_config['options']
    dart = Dart(opts['dart_host'], opts['dart_port'], opts['dart_api_version'])
    assert isinstance(dart, Dart)

    _logger.info('saving emr_engine sub_graphs')

    engine_id = None
    for e in dart.get_engines():
        if e.data.name == 'emr_engine':
            engine_id = e.id
    if not engine_id:
        raise

    subgraph_definitions = [
        SubGraphDefinition(data=SubGraphDefinitionData(
            name='consume_subscription_workflow',
            description='Add to a datastore to create entities for loading a dataset on an ongoing basis',
            engine_name='emr_engine',
            related_type=EntityType.datastore,
            related_is_a=Relationship.PARENT,
            workflows=[
                Workflow(id=Ref.workflow(1), data=WorkflowData(
                    name='emr-workflow-consume_subscription',
                    datastore_id=Ref.parent(),
                    engine_name='emr_engine',
                )),
            ],
            subscriptions=[
                Subscription(id=Ref.subscription(1), data=SubscriptionData(
                    name='emr-subscription',
                    dataset_id=''
                )),
            ],
            triggers=[
                Trigger(id=Ref.trigger(1), data=TriggerData(
                    name='emr-trigger-subscription-1G-batch',
                    trigger_type_name=subscription_batch_trigger.name,
                    workflow_ids=[Ref.workflow(1)],
                    args={
                        'subscription_id': Ref.subscription(1),
                        'unconsumed_data_size_in_bytes': 1000*1000*1000
                    }
                )),
            ],
            actions=[
                Action(id=Ref.action(1), data=ActionData(
                    name='emr-action-consume_subscription',
                    action_type_name=EmrActionTypes.consume_subscription.name,
                    engine_name='emr_engine',
                    workflow_id=Ref.workflow(1),
                    state=ActionState.TEMPLATE,
                    args={'subscription_id': Ref.subscription(1)}
                )),
            ]
        ))
    ]

    for e in subgraph_definitions:
        s = dart.save_subgraph_definition(e, engine_id)
        _logger.info('created subgraph_definition: %s' % s.id)
开发者ID:RetailMeNotSandbox,项目名称:dart,代码行数:64,代码来源:add_sub_graphs.py

示例2: add_no_op_engine_sub_graphs

# 需要导入模块: from dart.client.python.dart_client import Dart [as 别名]
# 或者: from dart.client.python.dart_client.Dart import save_subgraph_definition [as 别名]

#.........这里部分代码省略.........
    for e in dart.get_engines():
        if e.data.name == 'no_op_engine':
            engine_id = e.id
    if not engine_id:
        raise

    subgraph_definitions = [
        SubGraphDefinition(data=SubGraphDefinitionData(
            name='workflow chaining demo',
            description='demonstrate workflow chaining',
            engine_name='no_op_engine',
            related_type=EntityType.datastore,
            related_is_a=Relationship.PARENT,
            workflows=[
                Workflow(id=Ref.workflow(1), data=WorkflowData(
                    name='no-op-workflow-chaining-wf1',
                    datastore_id=Ref.parent(),
                    engine_name='no_op_engine',
                    state=WorkflowState.ACTIVE,
                )),
                Workflow(id=Ref.workflow(2), data=WorkflowData(
                    name='no-op-workflow-chaining-wf2',
                    datastore_id=Ref.parent(),
                    engine_name='no_op_engine',
                    state=WorkflowState.ACTIVE,
                )),
            ],
            actions=[
                Action(id=Ref.action(1), data=ActionData(
                    name=NoOpActionTypes.action_that_succeeds.name,
                    engine_name='no_op_engine',
                    action_type_name=NoOpActionTypes.action_that_succeeds.name,
                    workflow_id=Ref.workflow(1),
                    order_idx=1,
                    state=ActionState.TEMPLATE,
                )),
                Action(id=Ref.action(2), data=ActionData(
                    name=NoOpActionTypes.action_that_succeeds.name,
                    action_type_name=NoOpActionTypes.action_that_succeeds.name,
                    engine_name='no_op_engine',
                    workflow_id=Ref.workflow(1),
                    order_idx=2,
                    state=ActionState.TEMPLATE,
                )),
                Action(id=Ref.action(3), data=ActionData(
                    name=NoOpActionTypes.action_that_succeeds.name,
                    action_type_name=NoOpActionTypes.action_that_succeeds.name,
                    engine_name='no_op_engine',
                    workflow_id=Ref.workflow(1),
                    order_idx=3,
                    state=ActionState.TEMPLATE,
                )),
                Action(id=Ref.action(4), data=ActionData(
                    name=NoOpActionTypes.action_that_succeeds.name,
                    action_type_name=NoOpActionTypes.action_that_succeeds.name,
                    engine_name='no_op_engine',
                    workflow_id=Ref.workflow(1),
                    order_idx=4,
                    state=ActionState.TEMPLATE,
                )),
                Action(id=Ref.action(5), data=ActionData(
                    name=NoOpActionTypes.action_that_succeeds.name,
                    action_type_name=NoOpActionTypes.action_that_succeeds.name,
                    engine_name='no_op_engine',
                    workflow_id=Ref.workflow(2),
                    order_idx=1,
                    state=ActionState.TEMPLATE,
                )),
                Action(id=Ref.action(6), data=ActionData(
                    name=NoOpActionTypes.action_that_succeeds.name,
                    action_type_name=NoOpActionTypes.action_that_succeeds.name,
                    engine_name='no_op_engine',
                    workflow_id=Ref.workflow(2),
                    order_idx=2,
                    state=ActionState.TEMPLATE,
                )),
                Action(id=Ref.action(7), data=ActionData(
                    name=NoOpActionTypes.action_that_fails.name,
                    action_type_name=NoOpActionTypes.action_that_fails.name,
                    engine_name='no_op_engine',
                    workflow_id=Ref.workflow(2),
                    order_idx=3,
                    state=ActionState.TEMPLATE,
                )),
            ],
            triggers=[
                Trigger(id=Ref.trigger(1), data=TriggerData(
                    name='no-op-trigger-workflow-completion',
                    trigger_type_name=workflow_completion_trigger.name,
                    workflow_ids=[Ref.workflow(2)],
                    state=TriggerState.ACTIVE,
                    args={'completed_workflow_id': Ref.workflow(1)}
                )),
            ],
        ))
    ]

    for e in subgraph_definitions:
        s = dart.save_subgraph_definition(e, engine_id)
        _logger.info('created subgraph_definition: %s' % s.id)
开发者ID:RetailMeNotSandbox,项目名称:dart,代码行数:104,代码来源:add_sub_graphs.py


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