diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index b9fffea..fb3deff 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -25,7 +25,7 @@ jobs: - run: python -m pip install --upgrade pip - run: python -m pip install -r requirements/ci.txt - run: python -m pip install -e . - - run: validate_ingestor_config resources/config.sample.json + - run: scicat_validate_ingestor_config resources/config.sample.json - run: docker-compose version - run: docker-compose -f tests/docker-compose-file-writer.yml up -d - run: python tests/_scicat_ingestor.py -c resources/config.sample.json --logging.verbose diff --git a/README.md b/README.md index 54340f3..dc7fd74 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ You need to know the path to the nexus file you want to ingest and also the path to the ``done_writing_message_file`` as a json file. ```bash -background_ingestor \ +scicat_background_ingestor \ --logging.verbose \ -c PATH_TO_CONFIGURATION_FILE.yaml \ --nexus-file PATH_TO_THE_NEXUS_FILE.nxs \ @@ -69,10 +69,10 @@ The template file can be synchronized automatically by ``synchronize_config`` co ### Configuration Validator -You can validate a configuration file with ``validate_ingestor_config`` command. +You can validate a configuration file with ``scicat_validate_ingestor_config`` command. ```bash -validate_ingestor_config +scicat_validate_ingestor_config ``` It tries building nested configuration dataclasses from the configuration file. diff --git a/pyproject.toml b/pyproject.toml index 5cd9f49..765d78b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,9 +46,9 @@ dynamic = ["version"] [project.scripts] scicat_ingestor = "scicat_online_ingestor:main" -background_ingestor = "scicat_offline_ingestor:main" -validate_ingestor_config = "scicat_configuration:validate_config_file" -synchronize_config = "scicat_configuration:synchronize_config_file" +scicat_background_ingestor = "scicat_offline_ingestor:main" +scicat_validate_ingestor_config = "scicat_configuration:validate_config_file" +scicat_synchronize_config = "scicat_configuration:synchronize_config_file" [project.entry-points."scicat_ingestor.metadata_extractor"] max = "numpy:max" diff --git a/src/scicat_configuration.py b/src/scicat_configuration.py index b89e836..67802e5 100644 --- a/src/scicat_configuration.py +++ b/src/scicat_configuration.py @@ -48,9 +48,15 @@ def _parse_nested_input_args(input_args: argparse.Namespace) -> dict: _SHORTENED_ARG_NAMES = MappingProxyType( { "config-file": "c", + "ingestion.dry-run": "d", } ) +_HELP_TEXT = { + "config-file": "Path to the configuration file.", + "ingestion.dry-run": "Dry run mode. No data will be sent to SciCat.", +} + def _wrap_arg_names(name: str, *prefixes: str) -> tuple[str, ...]: long_name = (".".join((*prefixes, name)) if prefixes else name).replace("_", "-") @@ -90,7 +96,13 @@ def _add_arguments(dataclass_tp: type, prefixes: tuple[str, ...] = ()) -> None: for name, tp in atomic_types.items(): arg_names = _wrap_arg_names(name, *prefixes) required = any(arg_name in mandatory_args for arg_name in arg_names) - arg_adder = partial(group.add_argument, *arg_names, required=required) + long_name = arg_names[-1].replace("--", "") + arg_adder = partial( + group.add_argument, + *arg_names, + required=required, + help=_HELP_TEXT.get(long_name), + ) if tp is bool: arg_adder(action="store_true") elif tp in (int, float, str):