-
Notifications
You must be signed in to change notification settings - Fork 61
ConsoleNotes
Marmaduke Woodman edited this page Apr 30, 2014
·
4 revisions
Disclaimer: this is not yet formally to be considered documentation but rather notes on how to use the framework from the console, to implement a scientific user's day to day work. Feel free to contribute.
Datatypes are the "nouns" of TVB and adapters are the "verbs".
TVB will keep data organized in its database, and by created operations, you ask TVB to apply adapters to datatypes to perform analysis, import data, ec.
TVB has various backend services to execute these operations locally or remotely depending on the configuration.
For a scientist, it is necessary to write datatypes to represent data, adapters to import or create data, analyze it, visualize it and possibly export it.
- nibabel and cff importers are good source to read on how to create adapters importing data
- in order to use the database, it's first necessary to
from tvb.core.traits import db_events
and calldb_events.attach_db_events()
, which will initialize the SA engine (presumably according to configuration) - it is possible to configure settings from console (thus automatically) by importing the setting service, extracting the default settings, saving those settings (and modifying where necessary)
- library profile has no storage, console profile does
- in order to start using framework from e.g. a script or ipython, must correctly set the profile settings then init db events, then start your work.
- translating TVB (WUI) would involve adding translation to Genshi templates
- before using hdf5 storage, the datatype's storage path must be set, but this is usually done by the framework if invoking an operation through the flow service
- very useful: example of upload adapter & independent launcher
- it can be useful to dig into exception handling in operation service to get the call stack which are sometimes eaten by that service
- OS errors containing accents e.g. "ça alors" can generate the baffling SA OperationException "You must not use 8-bit bytestrings..."
- logging can be configured in tvb/config/logger/*logger_config.config; when using DEV profile, dev_logger_config.conf is used, otherwise logger_config.conf. Use this to, for example, print logging statements immediately in the console
- no direct link between datatype and project exists, only operations belon to project
- so for data to appear in a proj, must have an associated op
- links can be added to shared data between multiple projects
- methods can be added to dao to accomodate other functionality
- dao.get_generic_entity returns a DataType instance, but you want get_datatype_by_gid to get the actual class instance, but make sure you don't forget to call attach_db_events() first
- persisting data to DB which depends on another data that you are going to create first and persist first, you need a sleight of hand:
self._capture_operation_results([first_obj], uid="my first obj")
, then you can retrieve this entity withdao.get_last_data_with_uid(uid="my first obj", ClassOfObj)
(though this seems ambiguous? why can't just use object I already have?) - to set up longer workflows composed of multiple adapters with dependencies, it may be interesting to create a console service
- to create a new backend executor, e.g. over SSH, look at those already implemented in tvb.core.services.backend_client This could be useful to reuse IPython's parallel services
- adapters are algorithms, organized into groups, specific to modules, classified into algorithm categories. operations and operation groups track the use of the algorithm with extra metadata