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


Python Pipeline.get_output_processes方法代码示例

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


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

示例1: main

# 需要导入模块: from pyasm.biz import Pipeline [as 别名]
# 或者: from pyasm.biz.Pipeline import get_output_processes [as 别名]
def main(server=None, input_data=None):
    if not input_data:
        return

    # The input for the script should be a sthpw/task sobject
    task_sobject = input_data.get('sobject')

    # This script only applies to tasks that are marked as Complete, and are attached to twog/component sobjects
    if not (task_sobject.get('status') == 'Complete' and task_sobject.get(
            'search_type') == u'twog/component?project=twog'):
        return

    # Tasks saved on twog/component have extra data associated with them, saved under twog/task_data
    # Retrieve the entry of twog/task_data for this task sobject
    task_data_search = Search('twog/task_data')
    task_data_search.add_filter('task_code', task_sobject.get('code'))
    task_data = task_data_search.get_sobject()

    if not task_data:
        return

    # Get the next task in the pipeline
    # Start by getting the component sobject the task is attached to
    component_search = Search('twog/component')
    component_search.add_code_filter(task_sobject.get('search_code'))
    component_sobject = component_search.get_sobject()

    if not component_sobject:
        return

    # Then get the output processes. Start by fetching the pipeline object
    pipeline = Pipeline('twog/component')
    pipeline.set_pipeline(get_pipeline_xml(component_sobject.get('pipeline_code')))

    # Then get the names of the processes contained in that pipeline (which corresponds to all the names of the tasks
    # within this component)
    output_processes = pipeline.get_output_processes(task_sobject.get('process'))

    # Now, get the actual task objects
    tasks_search = Search('sthpw/task')
    tasks_search.add_filter('process', output_processes)
    tasks_search.add_parent_filter(component_sobject)
    output_tasks = tasks_search.get_sobjects()

    # Fetch the output files attached to the original task
    out_files_search = Search('twog/task_data_out_file')
    out_files_search.add_filter('task_data_code', task_data.get_code())
    out_files = out_files_search.get_sobjects()

    if not out_files:
        return

    # Go through each output task and attach the output files as input files
    for output_task in output_tasks:
        output_task_data_search = Search('twog/task_data')
        output_task_data_search.add_filter('task_code', output_task.get_code())
        output_task_data = output_task_data_search.get_sobject()

        for out_file in out_files:
            inserted_data = {
                'task_data_code': output_task_data.get_code(),
                'file_code': out_file.get('file_code')
            }

            server.insert('twog/task_data_in_file', inserted_data)

            # The file should be added to the files in order list
            server.insert('twog/file_in_order', {'order_code': component_sobject.get('order_code'),
                                                 'file_code': out_file.get('file_code')})
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:71,代码来源:move_task_out_files_to_next_task.py


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