From 4c3fb8cdcaba0e8be1b3b3a1ea31a89bd038f44a Mon Sep 17 00:00:00 2001 From: Harris Tzovanakis Date: Fri, 15 Nov 2024 14:23:04 +0100 Subject: [PATCH] workflows: add more save points during enchancing records --- inspirehep/modules/workflows/workflows/article.py | 7 +++++++ tests/integration/workflows/test_article_workflow.py | 2 +- tests/integration/workflows/test_arxiv_workflow.py | 2 +- .../workflows/test_workflow_core_selection.py | 10 +++++----- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/inspirehep/modules/workflows/workflows/article.py b/inspirehep/modules/workflows/workflows/article.py index 4c75332f71..0f148eefb8 100644 --- a/inspirehep/modules/workflows/workflows/article.py +++ b/inspirehep/modules/workflows/workflows/article.py @@ -193,17 +193,23 @@ extract_authors_from_pdf, ), normalize_journal_titles, + save_workflow, refextract, + save_workflow, count_reference_coreness, extract_journal_info, + save_workflow, populate_journal_coverage, + save_workflow, classify_paper( only_core_tags=False, spires=True, with_author_keywords=True, ), + save_workflow, filter_core_keywords, guess_categories, + save_workflow, IF( is_experimental_paper, guess_experiments, @@ -211,6 +217,7 @@ guess_keywords, guess_coreness, normalize_collaborations, + save_workflow ] diff --git a/tests/integration/workflows/test_article_workflow.py b/tests/integration/workflows/test_article_workflow.py index 08c2eea7f4..e5b38cfe13 100644 --- a/tests/integration/workflows/test_article_workflow.py +++ b/tests/integration/workflows/test_article_workflow.py @@ -428,7 +428,7 @@ def test_run_next_wf_is_not_starting_core_selection_wfs( wf = workflow_object_class.get(workflow.id) mark("auto-approved", True)(workflow, None) - wf.callback_pos = [34, 1, 13] + wf.callback_pos = [41, 1, 13] wf.continue_workflow() check_wf_state(wf.id, ObjectStatus.COMPLETED) diff --git a/tests/integration/workflows/test_arxiv_workflow.py b/tests/integration/workflows/test_arxiv_workflow.py index b8384c41d6..128ccd011d 100644 --- a/tests/integration/workflows/test_arxiv_workflow.py +++ b/tests/integration/workflows/test_arxiv_workflow.py @@ -401,7 +401,7 @@ def test_match_in_holdingpen_previously_rejected_wf_stop( assert obj2.extra_data["already-in-holding-pen"] is False assert obj2.extra_data["previously_rejected"] is True - assert obj2.extra_data["previously_rejected_matches"] == [obj_id] + assert obj_id in obj2.extra_data["previously_rejected_matches"] def test_article_workflow_stops_when_record_is_not_valid(workflow_app): diff --git a/tests/integration/workflows/test_workflow_core_selection.py b/tests/integration/workflows/test_workflow_core_selection.py index d539f51ce2..585688a0d7 100644 --- a/tests/integration/workflows/test_workflow_core_selection.py +++ b/tests/integration/workflows/test_workflow_core_selection.py @@ -173,7 +173,7 @@ def test_core_selection_wf_starts_after_article_wf_when_no_core( == 0 ) - workflow_object.callback_pos = [34, 1, 13] + workflow_object.callback_pos = [41, 1, 13] # Run task for creating core_selection wf workflow_object.extra_data["auto-approved"] = True workflow_object.save() @@ -306,7 +306,7 @@ def test_core_selection_wf_is_not_created_when_wf_is_record_update( == 0 ) - workflow_object.callback_pos = [34, 1, 13] + workflow_object.callback_pos = [41, 1, 13] # Run task for creating core_selection wf workflow_object.extra_data["auto-approved"] = True workflow_object.extra_data["is-update"] = True @@ -465,7 +465,7 @@ def test_core_selection_wf_works_when_there_is_record_redirection_on_hep( == 0 ) - workflow_object.callback_pos = [34, 1, 13] + workflow_object.callback_pos = [41, 1, 13] # Run task for creating core_selection wf workflow_object.extra_data["auto-approved"] = True workflow_object.save() @@ -610,7 +610,7 @@ def test_core_selection_wf_still_runs_when_there_is_core_on_hep_already( == 0 ) - workflow_object.callback_pos = [34, 1, 13] + workflow_object.callback_pos = [41, 1, 13] # Run task for creating core_selection wf workflow_object.extra_data["auto-approved"] = True workflow_object.save() @@ -725,7 +725,7 @@ def test_core_selection_wf_skipped_if_record_was_manually_approved( ) start("article", object_id=workflow_object.id) - workflow_object.callback_pos = [34, 1, 13] + workflow_object.callback_pos = [41, 1, 13] # Run task for creating core_selection wf workflow_object.extra_data["auto-approved"] = False workflow_object.save()