本文整理汇总了Python中vistrails.core.upgradeworkflow.UpgradeWorkflowHandler类的典型用法代码示例。如果您正苦于以下问题:Python UpgradeWorkflowHandler类的具体用法?Python UpgradeWorkflowHandler怎么用?Python UpgradeWorkflowHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UpgradeWorkflowHandler类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: handle_module_upgrade_request
def handle_module_upgrade_request(controller, module_id, pipeline):
old_module = pipeline.modules[module_id]
# first check package
# v1.0 types:
if old_module.package == 'edu.utah.sci.vistrails.sudswebservices':
wsdl = old_module.namespace.split('|')[0]
namespace = old_module.namespace.split('|')[1]
else:
wsdl = toAddress(old_module.package)
namespace = old_module.namespace
name = old_module.name
wsdlList = []
if configuration.check('wsdlList'):
wsdlList = configuration.wsdlList.split(";")
if not wsdl in wsdlList:
service = Service(wsdl)
if not service.service:
return []
webServicesDict[wsdl] = service
wsdlList.append(wsdl)
configuration.wsdlList = ';'.join(wsdlList)
if old_module.package == 'edu.utah.sci.vistrails.sudswebservices':
reg = vistrails.core.modules.module_registry.get_module_registry()
new_descriptor = reg.get_descriptor_by_name(toSignature(wsdl), name,
namespace)
if not new_descriptor:
return []
return UpgradeWorkflowHandler.replace_module(controller, pipeline,
module_id, new_descriptor)
return UpgradeWorkflowHandler.attempt_automatic_upgrade(controller,
pipeline,
module_id)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:35,代码来源:init.py
示例2: handle_module_upgrade_request
def handle_module_upgrade_request(controller, module_id, pipeline):
old_module = pipeline.modules[module_id]
if old_module.name == "JSONFile" and old_module.version != "0.1.5" and old_module.namespace == "read":
from vistrails.core.db.action import create_action
from vistrails.core.modules.module_registry import get_module_registry
from .read.read_json import JSONObject
reg = get_module_registry()
new_desc = reg.get_descriptor(JSONObject)
new_module = controller.create_module_from_descriptor(new_desc, old_module.location.x, old_module.location.y)
actions = UpgradeWorkflowHandler.replace_generic(controller, pipeline, old_module, new_module)
new_function = controller.create_function(new_module, "key_name", ["_key"])
actions.append(create_action([("add", new_function, "module", new_module.id)]))
return actions
module_remap = {
"read|csv|CSVFile": [(None, "0.1.1", "read|CSVFile", {"src_port_remap": {"self": "value"}})],
"read|numpy|NumPyArray": [(None, "0.1.1", "read|NumPyArray", {"src_port_remap": {"self": "value"}})],
"read|CSVFile": [("0.1.1", "0.1.2", None, {"src_port_remap": {"self": "value"}}), ("0.1.3", "0.1.5", None, {})],
"read|NumPyArray": [("0.1.1", "0.1.2", None, {"src_port_remap": {"self": "value"}})],
"read|ExcelSpreadsheet": [
("0.1.1", "0.1.2", None, {"src_port_remap": {"self": "value"}}),
("0.1.3", "0.1.4", None, {}),
],
"read|JSONFile": [(None, "0.1.5", "read|JSONObject")],
}
return UpgradeWorkflowHandler.remap_module(controller, module_id, pipeline, module_remap)
开发者ID:remram44,项目名称:tabledata-backport,代码行数:29,代码来源:init.py
示例3: handle_module_upgrade_request
def handle_module_upgrade_request(controller, module_id, pipeline):
module_remap = {
'CellLocation': [
(None, '0.9.3', None, {
'src_port_remap': {
'self': 'value'},
}),
],
'SheetReference': [
(None, '0.9.3', None, {
'src_port_remap': {
'self': 'value'},
}),
],
'SingleCellSheetReference': [
(None, '0.9.3', None, {
'src_port_remap': {
'self': 'value'},
}),
],
}
return UpgradeWorkflowHandler.remap_module(controller,
module_id,
pipeline,
module_remap)
开发者ID:Nikea,项目名称:VisTrails,代码行数:26,代码来源:init.py
示例4: product_change_connection
def product_change_connection(old_conn, new_module):
src_module = pipeline.modules[old_conn.source.moduleId]
new_x = (src_module.location.x + new_module.location.x) / 2.0
new_y = (src_module.location.y + new_module.location.y) / 2.0
Not_desc = reg.get_descriptor(Not)
not_mod = controller.create_module_from_descriptor(Not_desc,
new_x, new_y)
conn1 = UpgradeWorkflowHandler.create_new_connection(
controller,
src_module, old_conn.source,
not_mod, 'input')
conn2 = UpgradeWorkflowHandler.create_new_connection(
controller,
not_mod, 'value',
new_module, 'NumericalProduct')
return [('add', not_mod), ('add', conn1), ('add', conn2)]
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:16,代码来源:init.py
示例5: handle_module_upgrade_request
def handle_module_upgrade_request(controller, module_id, pipeline):
module_remap = {
# HTTPFile was renamed DownloadFile
'HTTPFile': [
(None, '1.0.0', 'DownloadFile', {})
],
}
return UpgradeWorkflowHandler.remap_module(controller,
module_id,
pipeline,
module_remap)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:12,代码来源:init.py
示例6: handle_module_upgrade_request
def handle_module_upgrade_request(controller, module_id, pipeline):
def add_keyname(fname, module):
new_function = controller.create_function(module,
"key_name",
["_key"])
return [('add', new_function, 'module', module.id)]
module_remap = {
'read|csv|CSVFile': [
(None, '0.1.1', 'read|CSVFile', {
'src_port_remap': {
'self': 'value'},
})
],
'read|numpy|NumPyArray': [
(None, '0.1.1', 'read|NumPyArray', {
'src_port_remap': {
'self': 'value'},
})
],
'read|CSVFile': [
('0.1.1', '0.1.2', None, {
'src_port_remap': {
'self': 'value'},
}),
('0.1.3', '0.1.5', None, {})
],
'read|NumPyArray': [
('0.1.1', '0.1.2', None, {
'src_port_remap': {
'self': 'value'},
})
],
'read|ExcelSpreadsheet': [
('0.1.1', '0.1.2', None, {
'src_port_remap': {
'self': 'value'},
}),
('0.1.3', '0.1.4', None, {})
],
'read|JSONFile': [
(None, '0.1.5', 'read|JSONObject', {
'function_remap': {
None: add_keyname},
})
],
}
return UpgradeWorkflowHandler.remap_module(controller,
module_id,
pipeline,
module_remap)
开发者ID:tacaswell,项目名称:VisTrails,代码行数:52,代码来源:init.py
示例7: handle_module_upgrade_request
def handle_module_upgrade_request(controller, module_id, pipeline):
module_remap = {
'read|csv|CSVFile': [
(None, '0.1.1', 'read|CSVFile', {})
],
'read|numpy|NumPyArray': [
(None, '0.1.1', 'read|NumPyArray', {})
],
}
return UpgradeWorkflowHandler.remap_module(controller,
module_id,
pipeline,
module_remap)
开发者ID:cjh1,项目名称:VisTrails,代码行数:14,代码来源:init.py
示例8: handle_module_upgrade_request
def handle_module_upgrade_request(controller, module_id, pipeline):
# prepend 'hadoop|' to hadoop modules < 0.3.1
reg = get_module_registry()
hadoop_remaps = ['PythonSourceToFile', 'HDFSPut', 'HDFSGet',
'HDFSEnsureNew', 'URICreator', 'HadoopStreaming']
module_remap = {}
for name in hadoop_remaps:
module_remap[name] = [(None, '0.3.0', "hadoop|%s" % name, {})]
return UpgradeWorkflowHandler.remap_module(controller,
module_id,
pipeline,
module_remap)
开发者ID:hjanime,项目名称:VisTrails,代码行数:14,代码来源:init.py
示例9: handle_module_upgrade_request
def handle_module_upgrade_request(controller, module_id, pipeline):
module_remap = {
# Migrates from pre-0.1.0 to 0.2.0+
'PersistentFile': [
(None, '0.1.0', 'PersistentIntermediateFile', {
'dst_port_remap': {
'compress': None}})],
'PersistentDirectory': [
(None, '0.1.0', 'PersistentIntermediateDir', {
'dst_port_remap': {
'compress': None}})],
# Migrates from persistence_exp (0.1.0-0.2.0) to 0.2.0+
'ManagedRef': [
('0.1.0', None, 'persistence:PersistentRef', {})],
'ManagedPath': [
('0.1.0', None, 'persistence:PersistentPath', {})],
'ManagedFile': [
('0.1.0', None, 'persistence:PersistentFile', {})],
'ManagedDir': [
('0.1.0', None, 'persistence:PersistentDir', {})],
'ManagedInputFile': [
('0.1.0', None, 'persistence:PersistentInputFile', {})],
'ManagedOutputFile': [
('0.1.0', None, 'persistence:PersistentOutputFile', {})],
'ManagedIntermediateFile': [
('0.1.0', None, 'persistence:PersistentIntermediateFile', {})],
'ManagedInputDir': [
('0.1.0', None, 'persistence:PersistentInputDir', {})],
'ManagedOutputDir': [
('0.1.0', None, 'persistence:PersistentOutputDir', {})],
'ManagedIntermediateDir': [
('0.1.0', None, 'persistence:PersistentIntermediateDir', {})]
}
for module in ['PersistentPath', 'PersistentFile', 'PersistentDir',
'PersistentInputFile', 'PersistentOutputFile',
'PersistentIntermediateFile',
'PersistentInputDir', 'PersistentOutputDir',
'PersistentIntermediateDir']:
upgrade = ('0.2.0', '0.2.2', None,
{'dst_port_remap': {'ref': 'ref'}})
if module in module_remap:
module_remap[module].append(upgrade)
else:
module_remap[module] = [upgrade]
return UpgradeWorkflowHandler.remap_module(controller, module_id, pipeline,
module_remap)
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:47,代码来源:init.py
示例10: handle_module_upgrade_request
def handle_module_upgrade_request(controller, module_id, pipeline):
module_remap = {
'read|csv|CSVFile': [
(None, '0.1.1', 'read|CSVFile', {
'src_port_remap': {
'self': 'value'},
})
],
'read|numpy|NumPyArray': [
(None, '0.1.1', 'read|NumPyArray', {
'src_port_remap': {
'self': 'value'},
})
],
'read|CSVFile': [
('0.1.1', '0.1.2', None, {
'src_port_remap': {
'self': 'value'},
})
],
'read|NumPyArray': [
('0.1.1', '0.1.2', None, {
'src_port_remap': {
'self': 'value'},
})
],
'read|ExcelSpreadsheet': [
('0.1.1', '0.1.2', None, {
'src_port_remap': {
'self': 'value'},
})
],
}
return UpgradeWorkflowHandler.remap_module(controller,
module_id,
pipeline,
module_remap)
开发者ID:dakoop,项目名称:vistrails-mta-example,代码行数:38,代码来源:init.py
示例11: handle_module_upgrade_request
def handle_module_upgrade_request(controller, module_id, pipeline):
from vistrails.core.upgradeworkflow import UpgradeWorkflowHandler
create_new_connection = UpgradeWorkflowHandler.create_new_connection
reg = vistrails.core.modules.module_registry.get_module_registry()
def find_module_in_upgrade_action(action):
for op in action.operations:
if isinstance(op, AddOp):
if op.what == Module.vtType:
return op.data
return None
def find_inputs(m):
functions = {}
for f in m.functions:
if f.name not in functions:
functions[f.name] = [f]
else:
functions[f.name].append(f)
connections = {}
for edge in pipeline.graph.iter_edges_to(m.id):
c = pipeline.connections[edge[2]]
if c.destination.name not in connections:
connections[c.destination.name] = [c]
else:
connections[c.destination.name].append(c)
return (functions, connections)
def find_figure(m):
for edge in pipeline.graph.iter_edges_from(m.id):
to_m = pipeline.modules[edge[1]]
if to_m.name == 'MplFigure':
# !!! assume only a single down-stream MplFigure !!!
# may have old or new module...
if pipeline.connections[edge[2]].destination.name == 'addPlot':
return (to_m, None)
else:
return (to_m, edge)
return (None, None)
def attach_inputs(new_module, inputs, selected_inputs):
conns = []
for port_name in selected_inputs:
if port_name in inputs[0]:
for f in inputs[0][port_name]:
if len(f.parameters) > 0:
new_param_vals, aliases = zip(*[(p.strValue, p.alias)
for p in f.parameters])
else:
new_param_vals = []
aliases = []
new_f = controller.create_function(new_module,
port_name,
new_param_vals,
aliases)
new_module.add_function(new_f)
if port_name in inputs[1]:
for c in inputs[1][port_name]:
source_module = pipeline.modules[c.source.id]
new_conn = create_new_connection(controller,
source_module,
c.source,
new_module,
port_name)
conns.append(new_conn)
return conns
module = pipeline.modules[module_id]
to_properties = []
to_axes = []
old_figure = (None, None)
if module.name == 'MplScatterplot':
props_name = 'MplPathCollectionProperties'
props_input = 'pathCollectionProperties'
to_properties = ['facecolor']
to_axes = ['title', 'xlabel', 'ylabel']
inputs = find_inputs(module)
old_loc = module.location
old_figure = find_figure(module)
elif module.name == 'MplHistogram':
props_name = 'MplRectangleProperties'
props_input = 'rectangleProperties'
to_properties = ['facecolor']
to_axes = ['title', 'xlabel', 'ylabel']
inputs = find_inputs(module)
old_loc = module.location
old_figure = find_figure(module)
module_remap = {'MplPlot':
[(None, '1.0.0', 'MplSource',
{'dst_port_remap': {'source': 'source',
'Hide Toolbar': None},
'src_port_remap': {'source': 'value',
'self': 'value'}})],
'MplFigure':
[(None, '1.0.0', None,
{'dst_port_remap': {'Script': 'addPlot'},
'src_port_remap': {'FigureManager': 'self',
'File': 'file'}})],
'MplFigureCell':
#.........这里部分代码省略.........
开发者ID:alexmavr,项目名称:VisTrails,代码行数:101,代码来源:init.py
示例12: handle_missing_module
if old_module.package == 'edu.utah.sci.vistrails.sudswebservices':
reg = vistrails.core.modules.module_registry.get_module_registry()
new_descriptor = reg.get_descriptor_by_name(toSignature(wsdl), name,
namespace)
if not new_descriptor:
return []
try:
return UpgradeWorkflowHandler.replace_module(controller, pipeline,
module_id, new_descriptor)
except Exception, e:
import traceback
traceback.print_exc()
raise
return UpgradeWorkflowHandler.attempt_automatic_upgrade(controller,
pipeline,
module_id)
def handle_missing_module(controller, module_id, pipeline):
global webServicesDict
global package_cache
def get_wsdl_from_namespace(m_namespace):
try:
wsdl = m_namespace.split("|")
return wsdl[0]
except:
return None
m = pipeline.modules[module_id]
if m.package == identifier:
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:31,代码来源:init.py
注:本文中的vistrails.core.upgradeworkflow.UpgradeWorkflowHandler类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论