Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
44 changes: 44 additions & 0 deletions src/query/tiledb_soma_healthcheck/config.vsh.yaml
Original file line number Diff line number Diff line change
@@ -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]
35 changes: 35 additions & 0 deletions src/query/tiledb_soma_healthcheck/script.py
Original file line number Diff line number Diff line change
@@ -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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can a logger statement be added with some information in case the health check is unsuccesful?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could; what extra information are you looking for? Mostly tiledbsoma already adds information in the error message.



if __name__ == "__main__":
main(par)
25 changes: 25 additions & 0 deletions src/query/tiledb_soma_healthcheck/test.py
Original file line number Diff line number Diff line change
@@ -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__]))
Loading