diff --git a/CHANGELOG.md b/CHANGELOG.md index ffd173a3ebf..29f36d70f58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,8 @@ Warning: These experimental features are subject to change in future releases. * Added `annotate/singler`: Cell type annotation using SingleR (PR #1051). +* Added `tiledb_soma_healthcheck` component (PR #1055). + * Added `tiledb/move_mudata_obsm_to_tiledb` (PR #1065). ## MAJOR CHANGES diff --git a/src/query/tiledb_soma_healthcheck/config.vsh.yaml b/src/query/tiledb_soma_healthcheck/config.vsh.yaml new file mode 100644 index 00000000000..8541b50372e --- /dev/null +++ b/src/query/tiledb_soma_healthcheck/config.vsh.yaml @@ -0,0 +1,44 @@ +name: tiledb_healthcheck +namespace: query +scope: "public" +description: | + Checks if a provided location can be queried as a TileDB-SOMA database. +authors: + - __merge__: /src/authors/dries_schaumont.yaml + roles: [ author, maintainer ] +argument_groups: + - name: Input database + description: "Open a TileDB SOMA database by URI." + arguments: + - name: "--input_uri" + type: string + description: "If specified, a URI containing the TileDB-SOMA objects." + required: true + example: "s3://bucket/path" + - name: "--s3_region" + description: | + Region where the TileDB-SOMA database is hosted. + type: string + required: true +resources: + - type: python_script + path: script.py + - path: /src/utils/setup_logger.py +test_resources: + - type: python_script + path: test.py +engines: + - type: docker + image: python:3.12 + setup: + - type: python + packages: + - tiledbsoma + test_setup: + - type: python + __merge__: [ /src/base/requirements/viashpy.yaml, .] +runners: + - type: executable + - type: nextflow + directives: + label: [highmem, midcpu] \ No newline at end of file diff --git a/src/query/tiledb_soma_healthcheck/script.py b/src/query/tiledb_soma_healthcheck/script.py new file mode 100644 index 00000000000..871099ee1c6 --- /dev/null +++ b/src/query/tiledb_soma_healthcheck/script.py @@ -0,0 +1,35 @@ +import sys +import tiledbsoma + +## VIASH START +par = { + "input_uri": "s3://cellxgene-census-public-us-west-2/cell-census/2025-01-30/soma/", + "s3_region": "us-west-2", +} +meta = {"resources_dir": "src/utils"} +## VIASH END + +sys.path.append(meta["resources_dir"]) +from setup_logger import setup_logger + +logger = setup_logger() + + +def main(par): + logger.info("Component started") + + tiledb_config = { + "vfs.s3.no_sign_request": "false", + "vfs.s3.region": par["s3_region"], + } + context = tiledbsoma.SOMATileDBContext(tiledb_config=tiledb_config) + logger.info( + "Trying to access '%s' in region '%s'", par["input_uri"], par["s3_region"] + ) + with tiledbsoma.open(par["input_uri"], "w", context=context) as _: + logger.info("Connection successful!") + logger.info("Component finished") + + +if __name__ == "__main__": + main(par) diff --git a/src/query/tiledb_soma_healthcheck/test.py b/src/query/tiledb_soma_healthcheck/test.py new file mode 100644 index 00000000000..a8f72b7438c --- /dev/null +++ b/src/query/tiledb_soma_healthcheck/test.py @@ -0,0 +1,25 @@ +import sys +import pytest + +## VIASH START +meta = { + "resources_dir": "./resources_test/", + "executable": "./target/executable/query/tiledb_hea", + "config": "/home/di/code/openpipeline/src/query/cellxgene_census/config.vsh.yaml", +} +## VIASH END + + +def test_healthcheck(run_component): + run_component( + [ + "--input_uri", + "s3://cellxgene-census-public-us-west-2/cell-census/2025-01-30/soma/", + "--s3_region", + "us-west-2", + ] + ) + + +if __name__ == "__main__": + sys.exit(pytest.main([__file__]))