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


Python Pipeline.create方法代码示例

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


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

示例1: _test_add_tasks

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import create [as 别名]
    def _test_add_tasks(my):

        pipe = Pipeline.create('person','person','unittest/person')
        xml = '''
        <pipeline>
  <process name="design1"/>
  <process name="design2"/>
  <process name="design3"/>
  <connect to="design2" from="design1"/>
  <connect to="design3" from="design2"/>
</pipeline>'''
        pipe.set_value('pipeline', xml)
        
        pipe.set_pipeline(xml)
        pipe.commit()
        Pipeline.clear_cache()
        pipeline = Pipeline.get_by_code('person')
        my.assertEquals(pipeline != None, True)

        # add bunch of dummy initial tasks to the person
        initial_tasks = Task.add_initial_tasks(my.person, 'person', processes=['design1','design2'], mode='simple process', skip_duplicate=True)
        context_list = []
        for task in initial_tasks:
            full_context ='%s:%s' %(task.get_value('process'), task.get_value('context'))
            context_list.append(full_context)

        my.assertEquals(context_list, ['design1:design1','design2:design2'])

        initial_tasks = Task.add_initial_tasks(my.person, 'person', processes=['design1','design2'], mode='simple process', skip_duplicate=False)
        context_list = []
        for task in initial_tasks:
            full_context ='%s:%s' %(task.get_value('process'), task.get_value('context'))
            context_list.append(full_context)

        my.assertEquals(context_list, ['design1:design1/001','design2:design2/001'])

        initial_tasks = Task.add_initial_tasks(my.person, 'person', contexts=['design1:design1/hi','design2:design2/low'], mode='context', skip_duplicate=False)
        context_list = []
        for task in initial_tasks:
            full_context ='%s:%s' %(task.get_value('process'), task.get_value('context'))
            context_list.append(full_context)

        my.assertEquals(context_list, ['design1:design1/hi','design2:design2/low'])

        initial_tasks = Task.add_initial_tasks(my.person, 'person', contexts=['design1:design1/hi','design2:design2/low'], mode='context', skip_duplicate=False)
        context_list = []
        for task in initial_tasks:
            full_context ='%s:%s' %(task.get_value('process'), task.get_value('context'))
            context_list.append(full_context)

        my.assertEquals(context_list, ['design1:design1/hi/001','design2:design2/low/001'])

        initial_tasks = Task.add_initial_tasks(my.person, 'person', contexts=['design1:design1/hi','design2:design2/low'], mode='context', skip_duplicate=True)
        # these are duplicated, so nothing should be created
        my.assertEquals(initial_tasks, [])


        
        initial_tasks = Task.add_initial_tasks(my.person, 'person', contexts=['design1:design1/hi','design2:design2/low','design3:design3','design3:design3'], mode='context', skip_duplicate=False)
      
        context_list = []
        for task in initial_tasks:
            full_context ='%s:%s' %(task.get_value('process'), task.get_value('context'))
            context_list.append(full_context)

        my.assertEquals(context_list, ['design1:design1/hi/002','design2:design2/low/002', 'design3:design3','design3:design3/001'])

        
        initial_tasks = Task.add_initial_tasks(my.person, 'person', contexts=['design1:design1','design3:design3'], mode='context', skip_duplicate=False)
      
        context_list = []
        for task in initial_tasks:
            full_context ='%s:%s' %(task.get_value('process'), task.get_value('context'))
            context_list.append(full_context)

        my.assertEquals(context_list, ['design1:design1/002','design3:design3/002'])

        initial_tasks = Task.add_initial_tasks(my.person, 'person', processes=['design2','design3'], mode='standard', skip_duplicate=False)
        context_list = []
        for task in initial_tasks:
            full_context ='%s:%s' %(task.get_value('process'), task.get_value('context'))
            context_list.append(full_context)

        my.assertEquals(context_list, ['design2:design2/002','design3:design3/003'])
开发者ID:funic,项目名称:TACTIC,代码行数:86,代码来源:biz_test.py

