Exemplo n.º 1
0
def main(out_fname, in_fnames):
    """main(out_fname: str, in_fnames: list<str>) -> None
    Combines all vistrails specified in in_fnames into a single vistrail
    by renumbering their ids

    """
    # FIXME this breaks when you use abstractions!
    (save_bundle, vt_save_dir) = io.open_bundle_from_zip_xml(DBVistrail.vtType, in_fnames[0])
    for in_fname in in_fnames[1:]:
        (new_save_bundle, new_save_dir) = io.open_bundle_from_zip_xml(DBVistrail.vtType, in_fname)
        vistrails.db.services.vistrail.merge(save_bundle, new_save_bundle, "", True, vt_save_dir, new_save_dir)
    io.save_bundle_to_zip_xml(save_bundle, out_fname)
Exemplo n.º 2
0
def main(out_fname, in_fnames):
    """main(out_fname: str, in_fnames: list<str>) -> None
    Combines all vistrails specified in in_fnames into a single vistrail
    by renumbering their ids

    """
    # FIXME this breaks when you use abstractions!
    (save_bundle,
     vt_save_dir) = io.open_bundle_from_zip_xml(DBVistrail.vtType,
                                                in_fnames[0])
    for in_fname in in_fnames[1:]:
        (new_save_bundle,
         new_save_dir) = io.open_bundle_from_zip_xml(DBVistrail.vtType,
                                                     in_fname)
        vistrails.db.services.vistrail.merge(save_bundle, new_save_bundle, "",
                                             True, vt_save_dir, new_save_dir)
    io.save_bundle_to_zip_xml(save_bundle, out_fname)
Exemplo n.º 3
0
 def testParamexp(self):
     """test translating parameter explorations from 1.0.3 to 1.0.2"""
     from vistrails.db.services.io import open_bundle_from_zip_xml
     from vistrails.core.system import vistrails_root_directory
     import os
     (save_bundle, vt_save_dir) = open_bundle_from_zip_xml(DBVistrail.vtType, \
                     os.path.join(vistrails_root_directory(),
                     'tests/resources/paramexp-1.0.3.vt'))
     vistrail = translateVistrail(save_bundle.vistrail)
Exemplo n.º 4
0
 def testVistrailvars(self):
     """test translating vistrail variables from 1.0.3 to 1.0.2"""
     from vistrails.db.services.io import open_bundle_from_zip_xml
     from vistrails.core.system import vistrails_root_directory
     import os
     (save_bundle, vt_save_dir) = open_bundle_from_zip_xml(DBVistrail.vtType, \
                     os.path.join(vistrails_root_directory(),
                     'tests/resources/visvar-1.0.3.vt'))
     vistrail = translateVistrail(save_bundle.vistrail)
     visvars = vistrail.db_annotations_key_index['__vistrail_vars__']
     self.assertTrue(visvars.db_value)
Exemplo n.º 5
0
 def load(self, type):
     fname = self.get_temporary()
     if fname:
         from vistrails.db.domain import DBVistrail
         obj = io.open_from_xml(fname, type)
         return SaveBundle(DBVistrail.vtType, obj)
     else:
         (save_bundle, tmp_dir) = io.open_bundle_from_zip_xml(type, self._name)
         self.tmp_dir = tmp_dir
         for obj in save_bundle.get_db_objs():
             obj.locator = self
         return save_bundle
Exemplo n.º 6
0
 def load(self, type):
     fname = self.get_temporary()
     if fname:
         from vistrails.db.domain import DBVistrail
         obj = io.open_from_xml(fname, type)
         return SaveBundle(DBVistrail.vtType, obj)
     else:
         (save_bundle, tmp_dir) = io.open_bundle_from_zip_xml(type, self._name)
         self.tmp_dir = tmp_dir
         for obj in save_bundle.get_db_objs():
             obj.locator = self
         return save_bundle
Exemplo n.º 7
0
 def testVistrailvars(self):
     """test translating vistrail variables from 1.0.2 to 1.0.3"""
     from vistrails.db.services.io import open_bundle_from_zip_xml
     from vistrails.core.system import vistrails_root_directory
     import os
     (save_bundle, vt_save_dir) = open_bundle_from_zip_xml(DBVistrail.vtType, \
                     os.path.join(vistrails_root_directory(),
                     'tests/resources/visvar-1.0.2.vt'))
     vistrail = translateVistrail(save_bundle.vistrail)
     visvars = vistrail.db_vistrailVariables
     self.assertEqual(len(visvars), 2)
     self.assertNotEqual(visvars[0].db_name, visvars[1].db_name)
Exemplo n.º 8
0
 def testVistrailvars(self):
     """test translating vistrail variables from 1.0.2 to 1.0.3"""
     from vistrails.db.services.io import open_bundle_from_zip_xml
     from vistrails.core.system import vistrails_root_directory
     import os
     (save_bundle, vt_save_dir) = open_bundle_from_zip_xml(DBVistrail.vtType, \
                     os.path.join(vistrails_root_directory(),
                     'tests/resources/visvar-1.0.2.vt'))
     vistrail = translateVistrail(save_bundle.vistrail)
     visvars = vistrail.db_vistrailVariables
     self.assertEqual(len(visvars), 2)
     self.assertNotEqual(visvars[0].db_name, visvars[1].db_name)
Exemplo n.º 9
0
    def testParamexp(self):
        """test translating parameter explorations from 1.0.2 to 1.0.3"""
        from vistrails.db.services.io import open_bundle_from_zip_xml
        from vistrails.core.system import vistrails_root_directory
        import os

        (save_bundle, vt_save_dir) = open_bundle_from_zip_xml(
            DBVistrail.vtType, os.path.join(vistrails_root_directory(), "tests/resources/paramexp-1.0.2.vt")
        )
        vistrail = translateVistrail(save_bundle.vistrail)
        pes = vistrail.db_get_parameter_explorations()
        self.assertEqual(len(pes), 1)
        funs = pes[0].db_functions
        self.assertEqual(set([f.db_port_name for f in funs]), set(["SetCoefficients", "SetBackgroundWidget"]))
        parameters = funs[0].db_parameters
        self.assertEqual(len(parameters), 10)
Exemplo n.º 10
0
 def testParamexp(self):
     """test translating parameter explorations from 1.0.2 to 1.0.3"""
     from vistrails.db.services.io import open_bundle_from_zip_xml
     from vistrails.core.system import vistrails_root_directory
     import os
     (save_bundle, vt_save_dir) = open_bundle_from_zip_xml(DBVistrail.vtType, \
                     os.path.join(vistrails_root_directory(),
                     'tests/resources/paramexp-1.0.2.vt'))
     vistrail = translateVistrail(save_bundle.vistrail)
     pes = vistrail.db_get_parameter_explorations()
     self.assertEqual(len(pes), 1)
     funs = pes[0].db_functions
     self.assertEqual(set(f.db_port_name for f in funs),
                      set(['SetCoefficients', 'SetBackgroundWidget']))
     parameters = funs[0].db_parameters
     self.assertEqual(len(parameters), 10)