Skip to content

Commit d5c33b8

Browse files
authored
Merge pull request #92 from CHIMEFRB/91-make-the-scout-command-take-the-scope-and-name-in-the-same-order-as-other-commands
fix(scout): change order of the args
2 parents ed5fd1a + 797eeac commit d5c33b8

3 files changed

Lines changed: 35 additions & 14 deletions

File tree

docs/scout.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# 🕵️ Investigating a dataset with scout
22

33
<!-- termynal -->
4+
45
```bash
56
❯ datatrail scout --help
6-
Usage: datatrail scout [OPTIONS] DATASET [SCOPES]...
7+
Usage: datatrail scout [OPTIONS] [SCOPES]... DATASET
78

89
Scout a dataset.
910

@@ -28,14 +29,14 @@ filtered to only show information for the `chime.event.baseband.raw` scope
2829
and unfiltered.
2930

3031
!!! note
31-
The output below does not show the correct colouring. The rows of the table
32-
are colour-coded to indicate if it is observed or expected. Observed
33-
values are displayed in blue and expected values are in yellow.
32+
The output below does not show the correct colouring. The rows of the table
33+
are colour-coded to indicate if it is observed or expected. Observed
34+
values are displayed in blue and expected values are in yellow.
3435

3536
=== "Filtering by scope"
3637

3738
```bash
38-
❯ datatrail scout 382085503 chime.event.baseband.raw
39+
❯ datatrail scout chime.event.baseband.raw 382085503
3940
Scout Results for 382085503
4041
┏━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━━━┓
4142
┃ Scope ┃ chime ┃ baseband_buffer ┃ kko ┃ gbo ┃ hco ┃ minoc ┃
@@ -48,7 +49,7 @@ and unfiltered.
4849
this may be due to the file type filtering when querying each site. This is a
4950
known limitation of the current implementation.
5051
```
51-
52+
5253
1. The Observed number of files.
5354
2. The Expected number of files.
5455

@@ -76,18 +77,19 @@ and unfiltered.
7677
```
7778

7879
!!! failure "Negative files"
79-
If the server encounters an error it is represented as a negative number.
80-
Which can occur when communicating with the mini-servers running at each
81-
storage element.
80+
If the server encounters an error it is represented as a negative number.
81+
Which can occur when communicating with the mini-servers running at each
82+
storage element.
8283

8384
### Healing at Minoc
85+
8486
In some cases, the number of files expected at minoc may be less than the number
8587
that actually exist there. This can occur when API requests drop, leading to an
8688
inconsistent state in the database. When this is seen by `scout`, the command
8789
offers to remedy the situation by adding the missing replicas.
8890

8991
```bash
90-
❯ datatrail scout 383577603 chime.event.baseband.raw
92+
❯ datatrail scout chime.event.baseband.raw 383577603
9193
Scout Results for 383577603
9294
┏━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━━━┓
9395
┃ Scope ┃ chime ┃ baseband_buffer ┃ kko ┃ gbo ┃ hco ┃ minoc ┃

dtcli/scout.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,24 @@
2222

2323

2424
@click.command(name="scout", help="Scout a dataset.")
25-
@click.argument("dataset", required=True, type=click.STRING, nargs=1)
2625
@click.argument("scopes", required=False, type=click.STRING, nargs=-1)
26+
@click.argument("dataset", required=True, type=click.STRING, nargs=1)
2727
@click.option("-v", "--verbose", count=True, help="Verbosity: v=INFO, vv=DEBUG.")
2828
@click.option("-q", "--quiet", is_flag=True, help="Set log level to ERROR.")
2929
@click.pass_context
3030
def scout( # noqa: C901
3131
ctx: click.Context,
32-
dataset: str,
3332
scopes: List[str],
33+
dataset: str,
3434
verbose: int,
3535
quiet: bool,
3636
):
3737
"""Scout a dataset.
3838
3939
Args:
4040
ctx (click.Context): Click context.
41-
dataset (str): Name of dataset.
4241
scopes (List[str]): Scopes of dataset.
42+
dataset (str): Name of dataset.
4343
verbose (int): Verbosity: v=INFO, vv=DUBUG.
4444
quiet (bool): Set log level to ERROR.
4545
@@ -49,8 +49,8 @@ def scout( # noqa: C901
4949
# Set logging level.
5050
set_log_level(logger, verbose, quiet)
5151
logger.debug("`scout` called with:")
52-
logger.debug(f"dataset: {dataset} [{type(dataset)}]")
5352
logger.debug(f"scopes: {scopes} [{type(scopes)}]")
53+
logger.debug(f"dataset: {dataset} [{type(dataset)}]")
5454
logger.debug(f"verbose: {verbose} [{type(verbose)}]")
5555
logger.debug(f"quiet: {quiet} [{type(quiet)}]")
5656

tests/test_cli.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,25 @@ def test_cli_pull_help(runner: CliRunner) -> None:
152152
assert result.output == expected_response
153153

154154

155+
def test_cli_scout_help(runner: CliRunner) -> None:
156+
"""Test CLI scout help page.
157+
Args:
158+
runner (CliRunner): Click runner.
159+
"""
160+
result = runner.invoke(datatrail, ["scout", "--help"])
161+
expected_response = """Usage: cli scout [OPTIONS] [SCOPES]... DATASET
162+
163+
Scout a dataset.
164+
165+
Options:
166+
-v, --verbose Verbosity: v=INFO, vv=DEBUG.
167+
-q, --quiet Set log level to ERROR.
168+
--help Show this message and exit.
169+
"""
170+
assert result.exit_code == 0
171+
assert result.output == expected_response
172+
173+
155174
def test_cli_clear_help(runner: CliRunner) -> None:
156175
"""Test CLI clear help page.
157176

0 commit comments

Comments
 (0)