示例2: _test_pipeline_connects

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import create [as 别名]
    def _test_pipeline_connects(my):

        # this is needed to prevent some trigger error on insert finding asset table
        if not Project.get_by_code('sample3d'):
            return

        Project.set_project('sample3d')
        from pipeline import Pipeline
        pipe = Pipeline.create('model_test','model_test','prod/asset')
        xml = '''
        <pipeline>  
  <process name="model"/>  
  <process name="texture"/>  
  <process name="shader"/>  
  <process name="rig"/>  
  <connect to="texture" from="model" context="model"/>  
  <connect to="shader" from="texture" context="texture"/>  
  <connect to="shot_test/layout" from="rig" context="rig"/> 
  <connect to="rig" from="texture" context="texture"/>  
  <connect to="shot_test/lighting" from="shader"/>  
</pipeline>'''
        pipe.set_value('pipeline', xml)
        pipe.set_pipeline(xml)
        pipe.commit()
        
        pipe = Pipeline.create('shot_test','shot_test','prod/shot')
        xml = '''
        <pipeline>
  <process name="layout"/>
  <process name="anim"/>
  <process name="char_final"/>
  <process name="effects"/>
  <process name="lighting"/>
  <process name="compositing"/>
  <connect to="layout" from="model_test/model" context="model"/>
  <connect to="layout" from="model_test/rig" context="rig"/>
  <connect to="anim" from="layout"/>
  <connect to="char_final" from="anim"/>
  <connect to="char_final" from="model_test/texture" context="texture"/>
  <connect to="effects" from="char_final" context='char_effects'/>
  <connect to="lighting" from="effects"/>
  <connect to="lighting" from="char_final" context='char_lgt'/>
  <connect to="compositing" from="lighting"/>
</pipeline>'''
        pipe.set_value('pipeline', xml)
        
        pipe.set_pipeline(xml)
        pipe.commit()
        from pyasm.biz import Pipeline
        pipeline = Pipeline.get_by_code('shot_test')
        back_connects = pipeline.get_backward_connects('layout')
        # we got 2 connections to layout from model_test
        my.assertEquals('model_test/model' in back_connects, True)
        my.assertEquals('model_test/rig' in back_connects, True)

   
        # test Context class
        context = Context('prod/shot', 'char_final')
        context_list = context.get_context_list()
        my.assertEquals(['char_effects','char_lgt'], context_list)
        
        context = Context('prod/shot', 'anim')
        context_list = context.get_context_list()
        my.assertEquals(['anim'], context_list)

        Project.set_project('unittest')
开发者ID:funic,项目名称:TACTIC,代码行数:68,代码来源:biz_test.py

