本文整理匯總了Python中vistrails.core.vistrail.controller.VistrailController.add_new_action方法的典型用法代碼示例。如果您正苦於以下問題:Python VistrailController.add_new_action方法的具體用法?Python VistrailController.add_new_action怎麽用?Python VistrailController.add_new_action使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vistrails.core.vistrail.controller.VistrailController
的用法示例。
在下文中一共展示了VistrailController.add_new_action方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: pipeline_from_generator
# 需要導入模塊: from vistrails.core.vistrail.controller import VistrailController [as 別名]
# 或者: from vistrails.core.vistrail.controller.VistrailController import add_new_action [as 別名]
def pipeline_from_generator(variable_gen):
# Get the original OutputPort module
orig_controller = variable_gen._generator.controller
base_pipeline = orig_controller.vistrail.getPipeline('dat-vars')
if len(base_pipeline.module_list) != 1:
raise ValueError("dat-vars version is invalid")
output_port = base_pipeline.module_list[0]
controller = VistrailController(Vistrail())
# OutputPort
operations = [('add', output_port)]
# Rest of the pipeline
operations += variable_gen._generator.operations
# Connection
connection = controller.create_connection(
variable_gen._output_module,
variable_gen._outputport_name,
output_port,
'InternalPipe')
operations.append(('add', connection))
# Materialize this
action = create_action(operations)
controller.add_new_action(action)
version = controller.perform_action(action)
controller.change_selected_version(version)
assert version == controller.current_version == 1
return controller.current_pipeline, 1