Skip to content

Commit

Permalink
Deprecate --gen2 flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
kfindeisen committed May 12, 2021
1 parent 8672bb7 commit bd8747f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
22 changes: 21 additions & 1 deletion doc/lsst.ap.verify/command-line-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,17 @@ Required arguments are :option:`--dataset` and :option:`--output`.
Specify data ID to process.
If using :option:`--gen2`, this should use :doc:`data ID syntax </modules/lsst.pipe.base/command-line-task-dataid-howto>`, such as ``--data-query "visit=12345 ccd=1..6 filter=g"``.
If using :option:`--gen3`, this should use :ref:`dimension expression syntax <daf_butler_dimension_expressions>`, such as ``--data-query "visit=12345 and detector in (1..6) and band='g'"``.
The ``-id`` form of this argument is for consistency with Gen 2 command-line tasks, and is deprecated.

Multiple copies of this argument are allowed.
For compatibility with the syntax used by command line tasks, this flag with no argument processes all data IDs.

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

.. warning::

The ``--id`` form of this argument is for consistency with Gen 2 command-line tasks, and is deprecated.
It will be removed after Science Pipelines release 23.

.. option:: --dataset <dataset_package>

**Input dataset package.**
Expand All @@ -92,6 +96,10 @@ Required arguments are :option:`--dataset` and :option:`--output`.
For the Gen 3 equivalent to this option, see :option:`--pipeline`.
See also :doc:`new-metrics`.

.. warning::

Support for Gen 2 processing is deprecated and will be removed after Science Pipelines release 23.

.. option:: --db, --db_url

**Target Alert Production Database**
Expand All @@ -110,6 +118,10 @@ Required arguments are :option:`--dataset` and :option:`--output`.
These optional flags run either the Gen 2 pipeline (`~lsst.ap.pipe.ApPipeTask`), or the Gen 3 pipeline (:file:`apPipe.yaml`).
If neither flag is provided, the Gen 3 pipeline will be run.

.. warning::

Support for Gen 2 processing is deprecated and will be removed after Science Pipelines release 23.

.. option:: -h, --help

**Print help.**
Expand All @@ -134,6 +146,10 @@ Required arguments are :option:`--dataset` and :option:`--output`.
For the Gen 3 equivalent to this option, see :option:`--pipeline`.
See also :doc:`new-metrics`.

.. warning::

Support for Gen 2 processing is deprecated and will be removed after Science Pipelines release 23.

.. option:: --metrics-file <filename>

**Output metrics file. (Gen 2 only)**
Expand All @@ -142,6 +158,10 @@ Required arguments are :option:`--dataset` and :option:`--output`.
The string ``{dataId}`` shall be replaced with the data ID associated with the job, and its use is strongly recommended.
If omitted, the output will go to files named after ``ap_verify.{dataId}.verify.json`` in the user's working directory.

.. warning::

Support for Gen 2 processing is deprecated and will be removed after Science Pipelines release 23.

.. option:: --output <workspace_dir>

**Output and intermediate product path.**
Expand Down
17 changes: 17 additions & 0 deletions python/lsst/ap/verify/ap_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import argparse
import re
import warnings

import lsst.log

Expand Down Expand Up @@ -91,6 +92,14 @@ def __init__(self):
parents=[_InputOutputParser(), _ProcessingParser(), ApPipeParser(), MetricsParser()],
add_help=True)

def parse_args(self, args=None, namespace=None):
namespace = super().parse_args(args, namespace)
# Code duplication; too hard to implement at shared _InputOutputParser level
if not namespace.useGen3:
warnings.warn("The --gen2 flag is deprecated; it will be removed after release 23.",
category=FutureWarning)
return namespace


class _IngestOnlyParser(argparse.ArgumentParser):
"""An argument parser for data needed by dataset ingestion.
Expand All @@ -109,6 +118,14 @@ def __init__(self):
parents=[_InputOutputParser(), _ProcessingParser()],
add_help=True)

def parse_args(self, args=None, namespace=None):
namespace = super().parse_args(args, namespace)
# Code duplication; too hard to implement at shared _InputOutputParser level
if not namespace.useGen3:
warnings.warn("The --gen2 flag is deprecated; it will be removed after release 23.",
category=FutureWarning)
return namespace


class _FormattedType:
"""An argparse type converter that requires strings in a particular format.
Expand Down

0 comments on commit bd8747f

Please sign in to comment.