def __init__(self, base_directory, envs): """Initialize the base directory and the dictionary of workflow execution environments. The base directory is created if it does not exist. Viztrail information is maintained in subfolders of the base directory. For each viztrail one subfolder is created. There shold be no other folders in the base directory other than those containing information about a viztrail. Parameters --------- base_directory : string Path to base directory envs : dict(string: vizier.config.ExecEnv) Dictionary of supported execution environments """ super(FileSystemViztrailRepository, self).__init__(build_info('FileSystemViztrailRepository')) self.base_dir = os.path.abspath(base_directory) # Create base directory if it doesn't exist if not os.path.isdir(self.base_dir): os.makedirs(self.base_dir) # Set list of workflow execution environments self.envs = envs # Read information about all available viztrails into an internal cache. # The cache is a dictionary of viztrail handles (keyes by their # identifier). Assumes that every directory in the base dir represents # a viztrail self.cache = dict() for filename in os.listdir(self.base_dir): fs_dir = os.path.join(self.base_dir, filename) if os.path.isdir(fs_dir): viztrail = FileSystemViztrailHandle.from_file( fs_dir, self.envs) self.cache[viztrail.identifier] = viztrail
def __init__(self, datastores): """Initialize the collection of federated data stores. Parameters --------- datastores : list(vizier.datastore.base.DataStore) List of federated data store instances """ super(FederatedDataStore, self).__init__(build_info('FederatedDataStore')) self.datastores = datastores
def __init__(self, datastore): """Initialize the build information and data store dictionary. Parameters ---------- datastore: vizier.datastore.base.DataStore Existing data store containing the database state. """ super(VolatileDataStore, self).__init__(build_info('VolatileDataStore')) self.datastore = datastore self.mem_store = InMemDataStore() self.deleted_datasets = set()
def __init__(self, base_dir): """Initialize the base directory that contains datasets. Each dataset is maintained in a separate sub-folder. Parameters --------- base_dir : string base directory for the data store """ super(FileSystemDataStore, self).__init__(build_info('FileSystemDataStore')) self.base_dir = os.path.abspath(base_dir) if not os.path.isdir(self.base_dir): os.makedirs(self.base_dir)
def __init__(self, datastore, fileserver): """Initialize the Mimir datastore that is used to retrieve and update datasets and the file server managing CSV files. Parameters ---------- datastore: vizier.datastore.mimir.MimirDataStore Datastore to retireve and update datasets. fileserver: vizier.filestore.base.FileSever File server to access uploaded CSV files """ super(MimirVizualEngine, self).__init__(datastore, fileserver, build=build_info('MimirVizualEngine'))
def __init__(self, datastore, fileserver, build=None): """Initialize the datastore that is used to retrieve and update datasets and the file server managing CSV files. Parameters ---------- datastore : vizier.datastore.base.DataStore Datastore to retireve and update datasets. fileserver: vizier.filestore.base.FileSever File server to access uploaded CSV files """ if build is None: build = build_info('DefaultVizualEngine') super(DefaultVizualEngine, self).__init__(build) self.datastore = datastore self.fileserver = fileserver
def __init__(self, base_directory): """Initialize the base directory that is used for file storage. The actual files are kept in a sub-folder (named 'files'). The base directory and sub-folder will be created if they do not exist. Parameters --------- base_directory : string Path to the base directory. """ super(DefaultFileServer, self).__init__(build_info('DefaultFileServer')) if not os.path.isdir(base_directory): os.makedirs(base_directory) self.base_directory = base_directory self.index_file = os.path.join(self.base_directory, 'index.yaml') self.file_directory = os.path.join(base_directory, 'files') if not os.path.isdir(self.file_directory): os.makedirs(self.file_directory) self.files = self.read_index()
def __init__(self, base_dir): """Initialize the base directory that contains the dataset index and metadata files. Parameters ---------- base_dir: string Name of the directory where metadata is stored """ super(MimirDataStore, self).__init__(build_info('MimirDataStore')) self.bad_col_names = { "ABORT": "`ABORT`", "ACTION": "`ACTION`", "ADD": "`ADD`", "AFTER": "`AFTER`", "ALL": "`ALL`", "ALTER": "`ALTER`", "ANALYZE": "`ANALYZE`", "AND": "`AND`", "AS": "`AS`", "ASC": "`ASC`", "ATTACH": "`ATTACH`", "AUTOINCREMENT": "`AUTOINCREMENT`", "BEFORE": "`BEFORE`", "BEGIN": "`BEGIN`", "BETWEEN": "`BETWEEN`", "BY": "`BY`", "CASCADE": "`CASCADE`", "CASE": "`CASE`", "CAST": "`CAST`", "CHECK": "`CHECK`", "COLLATE": "`COLLATE`", "COLUMN": "`COLUMN`", "COMMIT": "`COMMIT`", "CONFLICT": "`CONFLICT`", "CONSTRAINT": "`CONSTRAINT`", "CREATE": "`CREATE`", "CROSS": "`CROSS`", "CURRENT": "`CURRENT`", "CURRENT_DATE": "`CURRENT_DATE`", "CURRENT_TIME": "`CURRENT_TIME`", "CURRENT_TIMESTAMP": "`CURRENT_TIMESTAMP`", "DATABASE": "`DATABASE`", "DEFAULT": "`DEFAULT`", "DEFERRABLE": "`DEFERRABLE`", "DEFERRED": "`DEFERRED`", "DELETE": "`DELETE`", "DESC": "`DESC`", "DETACH": "`DETACH`", "DISTINCT": "`DISTINCT`", "DO": "`DO`", "DROP": "`DROP`", "EACH": "`EACH`", "ELSE": "`ELSE`", "END": "`END`", "ESCAPE": "`ESCAPE`", "EXCEPT": "`EXCEPT`", "EXCLUSIVE": "`EXCLUSIVE`", "EXISTS": "`EXISTS`", "EXPLAIN": "`EXPLAIN`", "FAIL": "`FAIL`", "FILTER": "`FILTER`", "FOLLOWING": "`FOLLOWING`", "FOR": "`FOR`", "FOREIGN": "`FOREIGN`", "FROM": "`FROM`", "FULL": "`FULL`", "GLOB": "`GLOB`", "GROUP": "`GROUP`", "HAVING": "`HAVING`", "IF": "`IF`", "IGNORE": "`IGNORE`", "IMMEDIATE": "`IMMEDIATE`", "IN": "`IN`", "INDEX": "`INDEX`", "INDEXED": "`INDEXED`", "INITIALLY": "`INITIALLY`", "INNER": "`INNER`", "INSERT": "`INSERT`", "INSTEAD": "`INSTEAD`", "INTERSECT": "`INTERSECT`", "INTO": "`INTO`", "IS": "`IS`", "ISNULL": "`ISNULL`", "JOIN": "`JOIN`", "KEY": "`KEY`", "LEFT": "`LEFT`", "LIKE": "`LIKE`", "LIMIT": "`LIMIT`", "MATCH": "`MATCH`", "NATURAL": "`NATURAL`", "NO": "`NO`", "NOT": "`NOT`", "NOTHING": "`NOTHING`", "NOTNULL": "`NOTNULL`", "NULL": "`NULL`", "OF": "`OF`", "OFFSET": "`OFFSET`", "ON": "`ON`", "OR": "`OR`", "ORDER": "`ORDER`", "OUTER": "`OUTER`", "OVER": "`OVER`", "PARTITION": "`PARTITION`", "PLAN": "`PLAN`", "PRAGMA": "`PRAGMA`", "PRECEDING": "`PRECEDING`", "PRIMARY": "`PRIMARY`", "QUERY": "`QUERY`", "RAISE": "`RAISE`", "RANGE": "`RANGE`", "RECURSIVE": "`RECURSIVE`", "REFERENCES": "`REFERENCES`", "REGEXP": "`REGEXP`", "REINDEX": "`REINDEX`", "RELEASE": "`RELEASE`", "RENAME": "`RENAME`", "REPLACE": "`REPLACE`", "RESTRICT": "`RESTRICT`", "RIGHT": "`RIGHT`", "ROLLBACK": "`ROLLBACK`", "ROW": "`ROW`", "ROWS": "`ROWS`", "SAVEPOINT": "`SAVEPOINT`", "SELECT": "`SELECT`", "SET": "`SET`", "TABLE": "`TABLE`", "TEMP": "`TEMP`", "TEMPORARY": "`TEMPORARY`", "THEN": "`THEN`", "TO": "`TO`", "TRANSACTION": "`TRANSACTION`", "TRIGGER": "`TRIGGER`", "UNBOUNDED": "`UNBOUNDED`", "UNION": "`UNION`", "UNIQUE": "`UNIQUE`", "UPDATE": "`UPDATE`", "USING": "`USING`", "VACUUM": "`VACUUM`", "VALUES": "`VALUES`", "VIEW": "`VIEW`", "VIRTUAL": "`VIRTUAL`", "WHEN": "`WHEN`", "WHERE": "`WHERE`", "WINDOW": "`WINDOW`", "WITH": "`WITH`", "WITHOUT": "`WITHOUT`" } self.base_dir = os.path.abspath(base_dir) if not os.path.isdir(self.base_dir): os.makedirs(self.base_dir)
def __init__(self): """Initialize the build information and data store dictionary.""" super(InMemDataStore, self).__init__(build_info('InMemDataStore')) self.datasets = dict()