From ea880e5ae57ddb39ec86d7d4e1594e73c2390549 Mon Sep 17 00:00:00 2001 From: Reijer Copier Date: Tue, 19 Oct 2021 16:41:44 +0200 Subject: [PATCH] Add option to limit validation to specific dataset(s) --- linkage_checker/cli.py | 9 ++++++++- linkage_checker/core.py | 22 +++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/linkage_checker/cli.py b/linkage_checker/cli.py index 0fe92cb..c3edde8 100755 --- a/linkage_checker/cli.py +++ b/linkage_checker/cli.py @@ -68,9 +68,15 @@ def cli(): default=False, help="Enables debug mode which will run tests for the first three NGR records.", ) +@click.option( + "--uuid", + required=False, + multiple=True, + help="Specify uuid of datasets to validate." +) @click_log.simple_verbosity_option(logger) def linkage_checker_command( - output_path, remote_selenium_url, enable_caching, browser_screenshots, debug_mode + output_path, remote_selenium_url, enable_caching, browser_screenshots, debug_mode, uuid ): set_log_level() @@ -81,6 +87,7 @@ def linkage_checker_command( enable_caching, browser_screenshots, debug_mode, + uuid, ) except AppError: logger.exception("linkage-checker failed:") diff --git a/linkage_checker/core.py b/linkage_checker/core.py index d9bca96..58a2ea8 100755 --- a/linkage_checker/core.py +++ b/linkage_checker/core.py @@ -19,13 +19,17 @@ def main( - output_path, remote_selenium_url, enable_caching, browser_screenshots, debug_mode + output_path, remote_selenium_url, enable_caching, browser_screenshots, debug_mode, uuid ): logger.info("output path = " + str(output_path)) logger.info("remote_selenium_url = " + str(remote_selenium_url)) logger.info("caching enabled = " + str(enable_caching)) logger.info("make browser screenshots = " + str(browser_screenshots)) logger.info("debug_mode = " + str(debug_mode)) + if uuid: + logger.info("uuid = " + ', '.join(uuid)) + else: + logger.info("uuid = None") start_time = datetime.now() @@ -39,8 +43,24 @@ def main( logger.info("number of ngr records found: %d", number_off_ngr_records) + if uuid: + only_uuids = set(uuid) + else: + only_uuids = None + for index in range(number_off_ngr_records): ngr_record = all_ngr_records[index] + + if only_uuids and not ngr_record["uuid"] in only_uuids: + logger.info( + "%s/%s skipping dataset %s (%s)", + index + 1, + number_off_ngr_records, + ngr_record["title"], + ngr_record["uuid"] + ) + continue + logger.info( "%s/%s validating dataset %s (%s)", index + 1,