Skip to content

Commit

Permalink
Reimplements marc_only function
Browse files Browse the repository at this point in the history
  • Loading branch information
jermnelson committed Aug 18, 2022
1 parent 3405bf2 commit 7efadfe
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions dags/bib_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@

logger = logging.getLogger(__name__)


def marc_only(*args, **kwargs):
task_instance = kwargs["task_instance"]
tsv_files = task_instance.xcom_pull(task_ids="bib-files-group", key="tsv-files")
tsv_base = task_instance.xcom_pull(task_ids="bib-files-group", key="tsv-base")
all_next_task_id = kwargs.get("default_task")
marc_only_task_id = kwargs.get("marc_only_task")

if len(tsv_files) < 1 and tsv_base is None:
return marc_only_task_id
return all_next_task_id


sul_config = LibraryConfiguration(
okapi_url=Variable.get("OKAPI_URL"),
tenant_id="sul",
Expand Down Expand Up @@ -138,7 +151,7 @@

marc_only_convert_check = BranchPythonOperator(
task_id="marc-only-convert-check",
python_callable=lambda x: False,
python_callable=marc_only,
op_kwargs={
"marc_stem": "{{ ti.xcom_pull('move-transform.move-marc-files') }}", # noqa
"default_task": "marc21-and-tsv-to-folio.convert_tsv_to_folio_holdings", # noqa
Expand Down Expand Up @@ -256,7 +269,7 @@

marc_only_post_check = BranchPythonOperator(
task_id="marc-only-post-check",
python_callable=lambda x: False,
python_callable=marc_only,
op_kwargs={
"default_task": "post-to-folio.start-holdings-posting",
"marc_only_task": "post-to-folio.finish-all-posts",
Expand Down

0 comments on commit 7efadfe

Please sign in to comment.