bamboost.core.remote
Remote Access Module for Bamboost
This module provides the Remote class and related classes to facilitate access to remote
collections and simulations in the Bamboost framework.
Typical usage involves creating a Remote instance pointing to a remote server, listing available collections, and synchronizing data as needed.
Attributes
- log=
BAMBOOST_LOGGER.getChild(__name__)
Functions
(func) -> Callable[_P, None]Decorator to await, capture and print the output of a subprocess.Popen object.
Arguments:
- func:
typing.Callable[_P, subprocess.subprocess.Popen]
Classes
Remote
(self, remote_url, comm=None, *, workspace_path=None, workspace_name=None, skip_fetch=False)Represents a remote index/database for accessing and synchronizing collections and simulations.
The Remote class manages connections to a remote server, handles local caching of remote data, and provides methods for synchronizing databases and collections using rsync. It supports workspace management and can list available remote databases in the local cache.
Arguments:
- remote_url:
str - workspace_path:
typing.Optional[str]=None - workspace_name:
typing.Optional[str]=None - skip_fetch:
bool=False
Attributes:
- DATABASE_BASE_NAME:
str='bamboost.sqlite'The base name of the database file.
- DATABASE_REMOTE_PATH:
pathlib.Path=Path(_config._LOCAL_DIR).joinpath(constants.DEFAULT_DATABASE_FILE_NAME)Default path to the remote database.
- WORKSPACE_SPLITTER:
str='_WS_'String used to split remote URL and workspace name.
- _remote_url:
str=bamboost.core.remote.Remote(remote_url)The SSH URL of the remote server.
- id:
str=f'{bamboost.core.remote.Remote(remote_url)}{bamboost.core.remote.Remote(self).bamboost.core.remote.Remote(self).WORKSPACE_SPLITTER}{bamboost.core.remote.Remote(workspace_name)}' if bamboost.core.remote.Remote(workspace_name) else bamboost.core.remote.Remote(remote_url)Unique identifier for the remote instance.
- _local_path:
pathlib.Path=Path(cache_dir).joinpath(self.id)Local cache path for the remote data.
- _workspace_path:
typing.Optional[str]=bamboost.core.remote.Remote(workspace_path)Path to the workspace on the remote server.
- _workspace_name:
typing.Optional[str]=bamboost.core.remote.Remote(workspace_name)Name of the workspace.
- _remote_database_path:
pathlib.Path=bamboost.core.remote.Remote(self).bamboost.core.remote.Remote(self).DATABASE_REMOTE_PATHPath to the remote database file.
- _local_database_path:
pathlib.Path=cache_dir.joinpath(f'{self.id}.sqlite')Path to the local cached database file.
Set of search paths for collections.
- _url:
str=f'sqlite:///{bamboost.core.remote.Remote(self).bamboost.core.remote.Remote(self)._local_database_path}'SQLAlchemy database URL for the local cache.
- _engine=
create_engine(self._url, json_serializer=json_serializer, json_deserializer=json_deserializer)SQLAlchemy engine instance.
- _sm=
sessionmaker(bind=(self._engine), autobegin=False, expire_on_commit=False)SQLAlchemy sessionmaker.
- _s=
self._sm()SQLAlchemy session.
Bases
Index._commIndex.defaultIndex._fileIndex._isolatedIndex._initialize_root_process()Index.sql_transaction()Index.scan_for_collections()Index.check_integrity()Index._get_collection_record()Index._find_collection_uid_by_alias()Index.resolve_path()Index.resolve_uid()Index.sync_collection()Index.all_collectionsIndex.collection()Index.all_simulationsIndex.simulation()Index.all_parametersIndex._drop_collection()Index._drop_simulation()Index.upsert_collection()Index.upsert_simulation()Index.update_simulation_metadata()Index.update_simulation_parameters()Index._get_collection_path()Index._get_collections()Index._get_simulation()
(self, key) -> RemoteCollectionArguments:
- key:
str
(self) -> str(self) -> subprocess.PopenFetch the remote SQL database.
(self, source, dest) -> subprocess.PopenSynchronize data from the remote server to the local cache using rsync.
Arguments:
Returns
subprocess.subprocess.Popensubprocess.Popen: The Popen object for the rsync process.(cls) -> list[Remote]List all remote databases in the cache.
Arguments:
- cls
(self, collection_uid) -> PathArguments:
- collection_uid:
str
(cls, id) -> RemoteArguments:
- cls
- id:
str
(self) -> list[str]RemoteCollection
(self, uid, remote)Arguments:
- uid:
str - remote:
Remote
Attributes:
- uid=
CollectionUID(uid) - _index=
bamboost.core.remote.RemoteCollection(remote) - path=
remote._local_path.joinpath(uid) - remote_path=
cast(Path, remote._get_collection_path(self.uid)) - df:
pandas.DataFrame
Bases
Collection.fromUIDCollection._commCollection._filterCollection._sorterCollection.kCollection.__len__()Collection.__iter__()Collection._ipython_key_completions_()Collection._recordCollection.metadataCollection.filter()Collection.sort()Collection.all_simulation_names()Collection.sync_cache()Collection.add()Collection.create_simulation()Collection.delete()Collection.find()Collection._list_duplicates()Collection._check_duplicate()
(self, name_or_idx) -> RemoteSimulationArguments:
- name_or_idx:
str | int
(self) -> list[str](self, name=None) -> SelfTransfer data using rsync. Wait for the process to finish and return self.
Arguments:
- name:
typing.Optional[str]=NoneThe simulation name of the simulation to be transferred. If None, all simulations are synced.
(self) -> strRemoteSimulation
(self, name, parent, collection_uid, index, comm=None, **kwargs)Arguments:
- name:
str - parent:
StrPath - collection_uid:
CollectionUID - index:
Remote - kwargs=
{}
Attributes:
- name:
str=bamboost.core.remote.RemoteSimulation(name) - path:
pathlib.Path=index.get_local_path(collection_uid).joinpath(name) - remote_path:
pathlib.Path=index._get_collection_path(collection_uid).joinpath(name) - collection_uid=
bamboost.core.remote.RemoteSimulation(collection_uid) - _data_file:
pathlib.Path=self.path.joinpath(constants.HDF_DATA_FILE_NAME) - _xdmf_file:
pathlib.Path=self.path.joinpath(constants.XDMF_FILE_NAME) - _bash_file:
pathlib.Path=self.path.joinpath(constants.RUN_FILE_NAME) - uid:
str - parameters:
dict - metadata:
dict
Bases
_Simulation.mutable_Simulation._psize_Simulation._prank_Simulation._ranks_Simulation.__eq__()_Simulation._repr_html_()_Simulation.root_Simulation._orm_Simulation.from_uid()_Simulation.edit()_Simulation.update_database()_Simulation.status_Simulation.created_at_Simulation.description_Simulation.links_Simulation.files_Simulation.git_Simulation.data_Simulation.meshes_Simulation.mesh_Simulation.open_in_paraview()_Simulation.enter_path()_Simulation.require_series()_Simulation.create_xdmf()
(self) -> SelfSync the simulation data with the remote server.
Bamboost