From faf95cbcf72d070c9433913d52f8ae068e5675ea Mon Sep 17 00:00:00 2001 From: "Meinel, Michael" Date: Mon, 8 May 2023 16:47:30 +0200 Subject: [PATCH 01/18] Dump deposited model after creation (e.g., for use in post-processor) --- src/hermes/commands/deposit/invenio.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hermes/commands/deposit/invenio.py b/src/hermes/commands/deposit/invenio.py index c5b6a1f0..e595ae6d 100644 --- a/src/hermes/commands/deposit/invenio.py +++ b/src/hermes/commands/deposit/invenio.py @@ -158,6 +158,8 @@ def deposit(click_ctx: click.Context, ctx: CodeMetaContext): deposit = response.json() _log.debug("Created deposit: %s", deposit["links"]["html"]) + with open(ctx.get_cache('deposit', 'deposit', create=True), 'w') as deposit_file: + json.dump(deposit, deposit_file, indent=' ') # Upload the files. We'll use the bucket API rather than the files API as it # supports file sizes above 100MB. From 9623c8358d4b5a6b35bfaef250157d180b735592 Mon Sep 17 00:00:00 2001 From: "Meinel, Michael" Date: Mon, 8 May 2023 17:45:47 +0200 Subject: [PATCH 02/18] Allow access to basic hermes configuration dict --- src/hermes/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hermes/config.py b/src/hermes/config.py index c43474ab..035c5ae9 100644 --- a/src/hermes/config.py +++ b/src/hermes/config.py @@ -106,7 +106,7 @@ def get(name: str) -> dict: _config['hermes'][name] = {} _config[name] = _config['hermes'][name] - elif not _config['hermes'][name] is _config[name]: + elif name != 'hermes' and not _config['hermes'][name] is _config[name]: # If a configuration was loaded, after the defaults were set, update it. _config[name].update(_config['hermes'].get('name', {})) From d12e92460ac29f5e0c35d4765a83006bb452f30e Mon Sep 17 00:00:00 2001 From: "Meinel, Michael" Date: Mon, 8 May 2023 17:46:25 +0200 Subject: [PATCH 03/18] Add basic post-process functionality --- pyproject.toml | 4 ++ src/hermes/commands/postprocess/__init__.py | 0 src/hermes/commands/postprocess/invenio.py | 31 +++++++++++++ src/hermes/commands/workflow.py | 51 ++++++++++++++++++++- 4 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 src/hermes/commands/postprocess/__init__.py create mode 100644 src/hermes/commands/postprocess/invenio.py diff --git a/pyproject.toml b/pyproject.toml index cd95f3bf..514908a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,6 +92,10 @@ invenio = "hermes.commands.deposit.invenio:map_metadata" [tool.poetry.plugins."hermes.deposit"] invenio = "hermes.commands.deposit.invenio:deposit" +[tool.poetry.plugins."hermes.postprocess"] +config_record_id = "hermes.commands.postprocess.invenio:config_record_id" +cff_doi = "hermes.commands.postprocess.invenio:cff_doi" + [tool.taskipy.tasks] docs-build = "poetry run sphinx-build -M html docs/source docs/build -W" docs-clean = "poetry run sphinx-build -M clean docs/source docs/build" diff --git a/src/hermes/commands/postprocess/__init__.py b/src/hermes/commands/postprocess/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/hermes/commands/postprocess/invenio.py b/src/hermes/commands/postprocess/invenio.py new file mode 100644 index 00000000..29de1119 --- /dev/null +++ b/src/hermes/commands/postprocess/invenio.py @@ -0,0 +1,31 @@ +import json + +import toml +import yaml + +from hermes import config + +def config_record_id(ctx): + deposition_path = ctx.get_cache('deposit', 'deposit') + with deposition_path.open("r") as deposition_file: + deposition = json.load(deposition_file) + conf = config.get('hermes') + conf['deposit']['invenio']['record_id'] = deposition['record_id'] + + toml.dump(conf, open('hermes.toml', 'w')) + + +def cff_doi(ctx): + deposition_path = ctx.get_cache('deposit', 'deposit') + with deposition_path.open("r") as deposition_file: + deposition = json.load(deposition_file) + cff = yaml.load(open('CITATION.cff', 'r'), yaml.CLoader) + cff['identifiers'] = [ + { + 'description': "Generated by hermes after deposition.", + 'type': 'doi', + 'value': deposition['doi'] + } + ] + + yaml.dump(cff, open('CITATION.cff', 'w')) diff --git a/src/hermes/commands/workflow.py b/src/hermes/commands/workflow.py index 8de3e1e0..66d25a4d 100644 --- a/src/hermes/commands/workflow.py +++ b/src/hermes/commands/workflow.py @@ -224,11 +224,58 @@ def deposit(click_ctx: click.Context, auth_token, file): @click.group(invoke_without_command=True) -def postprocess(): +@click.pass_context +def postprocess(click_ctx: click.Context): """ Postprocess metadata after deposition """ - click.echo("Post-processing") + """ + Process metadata and prepare it for deposition + """ + _log = logging.getLogger('cli.postprocess') + + audit_log = logging.getLogger('audit') + audit_log.info("# Post-processing") + + ctx = CodeMetaContext() + + if not (ctx.hermes_dir / "deposit").exists(): + _log.error("You must run the deposit command before post-process") + click_ctx.exit(1) + + # Get all harvesters + postprocess_config = config.get("post") + postprocess_names = postprocess_config.get('process', [ep.name for ep in metadata.entry_points(group='hermes.postprocess')]) + + for postprocess_name in postprocess_names: + postprocessors = metadata.entry_points(group='hermes.postprocess', name=postprocess_name) + if not postprocessors: + _log.warning("- Post-processor %s selected but not found.", postprocess_name) + continue + + postprocessor_ep, *_ = postprocessors + audit_log.info("## Post-process data with %s", postprocessor_ep.name) + postprocessor = postprocessor_ep.load() + postprocessor(ctx) + + audit_log.info('') + + if ctx._errors: + audit_log.error('!!! warning "Errors during merge"') + + for ep, error in ctx._errors: + audit_log.info(' - %s: %s', ep.name, error) + + tags_path = ctx.get_cache('process', 'tags', create=True) + with tags_path.open('w') as tags_file: + json.dump(ctx.tags, tags_file, indent=2) + + ctx.prepare_codemeta() + + with open(ctx.get_cache("process", "codemeta", create=True), 'w') as codemeta_file: + json.dump(ctx._data, codemeta_file, indent=2) + + logging.shutdown() @click.group(invoke_without_command=True) From 85f671c78732053605b6ac281219dc025bf18118 Mon Sep 17 00:00:00 2001 From: "Meinel, Michael" Date: Thu, 11 May 2023 15:52:55 +0200 Subject: [PATCH 04/18] Remove duplicate code that was created due to copy and past --- src/hermes/commands/workflow.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/hermes/commands/workflow.py b/src/hermes/commands/workflow.py index 66d25a4d..ce423e36 100644 --- a/src/hermes/commands/workflow.py +++ b/src/hermes/commands/workflow.py @@ -259,22 +259,6 @@ def postprocess(click_ctx: click.Context): postprocessor(ctx) audit_log.info('') - - if ctx._errors: - audit_log.error('!!! warning "Errors during merge"') - - for ep, error in ctx._errors: - audit_log.info(' - %s: %s', ep.name, error) - - tags_path = ctx.get_cache('process', 'tags', create=True) - with tags_path.open('w') as tags_file: - json.dump(ctx.tags, tags_file, indent=2) - - ctx.prepare_codemeta() - - with open(ctx.get_cache("process", "codemeta", create=True), 'w') as codemeta_file: - json.dump(ctx._data, codemeta_file, indent=2) - logging.shutdown() From bf4d95f3503375deeca494801569b40df3ed84f1 Mon Sep 17 00:00:00 2001 From: "Meinel, Michael" Date: Thu, 11 May 2023 15:57:49 +0200 Subject: [PATCH 05/18] Add some basic error handling. --- src/hermes/commands/postprocess/invenio.py | 35 ++++++++++++++-------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/hermes/commands/postprocess/invenio.py b/src/hermes/commands/postprocess/invenio.py index 29de1119..873a9ba2 100644 --- a/src/hermes/commands/postprocess/invenio.py +++ b/src/hermes/commands/postprocess/invenio.py @@ -1,31 +1,40 @@ import json +import logging import toml import yaml from hermes import config + +_log = logging.getLogger('deposit.invenio') + + def config_record_id(ctx): deposition_path = ctx.get_cache('deposit', 'deposit') with deposition_path.open("r") as deposition_file: deposition = json.load(deposition_file) conf = config.get('hermes') - conf['deposit']['invenio']['record_id'] = deposition['record_id'] - - toml.dump(conf, open('hermes.toml', 'w')) + try: + conf['deposit']['invenio']['record_id'] = deposition['record_id'] + toml.dump(conf, open('hermes.toml', 'w')) + except KeyError as e: + raise RuntimeError("No configuration for deposition on Invenio available to store record id") from e def cff_doi(ctx): deposition_path = ctx.get_cache('deposit', 'deposit') with deposition_path.open("r") as deposition_file: deposition = json.load(deposition_file) - cff = yaml.load(open('CITATION.cff', 'r'), yaml.CLoader) - cff['identifiers'] = [ - { - 'description': "Generated by hermes after deposition.", - 'type': 'doi', - 'value': deposition['doi'] - } - ] - - yaml.dump(cff, open('CITATION.cff', 'w')) + try: + cff = yaml.load(open('CITATION.cff', 'r'), yaml.CLoader) + cff['identifiers'] = [ + { + 'description': "Generated by hermes after deposition.", + 'type': 'doi', + 'value': deposition['doi'] + } + ] + yaml.dump(cff, open('CITATION.cff', 'w')) + except IOError as e: + raise RuntimeError("No CITATION.cff available.") from e From f16143311ba3f23058b0adb4c53178f39804b4a1 Mon Sep 17 00:00:00 2001 From: "Meinel, Michael" Date: Thu, 11 May 2023 16:09:38 +0200 Subject: [PATCH 06/18] Change default behaviour, no post-processors instead of all --- src/hermes/commands/workflow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hermes/commands/workflow.py b/src/hermes/commands/workflow.py index ce423e36..3224df52 100644 --- a/src/hermes/commands/workflow.py +++ b/src/hermes/commands/workflow.py @@ -245,7 +245,7 @@ def postprocess(click_ctx: click.Context): # Get all harvesters postprocess_config = config.get("post") - postprocess_names = postprocess_config.get('process', [ep.name for ep in metadata.entry_points(group='hermes.postprocess')]) + postprocess_names = postprocess_config.get('process', []) for postprocess_name in postprocess_names: postprocessors = metadata.entry_points(group='hermes.postprocess', name=postprocess_name) From 34acbe840c5642d91995bab180a1b37e5437bb99 Mon Sep 17 00:00:00 2001 From: "Meinel, Michael" Date: Thu, 11 May 2023 16:09:58 +0200 Subject: [PATCH 07/18] Add missing reuse information --- src/hermes/commands/postprocess/invenio.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/hermes/commands/postprocess/invenio.py b/src/hermes/commands/postprocess/invenio.py index 873a9ba2..ef1f3f9a 100644 --- a/src/hermes/commands/postprocess/invenio.py +++ b/src/hermes/commands/postprocess/invenio.py @@ -1,3 +1,9 @@ +# SPDX-FileCopyrightText: 2022 German Aerospace Center (DLR) +# +# SPDX-License-Identifier: Apache-2.0 + +# SPDX-FileContributor: Michael Meinel + import json import logging From 1b83c0ca0fc0e09e9293ebcba388e3503ea01a6d Mon Sep 17 00:00:00 2001 From: "Meinel, Michael" Date: Thu, 11 May 2023 16:27:53 +0200 Subject: [PATCH 08/18] Fix failing test due to added behaviour --- test/hermes_test/test_cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/hermes_test/test_cli.py b/test/hermes_test/test_cli.py index d4ea3bb4..4e448582 100644 --- a/test/hermes_test/test_cli.py +++ b/test/hermes_test/test_cli.py @@ -134,14 +134,14 @@ def test_hermes_with_deposit_and_path(): runner = CliRunner() result = runner.invoke(cli.main, args=('--deposit', '--path', './')) - assert isinstance(result.exception, DepositionUnauthorizedError) + assert result.exit_code == 2 def test_hermes_with_path_and_postprocess(): runner = CliRunner() result = runner.invoke(cli.main, args=('--path', './', '--postprocess')) - assert not result.exception + assert result.exit_code == 1 @pytest.mark.skip(reason="No clean way at the moment of adding more required options that are parsed by Click, \ From 5174a08cd3675e806d2789169dd432a1f58add47 Mon Sep 17 00:00:00 2001 From: "Meinel, Michael" Date: Fri, 12 May 2023 12:57:14 +0200 Subject: [PATCH 09/18] Fix incorrect YAML import --- src/hermes/commands/postprocess/invenio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hermes/commands/postprocess/invenio.py b/src/hermes/commands/postprocess/invenio.py index ef1f3f9a..17a40204 100644 --- a/src/hermes/commands/postprocess/invenio.py +++ b/src/hermes/commands/postprocess/invenio.py @@ -8,7 +8,7 @@ import logging import toml -import yaml +from ruamel import yaml from hermes import config From b88367be1ac72e7e77b3a6b368b7a4ec341ce403 Mon Sep 17 00:00:00 2001 From: "Druskat, Stephan" Date: Mon, 15 May 2023 15:21:21 +0200 Subject: [PATCH 10/18] Use the default YAML loader instead of CLoader --- src/hermes/commands/postprocess/invenio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hermes/commands/postprocess/invenio.py b/src/hermes/commands/postprocess/invenio.py index 17a40204..55c63435 100644 --- a/src/hermes/commands/postprocess/invenio.py +++ b/src/hermes/commands/postprocess/invenio.py @@ -33,7 +33,7 @@ def cff_doi(ctx): with deposition_path.open("r") as deposition_file: deposition = json.load(deposition_file) try: - cff = yaml.load(open('CITATION.cff', 'r'), yaml.CLoader) + cff = yaml.load(open('CITATION.cff', 'r'), yaml.Loader) cff['identifiers'] = [ { 'description': "Generated by hermes after deposition.", From 51fd2bb9cacf507b9c498ae0814a12b058790b5b Mon Sep 17 00:00:00 2001 From: "Druskat, Stephan" Date: Mon, 15 May 2023 16:12:07 +0200 Subject: [PATCH 11/18] Fix adding identifier to existing CFF file --- src/hermes/commands/postprocess/invenio.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/hermes/commands/postprocess/invenio.py b/src/hermes/commands/postprocess/invenio.py index 55c63435..9792ce8e 100644 --- a/src/hermes/commands/postprocess/invenio.py +++ b/src/hermes/commands/postprocess/invenio.py @@ -34,13 +34,16 @@ def cff_doi(ctx): deposition = json.load(deposition_file) try: cff = yaml.load(open('CITATION.cff', 'r'), yaml.Loader) - cff['identifiers'] = [ - { - 'description': "Generated by hermes after deposition.", + new_identifier = { + 'description': f"DOI for the published version {deposition['metadata']['version']} [generated by hermes]", 'type': 'doi', 'value': deposition['doi'] } - ] - yaml.dump(cff, open('CITATION.cff', 'w')) + if 'identifiers' in cff: + cff['identifiers'].append(new_identifier) + else: + cff['identifiers'] = [new_identifier] + yaml.dump(cff, open('CITATION.cff', 'w'), + indent=4, default_flow_style=False, block_seq_indent=2, allow_unicode=True) except IOError as e: - raise RuntimeError("No CITATION.cff available.") from e + raise RuntimeError("CITATION.cff not found.") from e From 8de8873e37305c9d559b0fe5c08eebdadeed75ba Mon Sep 17 00:00:00 2001 From: "Druskat, Stephan" Date: Mon, 15 May 2023 16:15:41 +0200 Subject: [PATCH 12/18] Add file contributor metadata --- src/hermes/commands/postprocess/invenio.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hermes/commands/postprocess/invenio.py b/src/hermes/commands/postprocess/invenio.py index 9792ce8e..40a96bf9 100644 --- a/src/hermes/commands/postprocess/invenio.py +++ b/src/hermes/commands/postprocess/invenio.py @@ -3,6 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # SPDX-FileContributor: Michael Meinel +# SPDX-FileContributor: Stephan Druskat import json import logging From 6aeb21aac5652381e28618291a64fb0a4da30d90 Mon Sep 17 00:00:00 2001 From: "Druskat, Stephan" Date: Mon, 15 May 2023 16:37:43 +0200 Subject: [PATCH 13/18] Fix flake8 error --- src/hermes/commands/postprocess/invenio.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hermes/commands/postprocess/invenio.py b/src/hermes/commands/postprocess/invenio.py index 40a96bf9..6c6037a0 100644 --- a/src/hermes/commands/postprocess/invenio.py +++ b/src/hermes/commands/postprocess/invenio.py @@ -36,7 +36,8 @@ def cff_doi(ctx): try: cff = yaml.load(open('CITATION.cff', 'r'), yaml.Loader) new_identifier = { - 'description': f"DOI for the published version {deposition['metadata']['version']} [generated by hermes]", + 'description': f"DOI for the published version {deposition['metadata']['version']} " + f"[generated by hermes]", 'type': 'doi', 'value': deposition['doi'] } From 3770cbf9c50d835b77d39984ea0ec13668e06698 Mon Sep 17 00:00:00 2001 From: Michael Meinel Date: Tue, 16 May 2023 08:48:47 +0200 Subject: [PATCH 14/18] Apply suggestions from code review Co-authored-by: Stephan Druskat --- src/hermes/commands/deposit/invenio.py | 2 +- src/hermes/commands/postprocess/invenio.py | 2 +- src/hermes/commands/workflow.py | 3 --- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/hermes/commands/deposit/invenio.py b/src/hermes/commands/deposit/invenio.py index e595ae6d..512dd93b 100644 --- a/src/hermes/commands/deposit/invenio.py +++ b/src/hermes/commands/deposit/invenio.py @@ -159,7 +159,7 @@ def deposit(click_ctx: click.Context, ctx: CodeMetaContext): deposit = response.json() _log.debug("Created deposit: %s", deposit["links"]["html"]) with open(ctx.get_cache('deposit', 'deposit', create=True), 'w') as deposit_file: - json.dump(deposit, deposit_file, indent=' ') + json.dump(deposit, deposit_file, indent=4) # Upload the files. We'll use the bucket API rather than the files API as it # supports file sizes above 100MB. diff --git a/src/hermes/commands/postprocess/invenio.py b/src/hermes/commands/postprocess/invenio.py index 6c6037a0..eeb6678f 100644 --- a/src/hermes/commands/postprocess/invenio.py +++ b/src/hermes/commands/postprocess/invenio.py @@ -26,7 +26,7 @@ def config_record_id(ctx): conf['deposit']['invenio']['record_id'] = deposition['record_id'] toml.dump(conf, open('hermes.toml', 'w')) except KeyError as e: - raise RuntimeError("No configuration for deposition on Invenio available to store record id") from e + raise RuntimeError("No Invenio deposition configuration available to store record id in") from e def cff_doi(ctx): diff --git a/src/hermes/commands/workflow.py b/src/hermes/commands/workflow.py index 3224df52..a257fad3 100644 --- a/src/hermes/commands/workflow.py +++ b/src/hermes/commands/workflow.py @@ -229,9 +229,6 @@ def postprocess(click_ctx: click.Context): """ Postprocess metadata after deposition """ - """ - Process metadata and prepare it for deposition - """ _log = logging.getLogger('cli.postprocess') audit_log = logging.getLogger('audit') From f8518814e2556b9d301ac41b29be7370266cd35d Mon Sep 17 00:00:00 2001 From: Stephan Druskat Date: Mon, 22 May 2023 11:00:08 +0200 Subject: [PATCH 15/18] Adapt error message to catch >1 error type Co-authored-by: David Pape --- src/hermes/commands/postprocess/invenio.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hermes/commands/postprocess/invenio.py b/src/hermes/commands/postprocess/invenio.py index eeb6678f..f571eab1 100644 --- a/src/hermes/commands/postprocess/invenio.py +++ b/src/hermes/commands/postprocess/invenio.py @@ -47,5 +47,5 @@ def cff_doi(ctx): cff['identifiers'] = [new_identifier] yaml.dump(cff, open('CITATION.cff', 'w'), indent=4, default_flow_style=False, block_seq_indent=2, allow_unicode=True) - except IOError as e: - raise RuntimeError("CITATION.cff not found.") from e + except Exception as e: + raise RuntimeError("Update of CITATION.cff failed.") from e From 33a29cd598ba794258e84850fdc514d763e49368 Mon Sep 17 00:00:00 2001 From: Oliver Bertuch Date: Mon, 22 May 2023 18:01:22 +0200 Subject: [PATCH 16/18] style: apply suggestion from code review Co-authored-by: David Pape --- src/hermes/commands/postprocess/invenio.py | 4 ++-- src/hermes/commands/workflow.py | 2 +- src/hermes/config.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hermes/commands/postprocess/invenio.py b/src/hermes/commands/postprocess/invenio.py index f571eab1..022f53e5 100644 --- a/src/hermes/commands/postprocess/invenio.py +++ b/src/hermes/commands/postprocess/invenio.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2022 German Aerospace Center (DLR) +# SPDX-FileCopyrightText: 2023 German Aerospace Center (DLR) # # SPDX-License-Identifier: Apache-2.0 @@ -26,7 +26,7 @@ def config_record_id(ctx): conf['deposit']['invenio']['record_id'] = deposition['record_id'] toml.dump(conf, open('hermes.toml', 'w')) except KeyError as e: - raise RuntimeError("No Invenio deposition configuration available to store record id in") from e + raise RuntimeError("No deposit.invenio configuration available to store record id in") from None def cff_doi(ctx): diff --git a/src/hermes/commands/workflow.py b/src/hermes/commands/workflow.py index a257fad3..701dfbc4 100644 --- a/src/hermes/commands/workflow.py +++ b/src/hermes/commands/workflow.py @@ -240,7 +240,7 @@ def postprocess(click_ctx: click.Context): _log.error("You must run the deposit command before post-process") click_ctx.exit(1) - # Get all harvesters + # Get all postprocessors postprocess_config = config.get("post") postprocess_names = postprocess_config.get('process', []) diff --git a/src/hermes/config.py b/src/hermes/config.py index 035c5ae9..02bd9ddf 100644 --- a/src/hermes/config.py +++ b/src/hermes/config.py @@ -106,7 +106,7 @@ def get(name: str) -> dict: _config['hermes'][name] = {} _config[name] = _config['hermes'][name] - elif name != 'hermes' and not _config['hermes'][name] is _config[name]: + elif name != 'hermes' and _config['hermes'][name] is not _config[name]: # If a configuration was loaded, after the defaults were set, update it. _config[name].update(_config['hermes'].get('name', {})) From 124c95356f54327edf08e80764e6f82a69a8c6eb Mon Sep 17 00:00:00 2001 From: Oliver Bertuch Date: Mon, 22 May 2023 18:04:15 +0200 Subject: [PATCH 17/18] style: make flake8 happy with unused var --- src/hermes/commands/postprocess/invenio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hermes/commands/postprocess/invenio.py b/src/hermes/commands/postprocess/invenio.py index 022f53e5..645269cb 100644 --- a/src/hermes/commands/postprocess/invenio.py +++ b/src/hermes/commands/postprocess/invenio.py @@ -25,7 +25,7 @@ def config_record_id(ctx): try: conf['deposit']['invenio']['record_id'] = deposition['record_id'] toml.dump(conf, open('hermes.toml', 'w')) - except KeyError as e: + except KeyError: raise RuntimeError("No deposit.invenio configuration available to store record id in") from None From 21d54819566619ee2ee5ab148d80d6058990f914 Mon Sep 17 00:00:00 2001 From: Oliver Bertuch Date: Mon, 22 May 2023 18:21:23 +0200 Subject: [PATCH 18/18] style(post): straighten out postprocessing config names --- src/hermes/commands/workflow.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hermes/commands/workflow.py b/src/hermes/commands/workflow.py index 701dfbc4..6e03dc09 100644 --- a/src/hermes/commands/workflow.py +++ b/src/hermes/commands/workflow.py @@ -241,8 +241,8 @@ def postprocess(click_ctx: click.Context): click_ctx.exit(1) # Get all postprocessors - postprocess_config = config.get("post") - postprocess_names = postprocess_config.get('process', []) + postprocess_config = config.get("postprocess") + postprocess_names = postprocess_config.get('execute', []) for postprocess_name in postprocess_names: postprocessors = metadata.entry_points(group='hermes.postprocess', name=postprocess_name)