Esempio n. 1
0
    def test_remove_group(self):
        ctx = tiledb.Ctx()

        tiledb.remove(ctx, self.group3)

        self.assertFalse(self.is_group(ctx, self.group3))
        self.assertFalse(self.is_group(ctx, self.group4))
Esempio n. 2
0
 def _clear_arrays(self) -> None:
     """Clear out local stat values"""
     try:
         tiledb.ls(self.__tiledb_group_name,
                   lambda tdb_obj, tdb_type: tiledb.remove(tdb_obj))
     except TileDBError:
         self._logger.debug("No TileDB group to clear out.")
Esempio n. 3
0
    def inject_config(self, env_config: ConfigEnvironment) -> None:
        super(DefaultScenario, self).inject_config(env_config)
        # Initialize TileDB storage needed for the scenario specific data
        exp_tmp_dir = self._env_config.temp_dir(
            experiment_id=self.experiment_id)
        if self._env_config is not None and exp_tmp_dir is not None:
            abs_path = pathlib.Path(exp_tmp_dir).resolve().joinpath(
                'def_tdb_arrays')
            self.__tiledb_group_name = abs_path.as_uri()
            self.__tiledb_stats_array = abs_path.joinpath('stats').as_uri()
        # Create the tileDB group of arrays used by this scenario
        tdb_gtype = tiledb.object_type(self.__tiledb_group_name)
        if tdb_gtype is None:  # Group does not exist
            tiledb.group_create(self.__tiledb_group_name)
        elif tdb_gtype == 'array':  # Exist but an array
            tiledb.remove(self.__tiledb_group_name)  # Remove the array
            tiledb.group_create(
                self.__tiledb_group_name)  # Create a group instead
        self._clear_arrays()

        self._mdde_result_folder_root = env_config.result_dir(self,
                                                              get_root=True)
Esempio n. 4
0
def clean_arrays(array_name, namespace, bucket):
    """
    Remove the given array_name from the S3 Bucket located at bucket and TileDB
    Cloud located at namespace. This is a set up and teardown function that runs
    for all unit tests. This runs at the beginning of all tests, prior to
    calling the UDF, to ensure that the array does not exist prior to writing.
    It also runs at  end of all tests, regardless or passing, failing, or
    prematurely erroring out, to remove the array.
    """
    tiledb_uri = "tiledb://{}/{}.tdb".format(namespace, array_name)
    s3_uri = "s3://{}/{}.tdb".format(bucket, array_name)

    yield

    # Supressing errors is a temporary solution to delays between writing (or in
    # this case, deleting) and reading arrays on S3.

    with suppress(Exception):
        tiledb.cloud.deregister_array(tiledb_uri)

    with suppress(Exception):
        tiledb.remove(s3_uri)
Esempio n. 5
0
def main():
    ctx = tiledb.Ctx()

    # Delete
    tiledb.remove(ctx, "my_group")
    tiledb.remove(ctx, "my_dense_array")
    try:
        tiledb.remove(ctx, "invalid_path")
    except tiledb.TileDBError:
        print("Failed to delete invalid path")
Esempio n. 6
0
 def remove(self, arrayID):
     tile_array_id = os.path.join(self.root, arrayID)
     tiledb.remove(self.ctx, tile_array_id)