• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sul-dlss / libsys-airflow / 12358913207

16 Dec 2024 06:26PM UTC coverage: 88.705% (-0.05%) from 88.753%
12358913207

Pull #1479

github

web-flow
Merge 9e6c6e6ff into 160fd9612
Pull Request #1479: Ensure encumbrance emails always get sent

4 of 7 new or added lines in 1 file covered. (57.14%)

4343 of 4896 relevant lines covered (88.71%)

0.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.46
/libsys_airflow/plugins/folio/encumbrances/fix_encumbrances_run.py
1
import asyncio
1✔
2
import contextlib
1✔
3
import logging
1✔
4
import pathlib
1✔
5
import libsys_airflow.plugins.folio.encumbrances.fix_encumbrances as fix_encumbrances_script
1✔
6

7
logger = logging.getLogger(__name__)
1✔
8

9

10
def fix_encumbrances_run(*args, **kwargs):
1✔
11
    choice = args[0]
1✔
12
    fiscal_year_code = args[1]
1✔
13
    tenant = args[2]
1✔
14
    username = args[3]
1✔
15
    password = args[4]
1✔
16

17
    airflow = kwargs.get("airflow", "/opt/airflow/")
1✔
18
    task_instance = kwargs["task_instance"]
1✔
19
    run_id = task_instance.run_id
1✔
20
    library = kwargs.get("library", "")
1✔
21
    log_path = pathlib.Path(airflow) / f"fix_encumbrances/{library}-{run_id}.log"
1✔
22
    log_path.parent.mkdir(parents=True, exist_ok=True)
1✔
23

24
    with log_path.open("w+", 1) as log:
1✔
25
        with contextlib.redirect_stdout(log):
1✔
26
            try:
1✔
27
                asyncio.run(
1✔
28
                    fix_encumbrances_script.run_operation(
29
                        int(choice), fiscal_year_code, tenant, username, password
30
                    )
31
                )
NEW
32
            except Exception as e:
×
NEW
33
                logger.error(f"fix_encumbrance_script failed with: {e}")
×
NEW
34
                return str(log_path.absolute())
×
35

36
    return str(log_path.absolute())
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc