本文整理汇总了Python中pipeline.Pipeline.get_by_code方法的典型用法代码示例。如果您正苦于以下问题:Python Pipeline.get_by_code方法的具体用法?Python Pipeline.get_by_code怎么用?Python Pipeline.get_by_code使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pipeline.Pipeline
的用法示例。
在下文中一共展示了Pipeline.get_by_code方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_output_tasks
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import get_by_code [as 别名]
def get_output_tasks(my):
process = my.get_value("process")
parent = my.get_parent()
# get the pipeline
pipeline_code = parent.get_value("pipeline_code", no_exception=True)
if not pipeline_code:
return []
pipeline = Pipeline.get_by_code(pipeline_code)
if not pipeline:
return []
processes = pipeline.get_output_processes(process)
if not processes:
return []
tasks = []
process_names = [x.get_name() for x in processes]
search = Search("sthpw/task")
search.add_filters("process", process_names)
search.add_parent_filter(parent)
tasks = search.get_sobjects()
return tasks
示例2: get_status_colors
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import get_by_code [as 别名]
def get_status_colors():
status_colors = {}
task_pipelines = Search.eval("@SOBJECT(sthpw/pipeline['search_type','sthpw/task'])")
task_pipelines.append( Pipeline.get_by_code("task") )
task_pipelines.append( Pipeline.get_by_code("approval") )
if task_pipelines:
for task_pipeline in task_pipelines:
processes = task_pipeline.get_processes()
pipeline_code = task_pipeline.get_code()
status_colors[pipeline_code] = {}
for process in processes:
process_dict = status_colors.get(pipeline_code)
color = process.get_color()
if not color:
color = Task.get_default_color(process.get_name())
process_dict[process.get_name()] = color
return status_colors
示例3: get_pipeline
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import get_by_code [as 别名]
def get_pipeline(my):
# for now assume the "task" pipeline if none found
pipe_code = my.get_value("pipeline_code")
if not pipe_code:
pipe_code = "task"
pipeline = Pipeline.get_by_code(pipe_code)
if not pipeline:
pipeline = SearchType.create("sthpw/pipeline")
pipeline.set_value("code", pipe_code)
pipeline.set_value("pipeline", task.get_default_task_xml())
return pipeline
示例4: init
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import get_by_code [as 别名]
def init(my):
# get the pipeline
if my.sobject.has_value("pipeline_code"):
pipeline_code = my.sobject.get_value("pipeline_code")
if pipeline_code == "":
pipeline_code = my.get_option("pipeline")
else:
pipeline_code = my.get_option("pipeline")
my.pipeline = Pipeline.get_by_code(pipeline_code, allow_default=True)
if not my.pipeline:
raise SetupException("Pipeline 'default' is required in the table [sthpw.pipeline]")
示例5: get_defaults
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import get_by_code [as 别名]
def get_defaults(my):
'''specifies the defaults for this sobject'''
pipeline_code =''
task_process = my.get_value("process")
parent = None
if task_process:
# TODO: this is slow. Need presearch all of the parents
parent = my.get_parent()
if parent:
parent_pipeline_code = parent.get_value('pipeline_code', no_exception=True)
pipeline = Pipeline.get_by_code(parent_pipeline_code)
if pipeline:
attributes = pipeline.get_process_attrs(task_process)
pipeline_code = attributes.get('task_pipeline')
if not pipeline_code:
node_type = attributes.get('type')
if node_type == "approval":
pipeline_code = "approval"
elif node_type == "task":
pipeline_code = "approval"
if not pipeline_code:
pipeline_code = 'task'
# in case it's a subpipeline
context = task_process
context=my._add_context_suffix(context,task_process,parent)
# then use the project as a parent
project = Project.get()
search_type = "sthpw/project"
search_id = project.get_id()
defaults = {
"pipeline_code": pipeline_code,
"project_code": Project.get_project_code(),
"context": context,
"search_type": search_type,
"search_id": search_id
}
if SearchType.column_exists("sthpw/task", "search_code"):
search_code = project.get_code()
defaults['search_code'] = search_code
return defaults
示例6: __init__
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import get_by_code [as 别名]
def __init__(my, status_xml, pipeline):
assert status_xml != None
# FIXME: what is this
#assert pipeline != None
if not pipeline:
pipeline = Pipeline.get_by_code("default")
if status_xml == "":
status_xml = "<status/>"
my.status = Xml()
my.status.read_string(status_xml)
my.pipeline = pipeline
示例7: add_initial_tasks
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import get_by_code [as 别名]
def add_initial_tasks(sobject, pipeline_code=None, processes=[], contexts=[], skip_duplicate=True, mode='standard',start_offset=0):
'''add initial tasks based on the pipeline of the sobject'''
from pipeline import Pipeline
def _get_context(existing_task_dict, process_name, context=None):
existed = False
if not existing_task_dict:
if context:
context = context
else:
context = process_name
else:
compare_key = "%s:%s" %(process_name, context)
max_num = 0
for item in existing_task_dict.keys():
item_stripped = re.sub('/\d+$', '', item)
#if item.startswith(compare_key):
if item_stripped == compare_key:
existing_context = item.replace('%s:'%process_name,'')
suffix = existing_context.split('/')[-1]
try:
num = int(suffix)
except:
num = 0
if num > max_num:
max_num = num
existed = True
if existed:
context = "%s/%0.3d" % (context, max_num+1)
return context
# get pipeline
if not pipeline_code:
pipeline_code = sobject.get_value("pipeline_code")
if pipeline_code in ['', '__default__']:
pipeline = SearchType.create("sthpw/pipeline")
pipeline.set_value("code", "__default__")
pipeline.set_value("pipeline", '''
<pipeline>
<process name='publish'/>
</pipeline>
''')
# FIXME: HACK to initialize virtual pipeline
pipeline.set_pipeline(pipeline.get_value("pipeline"))
else:
pipeline = Pipeline.get_by_code(pipeline_code)
if not pipeline:
print "WARNING: pipeline '%s' does not exist" % pipeline_code
return []
#TODO: add recursive property here
if processes:
process_names = processes
else:
process_names = pipeline.get_process_names(recurse=True)
# remember which ones already exist
existing_tasks = Task.get_by_sobject(sobject, order=False)
existing_task_dict = {}
for x in existing_tasks:
key1 = '%s:%s' %(x.get_value('process'),x.get_value("context"))
existing_task_dict[key1] = True
# for backward compatibility, if the process has been created, we will skip later below
# we may remove this in the future
#key2 = '%s' %(x.get_value('process'))
#existing_task_dict[key2] = True
# create all of the tasks
description = ""
tasks = []
start_date = Date()
start_date.add_days(start_offset)
bid_duration_unit = ProdSetting.get_value_by_key("bid_duration_unit")
if not bid_duration_unit:
bid_duration_unit = 'hour'
# that's the date range in 5 days (not hours)
default_duration = 5
default_bid_duration = 8
if bid_duration_unit == 'minute':
default_bid_duration = 60
last_task = None
# this is the explicit mode for creating task for a specific process:context combo
if mode=='context':
#.........这里部分代码省略.........
示例8: _test_add_tasks
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import get_by_code [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'])
示例9: _test_pipeline_connects
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import get_by_code [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')
示例10: _test_pipeline
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import get_by_code [as 别名]
def _test_pipeline(my):
# test project specific pipelines
pipeline_xml = '''
<pipeline>
<process name='sketch'/>
<process name='design'/>
<process name='build'/>
<process name='deploy'/>
</pipeline>
'''
pipeline = SearchType.create("sthpw/pipeline")
pipeline.set_value("pipeline", pipeline_xml)
pipeline.set_value("code", "unittest/test")
pipeline.set_value("search_type", "unittest/person")
pipeline.commit()
pipeline = Pipeline.get_by_code("unittest/test")
my.assertEquals("sthpw/pipeline", pipeline.get_search_type() )
process_names = pipeline.get_process_names()
my.assertEquals(4, len(process_names))
# test project specific pipelines
pipeline_xml = '''
<pipeline>
<process name='think'/>
<process name='sketch'/>
<process name='design'/>
<process name='build'/>
<process name='deploy'/>
</pipeline>
'''
pipeline = SearchType.create("config/pipeline")
pipeline.set_value("pipeline", pipeline_xml)
pipeline.set_value("code", "unittest/test")
pipeline.set_value("search_type", "unittest/person")
pipeline.commit()
pipeline = Pipeline.get_by_code("unittest/test")
my.assertEquals("config/pipeline?project=unittest", pipeline.get_search_type() )
process_names = pipeline.get_process_names()
my.assertEquals(5, len(process_names))
return
# TEST
# TEST
# TEST
pipeline_xml = '''
<pipeline>
<process name='layout'>
<input name='instance' search_type='prod/shot_instance?project=bar' context='model' filter='asset_library=chr'/>
<input name='asset' search_type='prod/asset?project=bar' context='model' filter='asset_library=chr'/>
</process>
<process name='animation'/>
</pipeline>
'''
search = Search("prod/shot?project=bar")
search.add_filter("code", "XG002")
shot = search.get_sobject()
pipeline = SearchType.create("sthpw/pipeline")
pipeline.set_pipeline( pipeline_xml)
snapshots = pipeline.get_input_snapshots(shot, 'layout', 'asset')
示例11: _test_add_tasks
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import get_by_code [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'])
示例12: _test_add_tasks
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import get_by_code [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"],
#.........这里部分代码省略.........
示例13: _test_pipeline_connects
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import get_by_code [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")