예제 #1
0
파일: init.py 프로젝트: painter1/vistrails
def handle_module_upgrade_request(controller, module_id, pipeline):
    module_remap = {'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', {})]
                    }

    return UpgradeWorkflowHandler.remap_module(controller, module_id, pipeline,
                                               module_remap)
예제 #2
0
def handle_module_upgrade_request(controller, module_id, pipeline):
    module_remap = {
        'PersistentFile': [(None, '0.1.0', 'PersistentIntermediateFile', {
            'dst_port_remap': {
                'compress': None
            }
        })],
        'PersistentDirectory': [(None, '0.1.0', 'PersistentIntermediateDir', {
            'dst_port_remap': {
                'compress': None
            }
        })]
    }
    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)
def handle_module_upgrade_request(controller, module_id, pipeline):
    module_remap = {'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', {})]
                    }

    return UpgradeWorkflowHandler.remap_module(controller, module_id, pipeline,
                                               module_remap)
예제 #4
0
def handle_module_upgrade_request(controller, module_id, pipeline):
    module_remap = {'ReadCSVReadyFile': [(None, '1.0.1', None, {})],
                    'IsMatchCSVFileTables': [(None, '1.0.1', None, {})],
                    'GetCSVFiles': [(None, '1.0.1', None, {})],
                    'DetectionsHistogram': [(None, '1.0.1', None, {})],
                    }

    return UpgradeWorkflowHandler.remap_module(controller, module_id, pipeline,
                                               module_remap)
예제 #5
0
def handle_module_upgrade_request(controller, module_id, pipeline):
    from core.upgradeworkflow import UpgradeWorkflowHandler
    reg = get_module_registry()

    def outputName_remap(old_conn, new_module):
        ops = []
        old_src_module = pipeline.modules[old_conn.source.moduleId]
        op_desc = reg.get_descriptor(OutputPath)
        new_x = (old_src_module.location.x + new_module.location.x) / 2.0
        new_y = (old_src_module.location.y + new_module.location.y) / 2.0
        op_module = \
            controller.create_module_from_descriptor(op_desc, new_x, new_y)
        ops.append(('add', op_module))
        create_new_connection = UpgradeWorkflowHandler.create_new_connection
        new_conn_1 = create_new_connection(controller, old_src_module,
                                           old_conn.source, op_module, "name")
        ops.append(('add', new_conn_1))
        new_conn_2 = create_new_connection(controller, op_module, "value",
                                           new_module, "outputPath")
        ops.append(('add', new_conn_2))
        return ops

    module_remap = {
        'FileSink': [(None, '1.6', None, {
            'dst_port_remap': {
                'overrideFile': 'overwrite',
                'outputName': outputName_remap
            },
            'function_remap': {
                'overrideFile': 'overwrite',
                'outputName': 'outputPath'
            }
        })],
        'GetItemsFromDirectory': [(None, '1.6', 'Directory', {
            'dst_port_remap': {
                'dir': 'value'
            },
            'src_port_remap': {
                'itemlist': 'itemList'
            },
        })],
        'InputPort': [(None, '1.6', None, {
            'dst_port_remap': {
                'old_name': None
            }
        })],
        'OutputPort': [(None, '1.6', None, {
            'dst_port_remap': {
                'old_name': None
            }
        })],
        'PythonSource': [(None, '1.6', None, {})],
    }

    return UpgradeWorkflowHandler.remap_module(controller, module_id, pipeline,
                                               module_remap)
def handle_module_upgrade_request(controller, module_id, pipeline):
   from core.upgradeworkflow import UpgradeWorkflowHandler
   reg = get_module_registry()

   def outputName_remap(old_conn, new_module):
       ops = []
       old_src_module = pipeline.modules[old_conn.source.moduleId]
       op_desc = reg.get_descriptor(OutputPath)
       new_x = (old_src_module.location.x + new_module.location.x) / 2.0
       new_y = (old_src_module.location.y + new_module.location.y) / 2.0
       op_module = \
           controller.create_module_from_descriptor(op_desc, new_x, new_y)
       ops.append(('add', op_module))
       create_new_connection = UpgradeWorkflowHandler.create_new_connection
       new_conn_1 = create_new_connection(controller,
                                          old_src_module,
                                          old_conn.source,
                                          op_module,
                                          "name")
       ops.append(('add', new_conn_1))
       new_conn_2 = create_new_connection(controller,
                                          op_module,
                                          "value",
                                          new_module,
                                          "outputPath")
       ops.append(('add', new_conn_2))
       return ops

   module_remap = {'FileSink':
                       [(None, '1.6', None,
                         {'dst_port_remap':
                              {'overrideFile': 'overwrite',
                               'outputName': outputName_remap},
                          'function_remap':
                              {'overrideFile': 'overwrite',
                               'outputName': 'outputPath'}})],
                   'GetItemsFromDirectory':
                       [(None, '1.6', 'Directory',
                         {'dst_port_remap':
                              {'dir': 'value'},
                          'src_port_remap':
                              {'itemlist': 'itemList'},
                          })],
                   'InputPort':
                       [(None, '1.6', None,
                         {'dst_port_remap': {'old_name': None}})],
                   'OutputPort':
                       [(None, '1.6', None,
                         {'dst_port_remap': {'old_name': None}})],
                   'PythonSource':
                       [(None, '1.6', None, {})],
                   }

   return UpgradeWorkflowHandler.remap_module(controller, module_id, pipeline,
                                              module_remap)
