New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VT Bundle: Make database subsystem more robust #1092
Open
dakoop
wants to merge
105
commits into
master
Choose a base branch
from
sql-alchemy
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ove abstraction. The goal here is to improve the current SaveBundle so that it stores any object, has a manifest to make serialization more straightforward and delegates serialization of individual objects to specific, storage-specific classes. Also introduces a DirectoryBundle and DirectoryLocator to, among other things, support auto-save of full bundles. In addition, we envision a more generic bundle to be customizable so users may choose to include, for example, data or packages in the .vt format. db/services/bundle.py: - BundleObj: new class - BundleObjDictionary: new class - Bundle: new class - Serializer: new class - FileSerializer: new class - ThumbnailFileSerializer: new class - AbstractionFileSerializer: new class - XMLFileSerializer: new class - RegistryXMLSerializer: new class - LogXMLSerializer: new class - Manifest: new class - FileManifest: new class - DirectoryBundle: new class - ZIPBundle: new class - DBManifest: new class - DBBundle: new class - VistrailBundle: new class - WorkflowBundle: new class - LogBundle: new class - RegistryBundle: new class - MySQLDatabase: new class - SQLite3Database: new class - TestBundles: new class db/services/locator.py: - BaseLocator.from_url: add DirectoryLocator - DirectoryLocator: new class
Continues the previous work with changes that bundle exist independent of a locator. Then, a locator can be a parent of a locator. Also abstracts some of the database connection logic with plans to pull the caching mechanisms in DBLocator to exist independently so that the bundles can better leverage them. Also standardize the locator properties from a global dictionary so we're not doing hasattr(locator, '_vnode') checks which are ugly. vistrails/core/application.py: - VistrailsApplicationInterface.process_interactive_input: replace hasattr locator with locator properties vistrails/core/collection/vistrail.py: - VistrailEntity.create_parameter_exploration_entity: use mashupVersion instead of mashup vistrails/db/services/bundle.py: - Bundle.cleanup: new method - DBSerializer: new class - DirectoryBundle: replace locator with dir_path throughout - ZIPBundle: replace locator with file_path throughout, keep DirectoryBundle as a child obj here - ZIPBundle.load: assign bundle's objs/serializers to dir_bundle - ZIPBundle.save: assign bundle's objs/serializers to dir_bundle - DBManifest: use connection_obj instead of db_connection, pass sql through connection_obj's format_stmt method - DBBundle: implement class - DatabaseTest: new class - MySQLDatabaseTest: moved from MySQLDatabase, use db.services.db - SQLite3DatabaseTest: moved from SQLite3Database, use db.services.db - TestBundles.test_manifest_file; add underscore - TestBundles.create_bundle: add option for db serializers and pass ids in - TestBundles.load_bundle: add option for db serializers - TestBundles.compare_bundles: use str cast to make sure buffers are converted - TestBundles.test_dir_bundle: pass directory path - TestBundles.test_zip_bundle: pass directory path - TestBundles.run_manifest_db: change to use connection object - TestBundles.run_bundle_db: new test - TestBundles.test_bundle_mysql: new test - TestBundles.test_bundle_sqlite3: new test vistrails/db/services/db.py: - new module to for database-specific utilities - DBConnection: new class - MySQLDBConnection: new class - SQLite3Connection: new class vistrails/db/services/locator.py: - BaseLocator: add decorator to add properties based on KWARG_PROPS dictionary - BaseLocator.add_property: new method - BaseLocator.get_kwarg_props: new method - BaseLocator.get_special_tags: new method - BaseLocator.parse_args: use KWARG_PROPS to do this more generally - BaseLocator.generate_args: use KWARG_PROPS to do this more generally - BaseLocator.__init__: new method - BaseLocator.serialize: **removed**, unused - BaseLocator.parse: **removed**, unused - BaseLocator.from_xml: new abstract method - BaseLocator.version: new property - UntitledLocator.__init__: let base class handle properties - UntitledLocator.from_url: make class method - UntitledLocator.to_url: use self instead of static class - DirectoryLocator.__init__: let base class handle properties - DirectoryLocator.from_url: use class for parse_args - DirectoryLocator.to_url: use self instead of static class - XMLFileLocator.__init__: let base class handle properties - XMLFileLocator.from_url: make class method - XMLFileLocator.to_url: use self instead of static class - XMLFileLocator.serialize: **removed**, unused - XMLFileLocator.parse: **removed**, unused - ZIPFileLocator.from_url: make class method - ZIPFileLocator.to_url: use self instead of static class - DBLocator.__init__: let bass class handle properties - DBLocator.serialized: **removed**, unused - DBLocator.parse: **removed**, unused - DBLocator.from_url: make class method - DBLocator.to_url: use self instead of static class vistrails/gui/vistrails_window.py: - QVistrailsWindow.open_vistrail_from_locator: replace hasattr locator with locator properties
Conflicts: vistrails/db/services/locator.py
More work to create working bundle that can load vistrail. vistrails/db/services/bundle.py: - change a bunch of static methods to class methods - FileRefSerializer: new class - ThumbnailFileSerializer: implement class - AbstractionFileSerializer: implement class - XMLFileSerializer: add new helper class methods - XMLFileSerializer.load: allow inner directory, use class methods to call subclass methods - XMLFileSerializer.save: allow inner directory, use class methods to call subclass methods, factor out save_file - XMLFileSerializer.save_file: new method factored out of save for XMLAppendSerializer - VistrailXMLSerializer: implement class - MashupXMLSerializer: implement class - RegistryXMLSerialzier: implement class - XMLAppendSerializer: new class to generalize the XML append style the log uses - LogXMLSerializer: implement class - DefaultVistrailsDirBundle: new class to represent deafult vt dir bundle - NoManifestDirBundle: new class to load old-style bundles - TestBundles.test_vt_bundle: new test - TestBundles.test_old_vt_load: new test vistrails/db/versions/__init__.py: - translate_mashup: new method
Make bundle strictly a container and make Directory/ZIP/DB serializers that keep track of their own sub-serializers. vistrails/db/services/bundle.py: - Bundle: make subclass of BundleObjDictionary - BundleSerializer: new abstract class - DBDataSerializer: **renamed** from DBSerializer - DirectorySerializer: refactored from DirectoryBundle - ZIPSerializer: refactored from ZIPBundle - DBSerializer: refactored from DBBundle - DefaultVistrailsDirSerializer: refactored from DefaultVistrailsDirBundle - NoManifestDirSerializer: refactored from NoManifestDirBundle - TestBundles.create_bundle: actually creates a bundle now - TestBundles.load_bundle **removed** - TestBundles.test_*: updated to match refactoring
vistrails/db/services/bundle.py: - FileSerializer.load: don't asign bundle obj id - DBDataSerializer.load: don't assign bundle obj id - DirectorySerializer.load: use manifest to assign ids/types - DBSerializer.load: use manifest to assign ids/types - TestBundles.create_bundle: hardcode ids
vistrails/db/services/bundle.py: - DefaultVistrailsZIPSerializer: new class - NoManifestMixin: factored load_manifest from NoManifestDirSerializer - NoManifestDirSerializer.load_manifest: use mixin - NoManifestZIPSerializer: new class - TestBundles: add new tests for new serializers - TestBundles.compare_bundles: just check that the class is correct (__eq__ won't work in all cases)
vistrails/db/services/db_utils.py: - **renamed** from db.py which causes conflicts - DBConnection.format_stmt: add more subsitution options - DBConnection.run_sql_file: new method - DBConnection.setup_db_tables: new method, from db/services/io.py - MySQLDBConnection.get_current_time: new method - MySQLDBConnection.get_engine: new method - MySQLDBConnection.get_int_type: new method - SQLite3Connection.get_current_time: new method - SQLite3Connection.get_engine: new method - SQLite3Connection.get_int_type: new method vistrails/db/services/bundle.py: - XMLFileSerializer.load: remove finish_load - XMLFileSerializer.save: add finish_save - XMLFileSerializer.finish_load: **removed** - VistrailXMLSerializer.load: add finish_load code here - VistrailXMLSerializer.finish_load: **removed** - RegistryXMLSerializer.load: add finish_load code here - RegistryXMLSerializer.finish_load: **removed** - LogXMLSerializer.load: add finish_load code here - LogXMLSerializer.finish_load: **removed** - BaseDBSerializer: new class - VistrailDBSerializer: new class - DBSerializer.save: add commit - DefaultVistrailsDBSerializer: new class - TestBundles.run_vt_db_bundle: new method - TestBundles.test_vt_bundle_mysql: new test - TestBundles.test_vt_bundle_sqlite: new test
This branch attempts to migrate VisTrails's SQL capabilities to SQLAlchemy which should allow it to be more robust and support more databases. vistrails/db/bin/generate.py: - main: add support for generating SQLAlchemy table defintions vistrails/db/bin/templates/sql_alchemy.py.mako: - new file, template for the python-based schema vistrails/db/versions/v1_0_3/persistence/__init__.py: - add code to remove current dir from path so tests can be run as __main__ - DAOList.open_from_db: use the single execute for now (only MySQL support multiple statements so this should be special-cased) - DAOList.save_to_db: use single execute for now - TestPersistence: new test class - TestPersistence.run_sql_save_vistrail: new method - TestPersistence.test_save_vistrail_mysql: new test - TestPersistence.test_save_vistrail_sqlite3: new test vistrails/db/versions/v1_0_3/persistence/sql/alchemy.py: - new file, auto-generated schema for SQLAlchemy vistrails/db/versions/v1_0_3/persistence/sql/sql_dao.py: - SQLDAO: add class storage for metadata and engine - SQLDAO.convertToDB: do not convert date values, SQLAlchemy takes care of this - SQLDAO.createSQLSelect: rewrite for sqlalchemy - SQLDAO.createSQLInsert: rewrite for sqlalchemy - SQLDAO.createSQLUpdate: rewrite for sqlalchemy - SQLDAO.createSQLDelete: rewrite for sqlalchemy - SQLDAO.executeSQL: rewrite for sqlalchemy
… from mysql. A few changes: - Route everything through the open/save_many_from/to_db calls instead of having separate calls. - Translate executeSQLGroup to use sqlalchemy but drop into DBAPI to push multiple statements through - Use bind-parameters for executeSQLGroup (wasn't before which is dangerous) - A few efficiency improvements (izip, xrange), got rid of dictionaries indexed by the child object, removed multiple use of child obj as the iterkey and an identifier in subloops vistrails/db/versions/v1_0_3/persistence/__init__.py: - DAOList.open_from_db: change to call open_many_from_db - DAOList.open_many_from_db: add global_props_list, use izip, iterate directly - DAOList.save_to_db: change to call save_many_to_db - DAOList.save_many_to_db: add global_props_list, don't use dictionaries indexed by id(), use izip, don't use child for different loops vistrails/db/versions/v1_0_3/persistence/sql/sql_dao.py: - SQLDAO.executeSQLGroup: update to use sqlalchemy's compiler but then pass things off to DBAPI, switched to use bind-parameters, change loop structure - SQLDAO.executeSQLCommands: switch based on dialect, if mysql, use group, otherwise execute individually
The major change here is to utilize sqlalchemy instead of raw SQL so other types of db backends are more easily supported. Note, however, that this leaves a major issue in that the older schemas are not as easily supported. The next step is to move all of the methods that are subject to schema changes inside the db version directory. vistrails/db/bin/templates/sql_alchemy.py.mako: - add sqlalchemy py_import info vistrails/db/services/io.py: - get_db_lib: **removed** - format_prepared_statement: **removed** - open_db_connection: changed to use sqlalchemy.create_engine - test_db_connection: remove get_db_lib references - ping_db_connection: just use "SELECT 1" here - get_table: new method - get_table_by_name: new method - get_db_object_list: use sqlalchemy to rewrite - get_db_object_modification_time: use sqlalchemy to rewrite - get_db_object_version: use sqlalchemy to rewrite - get_db_version: use sqlalchemy to rewrite - get_db_id_from_name: use sqlalchemy to rewrite - get_db_abstraction_modification_time: use sqlalchemy to rewrite - get_db_ids_from_vistrail: use sqlalchemy to rewrite - get_db_ids_from_log: new method - get_matching_abstraction_id: use sqlalchemy to rewrite - setup_db_tables: use sqlalchemy to rewrite - save_vistrail_to_db: use sqlalchemy transactions, reverse order of get_saved_workflows parameters - save_workflow_to_db: use sqlalchemy transactions - get_saved_workflows: use sqlalchemy to rewrite, reverse order of params - open_vt_log_from_db: factor out get_db_ids_from_log - save_log_to_db: use sqlalchemy transactions - save_registry_to_db: use sqlalchemy transactions - save_abstraction_from_db: use sqlalchemy transactions - save_abstractions_to_db: use sqlalchemy transactions - get_thumbnail_fnames_from_db: new method, factored out of open_thumbnails_from_db, rewritten for sqlalchemy - get_thumbnail_data_from_db: new method, factored out of open_thumbnails_from_db, rewritten for sqlalchemy - get_existing_thumbnails_in_db: new method, factored out of save_thumbnails_to_db, rewritten for sqlalchemy - insert_thumbnails_into_db: new method, factored out of save_thumbnails_to_db - open_thumbnails_from_db: factor backend-specific code out - save_thumbnails_to_db: factor backend-specific code out - save_mashuptrails_to_db: use sqlalchemy transactions - get_current_time: rewritten for sqlalchemy, use current_timestamp func - TestDBIO: comment out test# tests for now - TestDBIO.setUpClass: new method - TestDBIO.tearDownClass: new method - TestDBIO.get_sqlite3_config: new method - TestDBIO.test_open_connection: new test - TestDBIO.test_save_vistrail_to_db: new test - TestDBIO.test_get_db_object_list: new test - TestDBIO.test_get_db_object_modification_time: new test - TestDBIO.test_get_db_object_version: new test - TestDBIO.test_get_db_id_from_name: new test - TestDBIO.test_get_db_abstraction_modification_time: new test - TestDBIO.test_get_db_ids_from_vistrail: new test - TestDBIO.test_get_matching_abstraction_id: new test - TestDBIO.test_get_saved_workflows: new method - __main__: add ability to run tests from command-line using vistrails.core.application.init() vistrails/db/versions/__init__.py: - get_sql_schema: new method vistrails/db/versions/v1_0_2/persistence/sql/sql_dao.py: - SQLDAO.executeSQLGroup: converters is MySQL-specific, just use it directly vistrails/db/versions/v1_0_3/persistence/sql/alchemy.py: - add sqlalchemy py_import info
…a version 1.0.4. In order to reduce the creep of schema-specific SQL commands into the single, unversioned db.services.io module, this commit moves all of that logic into v#_#_#/persistence/sql/utils.py. In addition, it moves the sqlalchemy-ification of the 1.0.3 schema to a new 1.0.4 schema; the specs are the same but because the changes to the sql serialization are significant (and now versioned), the changes warrant a new version of the schema. The idea is that the 1.0.3 and 1.0.4 specs will be kept in alignment. To facilitate this without breaking existing db.services.io calls, the run_versioned decorator determines the version of the database the calls need to be run against and calls the appropriate version's method. In addition, the sql tests for db.services.io have been structured so that the same test can be run across multiple versions of the database. scripts/update_db.py: - update_db: update db_object_list params, use separate drop/create calls to update database vistrails/core/collection/__init__.py: - Collection.update_from_database: update get_db_object_list params vistrails/core/db/io.py: - get_db_vistrail_list: update get_db_object_list params vistrails/db/bin/sql_gen_objects.py: - SQLProperty.getType: switch MEDIUMTEXT to use specific size vistrails/db: - add version 1.0.4 and make it the current version vistrails/db/services/io.py: - default_open_db_connection: new method, uses sqlalchmey to check database version, allows dialect, driver, and version keys in config dict now - get_db_version_from_db: **moved** from get_db_version - get_db_version: moved to get_db_version_from_db, changed to check for __vt_db_version__ or call *_from_db - run_versioned: new decorator - open_db_connection: call versioned method - close_db_connection: call versioned method - ping_db_connection: call versioned method - get_current_time: call versioned method, fall back to datetime.now - translate_to_tbl_name: *moved* to versions - get_table: *moved* to versions - get_table_by_name: *moved* to versions - date_to_str: *moved* to versions - get_db_object_list: changed to use db_connection, call versioned method - get_db_object_version: call versioned method - get_db_id_from_name: call versioned method - get_db_abstraction_modification_time: call versioned method - get_db_ids_from_vistrail: call versioned method - get_db_ids_from_log: call versioned method - get_matching_abstraction_id: call versioned method - setup_db_tables: **removed**, replaced with create/drop_db_tables - create_db_tables: new versioned method - drop_db_tables: new versioned method - get_saved_workflows: call versioned method - get_thumbnail_fnames_from_db: call versioned method - get_thumbnail_data_from_db: call versioned method - get_existing_thumbnails_in_db: call versioned method - insert_thumbnails_into_db: call versioned method - save_vistrail_to_db: use version utils for transactions - save_log_to_db: use version utils for transactions - TestSQLDatabase: new test base class - TestMySQLDatabase: new test base class - TestMySQLDatabase_v1_0_2: new test class - TestMySQLDatabase_v1_0_3: new test class - TestMySQLDatabase_v1_0_4: new test class - TestSQLite3Database: new test class vistrails/db/tests/setup_db_tables.py: - setup_tables: use drop/create combo in place of setup vistrails/db/versions/__init__.py: - add translations for 1.0.3 <-> 1.0.4 - get_sql_utils: new method vistrails/db/versions/v1_0_2/persistence/sql/sql_dao.py: - SQLDAO.executeSQLGroup: import MySQLdb inside method - SQLDAO.commit_transaction: add transaction parameter vistrails/db/versions/v1_0_2/persistence/sql/utils.py: - new module, encapsulates methods that were in db.services.io before alchemy rewrite - changed some interfaces from that time due to changes in db.services.io - added implementations for some new methods (e.g. create/drop_db_tables, thumbnail i/o) vistrails/db/versions/v1_0_3: - revert everything back to the old, pre-sqlalchemy style - add utils.py like in 1.0.2 vistrails/db/versions/v1_0_4: - all changes that used to be in 1.0.4 are now here (alchemy, sqldao, etc.) vistrails/db/versions/v1_0_4/persistence/sql/utils.py: - encapsulates all version-specific methods from db.services.io after alchemy rewrite vistrails/gui/open_db_window.py: - QDBConnectionList.getDBObjectList: update parameters for get_db_object_list
…use MySQLdb instead of get_db_lib(). vistrails/db/services/query.py: - get_db_lib changed to MySQLdb - note that this requires more major changes but this allows VisTrails to start
vistrails/db/services/io.py: - default_open_db_connection: raise VistrailsDBException if connection fails vistrails/db/services/locator.py: - BaseLocator.save_temporary: add empty method - BaseLocator.clean_temporaries: add empty method vistrails/db/versions/v1_0_4/persistence/sql/utils.py: - get_thumbnail_fnames_from_db: fix typo
vistrails/db/versions/v1_0_4/persistence/sql/__init__.py: - DAOList.save_many_to_db: need to track children of children written so the written list is a 2-layer list for the second run vistrails/db/versions/v1_0_4/persistence/sql/sql_dao.py: - SQLDAO.createSQLUpdate: don't put columns in insert and don't use iterator for and_
To make things easier, we embed a deep_eq_test method in the db domain objects. This test recurses on lists and referenced objects so that it checks entire objects. Whether this should be a permanent piece of the domain object or only enabled for testing should be considered, but we are including it in the standard template for now. Because certain fields or child objects may change or be added in later versions, we have an alternate_tests dictionary that allows a user to specify a different test than the standard assertEqual; None indicates that the test should be skipped. In addition, vistrails.db.services.io.TestTranslations has a get_alternate_tests method which builds the dictionary based on the versions where a workaround is required. That way, more recent versions can be more rigorous. TODO: Improve coverage. Either use more data or manufacture some data to ensure that all fields are covered. vistrails/db/bin/templates/domain.py.mako: - add deep_eq_test to facilitate easier equality testing vistrails/db/services/io.py: - TestTranslations: new class to test translations between versions - TestTranslations.get_alternate_tests: builds alternate tests based on versions where they are needed - TestTranslations.run_vistrail_translation_test: new method - TestTranslations.run_workflow_translation_test: new method - TestTranslations.run_log_translation_test: new method - TestTranslations.run_registry_translation_test: new method - TestTranslations: various tests for specific versions vistrails/db/versions/__init__.py: - version_map and rev_version_map made module-level to allow more general use - get_version_path: new method - translate_object: move version_map and rev_version_map outside method to allow more general use, remove unused path list vistrails/db/versions/v1_0_4/domain/auto_gen.py: - regenerated using the new template with the deep_eq_test method
Using the new translation tests on the sql-alchemy branch, this commit fixes a number of errors that were included in the translation code. vistrails/db/services/io.py: - save_vistrail_to_db: must translate the workflow to the current schema version of the database vistrails/db/versions/v0_9_4/translate/v0_9_5.py: - translateLog: downgrade module_execs to the old schema where there were no group_execs vistrails/db/versions/v0_9_5/domain/registry.py: - add missing imports (DBPackage, DBModuleDescriptor, DBPortSpec) vistrails/db/versions/v0_9_5/translate/v1_0_0.py: - translateLog: downgrade item_execs to the old schema (only module and group execs, not loop_execs which were introduced in 1.0.0) vistrails/db/versions/v1_0_2/translate/v1_0_3.py: - add downgrade support for new port specs (which in 1.0.3 have PortSpecItem child objects) - translateVistrail: use new downgrade port spec logic - translateWorkflow: use new downgrade port spec logic - translateRegistry: use new downgrade port spec logic vistrails/db/versions/v1_0_3/translate/v1_0_2.py: - update_portSpec: use empty strings instead of None for some of the fields, set default constructor param to the correct variable (not label!)
Fixes the issue in save_vistrail_to_db where the persisted workflows were not saved as the correct version.
This improves the translation tests to test for more entities like groups, abstractions, parameter explorations, etc. Also allows floating point values to be almost equal. vistrails/db/bin/templates/domain.py.mako: - deep_eq_test: use key for sorting objects, use assertAlmostEqual for floats vistrails/db/services/io.py: - get_alternate_tests: refactor so that this can be used in both translation and sql/xml tests, add test_group_workflow, other translation alternates - TestXMLFile: new class - TestXMLFile_v0_9_3: new test class - TestXMLFile_v1_0_2: new test class - TestSQLDatabase.get_filename: new method - TestSQLDatabase.test_save_vistrail: **moved** to test_save_bundle - TestSQLDatabase.test_save_bundle: moved from test_save_vistrail - TestSQLDatabase.test_save_vistrail_and_reload: new test - TestTranslations.get_alternate_tests: **moved** to global level - TestTranslations.get_filename: new method - run_workflow_translation_test: add different version number for test_basics test - test_v0_9_5_log: new test vistrails/db/versions/v1_0_4/domain/auto_gen.py: - regenerated with updates from domain.py.mako vistrails/tests/resources/test_basics.vt: - new test vt file
<ticket>#693</ticket> Because PortSpecItems are created as part of PortSpec construction, they were not being assigned correct ids (from the IdScope objects). This commit fixes this by spinning through the list of created PortSpecItems and assigning them ids from the corresponding IdScope. Note that this is not a big deal except for those PortSpecs that may be persisted. vistrails/core/modules/module_descriptor.py: - ModuleDescriptor.new_port_spec: **removed** - ModuleDescriptor.add_input_port: **removed** - ModuleDescriptor.add_output_port: **removed** vistrails/core/modules/module_registry.py: - ModuleRegistry.create_port_spec: set PortSpecItem ids vistrails/core/vistrail/controller.py: - VistrailController.create_port_spec_static: set PortSpecItem ids - VistrailController.add_module_port: set PortSpecItem ids vistrails/tests/utils.py: - execute: assign PortSpecItem ids
Need to reset global_props which wasn't being done in first translation from 1.0.3 version. vistrails/db/versions/v1_0_4/persistence/__init__.py: - DAOList.open_many_from_db: keep global_props for each object in a dictionary
Clean up after tests and add a flag to toggle whether workflows should be automatically materialized in the database. vistrails/db/services/io.py: - save_vistrail_bundle_to_db: add save_wfs flag - save_vistrail_to_db: add save_wfs flag - get_alternate_tests: add automatic overrides - TestXMLFile.test_save_vistrail_and_reload: close the zip dir - TestSQLDatabase.test_save_bundle: close the zip dir - TestSQLDatabase.test_save_vistrail_and_reload: close the zip dir - TestMySQLDatabase.get_db_fname: new method, only create file once - TestMySQLDatabase.get_config: use get_db_fname - TestTranslations.run_vistrail_translation_test: close the zip dir - TestTranslations.run_workflow_translation_test: close the zip dir - TestTranslations.run_log_translation_test: close the zip dir vistrails/tests/resources/test_basics.vt: - Updated version after PortSpecItem issues
Using more translation tests on the sql-alchemy branch, this commit fixes more errors in the translation code. vistrails/db/versions/v0_9_3/translate/v0_9_4.py: - update_workflow: moved from translateWorkflow - update_modules: new method - translateVistrail: add update_operations to convert new abstractions to old abstractionRef objects, add group translations - translateWorkflow: add update_modules to translate abstractions vistrails/db/versions/v0_9_4/translate/v0_9_3.py: - update_workflow: moved from translateWorkflow - update_modules: moved from translateWorkflow - translateVistrail: make sure version is written to internalVersion, add update_modules translations - translateWorkflow: factor out update_workflow, update_modules vistrails/db/versions/v0_9_4/translate/v0_9_5.py: - translateVistrail: add warnings when group/loop execs cannot be translated vistrails/db/versions/v0_9_5/translate/v1_0_0.py: - translateLog: make sure that subitems in execs are updated vistrails/db/versions/v1_0_0/translate/v0_9_5.py: - translateLog: make sure that subitems in execs are updated vistrails/db/versions/v1_0_2/translate/v1_0_3.py: - translateVistrail: rewrite things to insert vistrail variable annotations when the update of other annotations is done vistrails/db/versions/v1_0_3/translate/v1_0_2.py: - translateVistrail: find vistrail variables and parameter explorations when updating other annotations
Conflicts: vistrails/core/collection/__init__.py vistrails/core/modules/module_registry.py vistrails/db/services/io.py vistrails/db/services/locator.py vistrails/db/versions/__init__.py vistrails/db/versions/v1_0_2/persistence/sql/sql_dao.py vistrails/db/versions/v1_0_3/persistence/sql/sql_dao.py vistrails/db/versions/v1_0_3/translate/v1_0_2.py
Serializers are stateless, bundles have mappings that help organize objects so they can be identified and retrieved without other levels of the API worrying about bundle organization
Manifest seems to work
The globals in the module are also loaded separately when the module is loaded in other modules referenced by the test. They don't match so the hack is to use the "external" version of the module in the tests.
For example, want changes to controller.abstractions to be automatically propogated to bundle, avoid code in write_vistrail
This reverts commit 1fd065d.
remram44
changed the title
Make database subsystem more robust
VT Bundle: Make database subsystem more robust
Oct 5, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Use SQLAlchemy to allow integration with different database backends and improve robustness of database storage. This includes updates to the bundle structure (#962).
The bundle structure is designed to be more customizable. Specifically, we have the following core classes:
Bundle
: stores content asBundleObj
objects and mappings in a dictionary ofBundleObjMapping
; a bundle is typed according to its root objectBundleObj
: wraps a VisTrails object with type and identifier fieldsBundleObjMapping
: defines howBundleObj
s of a specific type are organized in aBundle
; e.g., is there a single object in the bundle or can there be many. If there are many, how are they identified?BundleSerializer
: defines how aBundle
is serialized to a specific backend; contains individualSerializer
objects that define serializations for individualBundleObj
typesNote that the separation between bundle organization and serialization is intentional. We want to be able to access a bundle's objects independently of how they are stored. We also want to be able to store a bundle via any serialization; one might take a .vt file and save it to a sqlite database.
The bundles are versioned. Thus, if someone opens a v2.0 bundle, it can be parsed correctly even if the v2.1 bundle structure restructures content. In practice, this requires the version to define default bundle structures and mappings as well as default bundle serialization methods. See the 1.0.5
persistence/__init__.py
source for how this works. However, the structures should also allow users to define their own bundle types (for example, to include data files or package definitions) and register the corresponding mappings and serializations.The point of the
BundleObjMapping
is to define the mapping from in-memory raw object to aBundleObj
. Specifically, what are the obj_type and obj_id mapped from. File reference mappings are not good mappings because they are tied to a specific serialization; this is something the serializer needs to interpret. Thus, the goals of individual mappings are to set up methods to extract/sync ids and types from objects and manage the access to collections of objects with the same type.TODOs