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


Python Pipeline.clear_cache方法代码示例

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


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

示例1: _test_add_tasks

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import clear_cache [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

示例2: _test_add_tasks

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import clear_cache [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

示例3: _test_add_tasks

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import clear_cache [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


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