Public Member Functions | |
| __init__ (self, ApdbCassandra apdb) | |
| Iterable[DatabaseInfo] | list_databases (cls, str host) |
| None | delete_database (cls, str host, str keyspace, *, int timeout=3600) |
| Partitioner | partitioner (self) |
| int | apdb_part (self, float ra, float dec) |
| int | apdb_time_part (self, float midpointMjdTai) |
| None | delete_records (self, Iterable[DiaObjectLocator] objects, Iterable[DiaSourceLocator] sources, Iterable[DiaForcedSourceLocator] forced_sources) |
| ApdbCassandraTimePartitionRange | time_partitions (self) |
| list[int] | extend_time_partitions (self, astropy.time.Time time, bool forward=True, astropy.time.TimeDelta|None max_delta=None) |
| list[int] | delete_time_partitions (self, astropy.time.Time time, bool after=False, *, ConfirmDeletePartitions|None confirm=None) |
Protected Member Functions | |
| Timer | _timer (self, str name, *, Mapping[str, str|int]|None tags=None) |
| list[int] | _partitions_to_add (self, astropy.time.Time time, bool forward, astropy.time.TimeDelta max_delta) |
| list[int] | _partitions_to_delete (self, astropy.time.Time time, bool after=False) |
Protected Attributes | |
| _apdb = apdb | |
Implementation of `ApdbAdmin` for Cassandra backend.
Parameters
----------
apdb : `ApdbCassandra`
APDB implementation.
|
protected |
Make the list of time partitions to add to current range.
|
protected |
Make the list of time partitions to delete.
|
protected |
Create `Timer` instance given its name.
| int lsst.dax.apdb.cassandra.apdbCassandraAdmin.ApdbCassandraAdmin.apdb_part | ( | self, | |
| float | ra_deg, | ||
| float | dec_deg ) |
Return spatial partition index for given coordinates.
Parameters
----------
ra_deg, dec_deg : `float`
Spatial coordinates, in degrees.
Returns
-------
index : `int`
Spatial partition index.
Reimplemented from lsst.dax.apdb.apdbAdmin.ApdbAdmin.
| int lsst.dax.apdb.cassandra.apdbCassandraAdmin.ApdbCassandraAdmin.apdb_time_part | ( | self, | |
| float | midpointMjdTai ) |
Return temporal partition index for given time.
Parameters
----------
midpointMjdTai : `float`
Time in MJD.
Returns
-------
index : `int`
Temporal partition index.
Reimplemented from lsst.dax.apdb.apdbAdmin.ApdbAdmin.
| None lsst.dax.apdb.cassandra.apdbCassandraAdmin.ApdbCassandraAdmin.delete_database | ( | cls, | |
| str | host, | ||
| str | keyspace, | ||
| * | , | ||
| int | timeout = 3600 ) |
Delete APDB database by dropping its keyspace.
Parameters
----------
host : `str`
Name of one of the hosts in Cassandra cluster.
keyspace : `str`
Name of keyspace to delete.
timeout : `int`, optional
Timeout for delete operation in seconds. Dropping a large keyspace
can be a long operation, but this default value of one hour should
be sufficient for most or all cases.
| None lsst.dax.apdb.cassandra.apdbCassandraAdmin.ApdbCassandraAdmin.delete_records | ( | self, | |
| Iterable[DiaObjectLocator] | objects, | ||
| Iterable[DiaSourceLocator] | sources, | ||
| Iterable[DiaForcedSourceLocator] | forced_sources ) |
Remove DiaObjects and all their associated DiaSources and
DiaForcedSources from database.
Parameters
----------
objects : `~collections.abc.Iterable` [`DiaObjectLocator`]
Locators for DiaObject records to remove.
sources : `~collections.abc.Iterable` [`DiaSourceLocator`]
Locators for DiaSource records to remove.
forced_sources : `~collections.abc.Iterable` [`DiaSourceLocator`]
Locators for DiaForcedSource records to remove.
Notes
-----
The list of sources has to include all sources associated with objects
in ``objects`` list. Sources that are not associated with any object
from ``objects`` are not removed.
Reimplemented from lsst.dax.apdb.apdbAdmin.ApdbAdmin.
| list[int] lsst.dax.apdb.cassandra.apdbCassandraAdmin.ApdbCassandraAdmin.delete_time_partitions | ( | self, | |
| astropy.time.Time | time, | ||
| bool | after = False, | ||
| * | , | ||
| ConfirmDeletePartitions | None | confirm = None ) |
Delete time-partitioned tables before or after specified time.
Parameters
----------
time : `astropy.time.Time`
Time before or after which to remove partitions. Partition that
includes this time is not deleted.
after : `bool`, optional
If `True` then delete partitions after the specified time. Default
is to delete partitions before this time.
confirm : `~collections.abc.Callable`, optional
A callable that will be called to confirm deletion of the
partitions. The callable needs to accept three keyword arguments:
- `partitions` - a list of partition numbers to be deleted,
- `tables` - a list of table names to be deleted,
- `partitioner` - a `Partitioner` instance.
Partitions are deleted only if callable returns `True`.
Returns
-------
partitions : `list` [`int`]
List of partitons deleted from the database, empty list returned if
nothing is deleted.
Raises
------
TypeError
Raised if APDB instance does not use time-partition tables.
ValueError
Raised if requested to delete all partitions.
| list[int] lsst.dax.apdb.cassandra.apdbCassandraAdmin.ApdbCassandraAdmin.extend_time_partitions | ( | self, | |
| astropy.time.Time | time, | ||
| bool | forward = True, | ||
| astropy.time.TimeDelta | None | max_delta = None ) |
Extend set of time-partitioned tables to include specified time.
Parameters
----------
time : `astropy.time.Time`
Time to which to extend partitions.
forward : `bool`, optional
If `True` then extend partitions into the future, time should be
later than the end time of the last existing partition. If `False`
then extend partitions into the past, time should be earlier than
the start time of the first existing partition.
max_delta : `astropy.time.TimeDelta`, optional
Maximum possible extension of the aprtitions, default is 365 days.
Returns
-------
partitions : `list` [`int`]
List of partitons added to the database, empty list returned if
``time`` is already in the existing partition range.
Raises
------
TypeError
Raised if APDB instance does not use time-partition tables.
ValueError
Raised if extension request exceeds time limit of ``max_delta``.
| Iterable[DatabaseInfo] lsst.dax.apdb.cassandra.apdbCassandraAdmin.ApdbCassandraAdmin.list_databases | ( | cls, | |
| str | host ) |
Return the list of keyspaces with APDB databases.
Parameters
----------
host : `str`
Name of one of the hosts in Cassandra cluster.
Returns
-------
databases : `~collections.abc.Iterable` [`DatabaseInfo`]
Information about databases that contain APDB instance.
| Partitioner lsst.dax.apdb.cassandra.apdbCassandraAdmin.ApdbCassandraAdmin.partitioner | ( | self | ) |
Partitoner used by this APDB instance (`Partitioner`).
| ApdbCassandraTimePartitionRange lsst.dax.apdb.cassandra.apdbCassandraAdmin.ApdbCassandraAdmin.time_partitions | ( | self | ) |
Return range of existing time partitions.
Returns
-------
range : `ApdbCassandraTimePartitionRange`
Time partition range.
Raises
------
TypeError
Raised if APDB instance does not use time-partition tables.