예제 #7
0
def handle_module_upgrade_request(controller, module_id, pipeline):
    reg = get_module_registry()

    # format is {<old module name>: (<new_module_klass>, <remap_dictionary>}}
    # where remap_dictionary is {<remap_type>: <name_changes>}
    # and <name_changes> is a map from <old_name> to <new_name> or
    # <remap_function>

    module_remap = {
        'ListOfElements': (List, {}),
        'Fold': (Fold, {}),
        'If': (If, {}),
        'Dot': (Dot, {}),
        'Cross': (Cross, {}),
        'Map': (Map, {}),
        'Filter': (Filter, {}),
        'AreaFilter': (AreaFilter, {}),
        'SimilarityFilter': (SimilarityFilter, {}),
    }

    old_module = pipeline.modules[module_id]
    if old_module.name in module_remap:
        remap = module_remap[old_module.name]
        new_descriptor = reg.get_descriptor(remap[0])
        try:
            function_remap = remap[1].get('function_remap', {})
            src_port_remap = remap[1].get('src_port_remap', {})
            dst_port_remap = remap[1].get('dst_port_remap', {})
            annotation_remap = remap[1].get('annotation_remap', {})
            action_list = \
                UpgradeWorkflowHandler.replace_module(controller, pipeline,
                                                      module_id, new_descriptor,
                                                      function_remap,
                                                      src_port_remap,
                                                      dst_port_remap,
                                                      annotation_remap)
        except Exception, e:
            import traceback
            traceback.print_exc()
            raise

        return action_list
def handle_module_upgrade_request(controller, module_id, pipeline):
   reg = get_module_registry()

   # format is {<old module name>: (<new_module_klass>, <remap_dictionary>}}
   # where remap_dictionary is {<remap_type>: <name_changes>}
   # and <name_changes> is a map from <old_name> to <new_name> or 
   # <remap_function>
       
   module_remap = {'ListOfElements': (List, {}),
                   'Fold': (Fold, {}),
                   'If': (If, {}),
                   'Dot': (Dot, {}),
                   'Cross': (Cross, {}),
                   'Map': (Map, {}),
                   'Filter': (Filter, {}),
                   'AreaFilter': (AreaFilter, {}),
                   'SimilarityFilter': (SimilarityFilter, {}),
                   }
                   

   old_module = pipeline.modules[module_id]
   if old_module.name in module_remap:
       remap = module_remap[old_module.name]
       new_descriptor = reg.get_descriptor(remap[0])
       try:
           function_remap = remap[1].get('function_remap', {})
           src_port_remap = remap[1].get('src_port_remap', {})
           dst_port_remap = remap[1].get('dst_port_remap', {})
           annotation_remap = remap[1].get('annotation_remap', {})
           action_list = \
               UpgradeWorkflowHandler.replace_module(controller, pipeline,
                                                     module_id, new_descriptor,
                                                     function_remap,
                                                     src_port_remap,
                                                     dst_port_remap,
                                                     annotation_remap)
       except Exception, e:
           import traceback
           traceback.print_exc()
           raise

       return action_list
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 = 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
예제 #10
0
파일: init.py 프로젝트: painter1/vistrails
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 = 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
예제 #11
0
def handle_module_upgrade_request(controller, module_id, pipeline):
    module_remap = {'PersistentFile':
                        [(None, '0.1.0', 'PersistentIntermediateFile',
                          {'dst_port_remap':
                               {'compress': None}})],
                    'PersistentDirectory':
                        [(None, '0.1.0', 'PersistentIntermediateDir',
                          {'dst_port_remap':
                               {'compress': None}})]
                    }
    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)
예제 #12
0
        'SimilarityFilter': (SimilarityFilter, {}),
    }

    old_module = pipeline.modules[module_id]
    if old_module.name in module_remap:
        remap = module_remap[old_module.name]
        new_descriptor = reg.get_descriptor(remap[0])
        try:
            function_remap = remap[1].get('function_remap', {})
            src_port_remap = remap[1].get('src_port_remap', {})
            dst_port_remap = remap[1].get('dst_port_remap', {})
            annotation_remap = remap[1].get('annotation_remap', {})
            action_list = \
                UpgradeWorkflowHandler.replace_module(controller, pipeline,
                                                      module_id, new_descriptor,
                                                      function_remap,
                                                      src_port_remap,
                                                      dst_port_remap,
                                                      annotation_remap)
        except Exception, e:
            import traceback
            traceback.print_exc()
            raise

        return action_list

    # otherwise, just try to automatic upgrade
    # attempt_automatic_upgrade
    return UpgradeWorkflowHandler.attempt_automatic_upgrade(
        controller, pipeline, module_id)
예제 #13
0
 def handle_module_upgrade_request(self, controller, module_id, pipeline):
     module_remap = {'Workflow Timer':
                     [(None, '0.1.3', 'WorkflowTimer', {})],
                     }
     return UpgradeWorkflowHandler.remap_module(controller, module_id,
                                                pipeline, module_remap)
예제 #14
0
    if old_module.package == 'edu.utah.sci.vistrails.sudswebservices':
        reg = 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:
예제 #15
0
def handle_module_upgrade_request(controller, module_id, pipeline):
    module_remap = {'SQLSource': [(None, '0.0.3', None, {})]}

    return UpgradeWorkflowHandler.remap_module(controller, module_id, pipeline,
                                               module_remap)