diff --git a/docs/scout.md b/docs/scout.md index ad25486..7eb01ed 100644 --- a/docs/scout.md +++ b/docs/scout.md @@ -1,9 +1,10 @@ # 🕵️ Investigating a dataset with scout + ```bash ❯ datatrail scout --help -Usage: datatrail scout [OPTIONS] DATASET [SCOPES]... +Usage: datatrail scout [OPTIONS] [SCOPES]... DATASET Scout a dataset. @@ -28,14 +29,14 @@ filtered to only show information for the `chime.event.baseband.raw` scope and unfiltered. !!! note - The output below does not show the correct colouring. The rows of the table - are colour-coded to indicate if it is observed or expected. Observed - values are displayed in blue and expected values are in yellow. +The output below does not show the correct colouring. The rows of the table +are colour-coded to indicate if it is observed or expected. Observed +values are displayed in blue and expected values are in yellow. === "Filtering by scope" ```bash - ❯ datatrail scout 382085503 chime.event.baseband.raw + ❯ datatrail scout chime.event.baseband.raw 382085503 Scout Results for 382085503 ┏━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━━━┓ ┃ Scope ┃ chime ┃ baseband_buffer ┃ kko ┃ gbo ┃ hco ┃ minoc ┃ @@ -48,7 +49,7 @@ and unfiltered. this may be due to the file type filtering when querying each site. This is a known limitation of the current implementation. ``` - + 1. The Observed number of files. 2. The Expected number of files. @@ -76,18 +77,19 @@ and unfiltered. ``` !!! failure "Negative files" - If the server encounters an error it is represented as a negative number. - Which can occur when communicating with the mini-servers running at each - storage element. +If the server encounters an error it is represented as a negative number. +Which can occur when communicating with the mini-servers running at each +storage element. ### Healing at Minoc + In some cases, the number of files expected at minoc may be less than the number that actually exist there. This can occur when API requests drop, leading to an inconsistent state in the database. When this is seen by `scout`, the command offers to remedy the situation by adding the missing replicas. ```bash -❯ datatrail scout 383577603 chime.event.baseband.raw +❯ datatrail scout chime.event.baseband.raw 383577603 Scout Results for 383577603 ┏━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━━━┓ ┃ Scope ┃ chime ┃ baseband_buffer ┃ kko ┃ gbo ┃ hco ┃ minoc ┃ diff --git a/dtcli/scout.py b/dtcli/scout.py index c8a42e5..31133e7 100644 --- a/dtcli/scout.py +++ b/dtcli/scout.py @@ -22,15 +22,15 @@ @click.command(name="scout", help="Scout a dataset.") -@click.argument("dataset", required=True, type=click.STRING, nargs=1) @click.argument("scopes", required=False, type=click.STRING, nargs=-1) +@click.argument("dataset", required=True, type=click.STRING, nargs=1) @click.option("-v", "--verbose", count=True, help="Verbosity: v=INFO, vv=DEBUG.") @click.option("-q", "--quiet", is_flag=True, help="Set log level to ERROR.") @click.pass_context def scout( # noqa: C901 ctx: click.Context, - dataset: str, scopes: List[str], + dataset: str, verbose: int, quiet: bool, ): @@ -38,8 +38,8 @@ def scout( # noqa: C901 Args: ctx (click.Context): Click context. - dataset (str): Name of dataset. scopes (List[str]): Scopes of dataset. + dataset (str): Name of dataset. verbose (int): Verbosity: v=INFO, vv=DUBUG. quiet (bool): Set log level to ERROR. @@ -49,8 +49,8 @@ def scout( # noqa: C901 # Set logging level. set_log_level(logger, verbose, quiet) logger.debug("`scout` called with:") - logger.debug(f"dataset: {dataset} [{type(dataset)}]") logger.debug(f"scopes: {scopes} [{type(scopes)}]") + logger.debug(f"dataset: {dataset} [{type(dataset)}]") logger.debug(f"verbose: {verbose} [{type(verbose)}]") logger.debug(f"quiet: {quiet} [{type(quiet)}]") diff --git a/tests/test_cli.py b/tests/test_cli.py index 041f3d7..f27b19e 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -152,6 +152,25 @@ def test_cli_pull_help(runner: CliRunner) -> None: assert result.output == expected_response +def test_cli_scout_help(runner: CliRunner) -> None: + """Test CLI scout help page. + Args: + runner (CliRunner): Click runner. + """ + result = runner.invoke(datatrail, ["scout", "--help"]) + expected_response = """Usage: cli scout [OPTIONS] [SCOPES]... DATASET + + Scout a dataset. + +Options: + -v, --verbose Verbosity: v=INFO, vv=DEBUG. + -q, --quiet Set log level to ERROR. + --help Show this message and exit. +""" + assert result.exit_code == 0 + assert result.output == expected_response + + def test_cli_clear_help(runner: CliRunner) -> None: """Test CLI clear help page.