本文整理汇总了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'])
示例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'])
示例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"],
#.........这里部分代码省略.........