Skip to content

Commit

Permalink
Add --namespace option to ap_verify command line (DM-45668)
Browse files Browse the repository at this point in the history
The --namespace option can be used together with --db option to
run ap_verify against a shared postgres database.
  • Loading branch information
andy-slac committed Aug 21, 2024
1 parent 8f5c408 commit 982c1d7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
11 changes: 9 additions & 2 deletions doc/lsst.ap.verify/command-line-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Required arguments are :option:`--dataset` and :option:`--output`.
Multiple copies of this argument are allowed.

If this argument is omitted, then all data IDs in the dataset will be processed.

.. option:: --dataset <dataset_package>

**Input dataset package.**
Expand All @@ -87,6 +87,13 @@ Required arguments are :option:`--dataset` and :option:`--output`.

If this argument is omitted, ``ap_verify`` creates an SQLite database inside the directory indicated by :option:`--output`.

.. option:: --namespace

**Namespace to use in the target database**

Takes a namespace string which has is a standard identifier format.
Only relevant for Postgres databases, together with ``--db`` option can be used to run ``ap_verify`` against a shared Postgres database.

.. option:: -h, --help

**Print help.**
Expand All @@ -98,7 +105,7 @@ Required arguments are :option:`--dataset` and :option:`--output`.
**Number of processes to use.**

When ``processes`` is larger than 1 the pipeline may use the Python `multiprocessing` module to parallelize processing of multiple datasets across multiple processors.

.. option:: --output <workspace_dir>

**Output and intermediate product path.**
Expand Down
8 changes: 6 additions & 2 deletions python/lsst/ap/verify/pipeline_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def __init__(self):
self.add_argument("--db", "--db_url", default=None,
help="A location for the AP database, formatted as if for apdb-cli create-sql. "
"Defaults to an SQLite file in the --output directory.")
self.add_argument("--namespace", default=None,
help="Namespace for the AP database.")
self.add_argument("--skip-pipeline", action="store_true",
help="Do not run the AP pipeline itself. This argument is useful "
"for testing metrics on a fixed data set.")
Expand Down Expand Up @@ -215,8 +217,10 @@ def _getApdbArguments(workspace, parsed):
if not parsed.db:
parsed.db = "sqlite:///" + workspace.dbLocation

args = {"db_url": parsed.db,
}
args = {
"db_url": parsed.db,
"namespace": parsed.namespace,
}

return args

Expand Down

0 comments on commit 982c1d7

Please sign in to comment.