Skip to content

Commit

Permalink
[python] devtools/outgestor stats and neaten (#2770)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl committed Jul 3, 2024
1 parent ccc4487 commit a92884e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions apis/python/devtools/outgestor
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def main():
parser.add_argument(
"-d", "--debug", help="increase output verbosity", action="store_true"
)
parser.add_argument("-s", "--stats", help="show TileDB stats", action="store_true")
parser.add_argument(
"-o",
help="Specify output directory to contain the somas: default ./anndata-readback-tiledbsoma",
Expand Down Expand Up @@ -91,12 +92,6 @@ def main():
parser.print_help(file=sys.stderr)
sys.exit(1)

vfs = tiledb.VFS()
if not vfs.is_dir(input_path):
# Print this neatly and exit neatly, to avoid a multi-line stack trace otherwise.
logging.error(f"Input path not found: {input_path}")
sys.exit(1)

# This is for local-disk use only -- for S3-backed tiledb://... URIs we should
# use tiledb.vfs to remove any priors, and/or make use of a tiledb `overwrite` flag.
if tiledbsoma._util.is_local_path(outdir):
Expand All @@ -108,6 +103,12 @@ def main():
elif not args.quiet:
tiledbsoma.logging.info()

if args.stats:
tiledb.stats_enable()
tiledb.stats_reset()
tiledbsoma.tiledbsoma_stats_enable()
tiledbsoma.tiledbsoma_stats_reset()

soma = tiledbsoma.Experiment.open(input_path)
tiledbsoma.io.to_h5ad(
soma,
Expand All @@ -120,6 +121,10 @@ def main():

logger.info(f"Wrote {output_path}")

if args.stats:
tiledb.stats_dump()
tiledbsoma.tiledbsoma_stats_dump()


if __name__ == "__main__":
main()

0 comments on commit a92884e

Please sign in to comment.