示例3: _test_add_tasks

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import create [as 别名]
    def _test_add_tasks(my):

        pipe = Pipeline.create("person", "person", "unittest/person")
        xml = """
        <pipeline>
  <process name="design1"/>
  <process name="design2"/>
  <process name="design3"/>
  <connect to="design2" from="design1"/>
  <connect to="design3" from="design2"/>
</pipeline>"""
        pipe.set_value("pipeline", xml)

        pipe.set_pipeline(xml)
        pipe.commit()
        Pipeline.clear_cache()
        pipeline = Pipeline.get_by_code("person")
        my.assertEquals(pipeline != None, True)

        # add bunch of dummy initial tasks to the person
        initial_tasks = Task.add_initial_tasks(
            my.person, "person", processes=["design1", "design2"], mode="simple process", skip_duplicate=True
        )
        context_list = []
        for task in initial_tasks:
            full_context = "%s:%s" % (task.get_value("process"), task.get_value("context"))
            context_list.append(full_context)

        my.assertEquals(context_list, ["design1:design1", "design2:design2"])

        initial_tasks = Task.add_initial_tasks(
            my.person, "person", processes=["design1", "design2"], mode="simple process", skip_duplicate=False
        )
        context_list = []
        for task in initial_tasks:
            full_context = "%s:%s" % (task.get_value("process"), task.get_value("context"))
            context_list.append(full_context)

        my.assertEquals(context_list, ["design1:design1/001", "design2:design2/001"])

        initial_tasks = Task.add_initial_tasks(
            my.person,
            "person",
            contexts=["design1:design1/hi", "design2:design2/low"],
            mode="context",
            skip_duplicate=False,
        )
        context_list = []
        for task in initial_tasks:
            full_context = "%s:%s" % (task.get_value("process"), task.get_value("context"))
            context_list.append(full_context)

        my.assertEquals(context_list, ["design1:design1/hi", "design2:design2/low"])

        initial_tasks = Task.add_initial_tasks(
            my.person,
            "person",
            contexts=["design1:design1/hi", "design2:design2/low"],
            mode="context",
            skip_duplicate=False,
        )
        context_list = []
        for task in initial_tasks:
            full_context = "%s:%s" % (task.get_value("process"), task.get_value("context"))
            context_list.append(full_context)

        my.assertEquals(context_list, ["design1:design1/hi/001", "design2:design2/low/001"])

        initial_tasks = Task.add_initial_tasks(
            my.person,
            "person",
            contexts=["design1:design1/hi", "design2:design2/low"],
            mode="context",
            skip_duplicate=True,
        )
        # these are duplicated, so nothing should be created
        my.assertEquals(initial_tasks, [])

        single_task = Task.create(my.person, "RIGGIT", "Riggit task", assigned="admin", context="RIGGIT")
        single_task2 = Task.create(my.person, "RIGGIT", "Riggit task", assigned="admin", context="RIGGIT")

        # since context is explicity specified, it will stay RIGGIT
        my.assertEquals(single_task.get("context"), "RIGGIT")
        my.assertEquals(single_task2.get("context"), "RIGGIT")

        # via SearchType.create
        single_task3 = SearchType.create("sthpw/task")
        single_task3.set_parent(my.person)
        single_task3.set_value("process", "RIGGIT")
        single_task3.commit()

        my.assertEquals(single_task3.get("context"), "RIGGIT/001")

        single_task4 = Task.create(my.person, "RIGGIT", "Riggit task", assigned="admin")
        my.assertEquals(single_task4.get("context"), "RIGGIT/002")

        initial_tasks = Task.add_initial_tasks(
            my.person,
            "person",
            contexts=["design1:design1/hi", "design2:design2/low", "design3:design3", "design3:design3"],
#.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:TACTIC,代码行数:103,代码来源:biz_test.py

示例4: _test_add_tasks

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import create [as 别名]
    def _test_add_tasks(my):

        pipe = Pipeline.create('person','person','unittest/person')
        xml = '''
        <pipeline>
  <process name="design1"/>
  <process name="design2"/>
  <process name="design3"/>
  <connect to="design2" from="design1"/>
  <connect to="design3" from="design2"/>
</pipeline>'''
        pipe.set_value('pipeline', xml)
        
        pipe.set_pipeline(xml)
        pipe.commit()
        Pipeline.clear_cache()
        pipeline = Pipeline.get_by_code('person')
        my.assertEquals(pipeline != None, True)

        # add bunch of dummy initial tasks to the person
        initial_tasks = Task.add_initial_tasks(my.person, 'person', processes=['design1','design2'], mode='simple process', skip_duplicate=True)
        context_list = []
        for task in initial_tasks:
            full_context ='%s:%s' %(task.get_value('process'), task.get_value('context'))
            context_list.append(full_context)

        my.assertEquals(context_list, ['design1:design1','design2:design2'])

        initial_tasks = Task.add_initial_tasks(my.person, 'person', processes=['design1','design2'], mode='simple process', skip_duplicate=False)
        context_list = []
        for task in initial_tasks:
            full_context ='%s:%s' %(task.get_value('process'), task.get_value('context'))
            context_list.append(full_context)

        my.assertEquals(context_list, ['design1:design1/001','design2:design2/001'])

        initial_tasks = Task.add_initial_tasks(my.person, 'person', contexts=['design1:design1/hi','design2:design2/low'], mode='context', skip_duplicate=False)
        context_list = []
        for task in initial_tasks:
            full_context ='%s:%s' %(task.get_value('process'), task.get_value('context'))
            context_list.append(full_context)

        my.assertEquals(context_list, ['design1:design1/hi','design2:design2/low'])

        initial_tasks = Task.add_initial_tasks(my.person, 'person', contexts=['design1:design1/hi','design2:design2/low'], mode='context', skip_duplicate=False)
        context_list = []
        for task in initial_tasks:
            full_context ='%s:%s' %(task.get_value('process'), task.get_value('context'))
            context_list.append(full_context)

        my.assertEquals(context_list, ['design1:design1/hi/001','design2:design2/low/001'])

        initial_tasks = Task.add_initial_tasks(my.person, 'person', contexts=['design1:design1/hi','design2:design2/low'], mode='context', skip_duplicate=True)
        # these are duplicated, so nothing should be created
        my.assertEquals(initial_tasks, [])

        single_task = Task.create(my.person, "RIGGIT", "Riggit task", assigned='admin', context="RIGGIT")
        single_task2 = Task.create(my.person, "RIGGIT", "Riggit task", assigned='admin', context="RIGGIT")

        # since context is explicity specified, it will stay RIGGIT
        my.assertEquals(single_task.get('context'),'RIGGIT')
        my.assertEquals(single_task2.get('context'),'RIGGIT')

        # via SearchType.create
        single_task3 = SearchType.create('sthpw/task')
        single_task3.set_parent(my.person)
        single_task3.set_value('process', 'RIGGIT')
        single_task3.commit()
        
        my.assertEquals(single_task3.get('context'),'RIGGIT/001')
        
        single_task4 = Task.create(my.person, "RIGGIT", "Riggit task", assigned='admin')
        my.assertEquals(single_task4.get('context'),'RIGGIT/002')

        initial_tasks = Task.add_initial_tasks(my.person, 'person', contexts=['design1:design1/hi','design2:design2/low','design3:design3','design3:design3'], mode='context', skip_duplicate=False)
      
        context_list = []
        for task in initial_tasks:
            full_context ='%s:%s' %(task.get_value('process'), task.get_value('context'))
            context_list.append(full_context)

        my.assertEquals(context_list, ['design1:design1/hi/002','design2:design2/low/002', 'design3:design3','design3:design3/001'])

        
        initial_tasks = Task.add_initial_tasks(my.person, 'person', contexts=['design1:design1','design3:design3'], mode='context', skip_duplicate=False)
      
        context_list = []
        for task in initial_tasks:
            full_context ='%s:%s' %(task.get_value('process'), task.get_value('context'))
            context_list.append(full_context)

        my.assertEquals(context_list, ['design1:design1/002','design3:design3/002'])

        initial_tasks = Task.add_initial_tasks(my.person, 'person', processes=['design2','design3'], mode='standard', skip_duplicate=False)
        context_list = []
        for task in initial_tasks:
            full_context ='%s:%s' %(task.get_value('process'), task.get_value('context'))
            context_list.append(full_context)

        my.assertEquals(context_list, ['design2:design2/002','design3:design3/003'])
开发者ID:0-T-0,项目名称:TACTIC,代码行数:102,代码来源:biz_test.py

示例5: _test_pipeline_connects

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import create [as 别名]
    def _test_pipeline_connects(my):

        # this is needed to prevent some trigger error on insert finding asset table
        if not Project.get_by_code("sample3d"):
            return

        Project.set_project("sample3d")
        from pipeline import Pipeline

        pipe = Pipeline.create("model_test", "model_test", "prod/asset")
        xml = """
        <pipeline>  
  <process name="model"/>  
  <process name="texture"/>  
  <process name="shader"/>  
  <process name="rig"/>  
  <connect to="texture" from="model" context="model"/>  
  <connect to="shader" from="texture" context="texture"/>  
  <connect to="shot_test/layout" from="rig" context="rig"/> 
  <connect to="rig" from="texture" context="texture"/>  
  <connect to="shot_test/lighting" from="shader"/>  
</pipeline>"""
        pipe.set_value("pipeline", xml)
        pipe.set_pipeline(xml)
        pipe.commit()

        pipe = Pipeline.create("shot_test", "shot_test", "prod/shot")
        xml = """
        <pipeline>
  <process name="layout"/>
  <process name="anim"/>
  <process name="char_final"/>
  <process name="effects"/>
  <process name="lighting"/>
  <process name="compositing"/>
  <connect to="layout" from="model_test/model" context="model"/>
  <connect to="layout" from="model_test/rig" context="rig"/>
  <connect to="anim" from="layout"/>
  <connect to="char_final" from="anim"/>
  <connect to="char_final" from="model_test/texture" context="texture"/>
  <connect to="effects" from="char_final" context='char_effects'/>
  <connect to="lighting" from="effects"/>
  <connect to="lighting" from="char_final" context='char_lgt'/>
  <connect to="compositing" from="lighting"/>
</pipeline>"""
        pipe.set_value("pipeline", xml)

        pipe.set_pipeline(xml)
        pipe.commit()
        from pyasm.biz import Pipeline

        pipeline = Pipeline.get_by_code("shot_test")
        back_connects = pipeline.get_backward_connects("layout")
        # we got 2 connections to layout from model_test
        my.assertEquals("model_test/model" in back_connects, True)
        my.assertEquals("model_test/rig" in back_connects, True)

        # test Context class
        context = Context("prod/shot", "char_final")
        context_list = context.get_context_list()
        my.assertEquals(["char_effects", "char_lgt"], context_list)

        context = Context("prod/shot", "anim")
        context_list = context.get_context_list()
        my.assertEquals(["anim"], context_list)

        Project.set_project("unittest")
开发者ID:pombredanne,项目名称:TACTIC,代码行数:69,代码来源:biz_test.py


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