Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure encumbrance emails always get sent #1479

Merged
merged 4 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libsys_airflow/dags/folio_finance/lane_fix_encumbrances.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
send_logs = PythonOperator(
task_id="email_fix_encumbrances_log",
python_callable=email_log,
trigger_rule='all_done',
trigger_rule='always',
op_kwargs={
"log_file": "{{ ti.xcom_pull('run_fix_encumbrances_script') }}",
"fy_code": FY_CODE,
Expand Down
2 changes: 1 addition & 1 deletion libsys_airflow/dags/folio_finance/law_fix_encumbrances.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
send_logs = PythonOperator(
task_id="email_fix_encumbrances_log",
python_callable=email_log,
trigger_rule='all_done',
trigger_rule='always',
op_kwargs={
"log_file": "{{ ti.xcom_pull('run_fix_encumbrances_script') }}",
"fy_code": FY_CODE,
Expand Down
2 changes: 1 addition & 1 deletion libsys_airflow/dags/folio_finance/sul_fix_encumbrances.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
send_logs = PythonOperator(
task_id="email_fix_encumbrances_log",
python_callable=email_log,
trigger_rule='all_done',
trigger_rule='always',
op_kwargs={
"log_file": "{{ ti.xcom_pull('run_fix_encumbrances_script') }}",
"fy_code": FY_CODE,
Expand Down
15 changes: 11 additions & 4 deletions libsys_airflow/plugins/folio/encumbrances/fix_encumbrances_run.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import asyncio
import contextlib
import logging
import pathlib
import libsys_airflow.plugins.folio.encumbrances.fix_encumbrances as fix_encumbrances_script

logger = logging.getLogger(__name__)


def fix_encumbrances_run(*args, **kwargs):
choice = args[0]
Expand All @@ -20,10 +23,14 @@ def fix_encumbrances_run(*args, **kwargs):

with log_path.open("w+", 1) as log:
with contextlib.redirect_stdout(log):
asyncio.run(
fix_encumbrances_script.run_operation(
int(choice), fiscal_year_code, tenant, username, password
try:
asyncio.run(
fix_encumbrances_script.run_operation(
int(choice), fiscal_year_code, tenant, username, password
)
)
)
except Exception as e:
logger.error(f"fix_encumbrance_script failed with: {e}")
return str(log_path.absolute())

return str(log_path.absolute())
Loading