Skip to content

Update ephem_stk code and testing for kadi.occweb built-in retry#283

Merged
taldcroft merged 4 commits intomasterfrom
retry-for-stk-ephemeris
Nov 14, 2025
Merged

Update ephem_stk code and testing for kadi.occweb built-in retry#283
taldcroft merged 4 commits intomasterfrom
retry-for-stk-ephemeris

Conversation

@taldcroft
Copy link
Member

@taldcroft taldcroft commented Nov 1, 2025

Description

This PR updates the code to fetch the STK ephemeris in conjunction with sot/kadi#366. The kadi.occweb.get_* functions now automatically retry.

It also reduces the timeout for the occweb.get_occweb_dir call to 5 sec. If it can't get the result in 5 second then wait and try again.

This also adds an explicit test of the retry functionality via a new MockFuncFailure class that is added in ska_helpers.retry.

Requires

Interface impacts

None

Testing

Unit tests

  • Mac
(ska3) ➜  cheta git:(retry-for-stk-ephemeris) git rev-parse --short HEAD
2cb5c39
(ska3) ➜  cheta git:(retry-for-stk-ephemeris) env PYTHONPATH=/Users/aldcroft/git/kadi:/Users/aldcroft/git/ska_helpers pytest                  
================================================ test session starts =================================================
platform darwin -- Python 3.12.8, pytest-8.3.4, pluggy-1.5.0
rootdir: /Users/aldcroft/git
configfile: pytest.ini
plugins: anyio-4.7.0, timeout-2.3.1
collected 187 items                                                                                                  

cheta/tests/test_comps.py ..............s.......................................................               [ 37%]
cheta/tests/test_data_source.py ...........                                                                    [ 43%]
cheta/tests/test_fetch.py .................................                                                    [ 60%]
cheta/tests/test_intervals.py .........................                                                        [ 74%]
cheta/tests/test_orbit.py .                                                                                    [ 74%]
cheta/tests/test_remote_access.py ......                                                                       [ 78%]
cheta/tests/test_sync.py ........                                                                              [ 82%]
cheta/tests/test_units.py ...........                                                                          [ 88%]
cheta/tests/test_units_reversed.py ...........                                                                 [ 94%]
cheta/tests/test_utils.py ...........                                                                          [100%]

===================================== 186 passed, 1 skipped in 88.01s (0:01:28) ======================================

Independent check of unit tests by Jean

  • Linux
ska3-jeanconn-kady> export PYTHONPATH=$PYTHONPATH:/home/jeanconn/git/kadi
ska3-jeanconn-kady> pytest
============================================================================ test session starts ============================================================================
platform linux -- Python 3.12.8, pytest-8.3.4, pluggy-1.5.0
rootdir: /proj/sot/ska/jeanproj/git
configfile: pytest.ini
plugins: anyio-4.7.0, timeout-2.3.1
collected 187 items                                                                                                                                                         

cheta/tests/test_comps.py .............ss.......................................................                                                                      [ 37%]
cheta/tests/test_data_source.py ...........                                                                                                                           [ 43%]
cheta/tests/test_fetch.py .................................                                                                                                           [ 60%]
cheta/tests/test_intervals.py .........................                                                                                                               [ 74%]
cheta/tests/test_orbit.py .                                                                                                                                           [ 74%]
cheta/tests/test_remote_access.py ......                                                                                                                              [ 78%]
cheta/tests/test_sync.py ........                                                                                                                                     [ 82%]
cheta/tests/test_units.py ...........                                                                                                                                 [ 88%]
cheta/tests/test_units_reversed.py ...........                                                                                                                        [ 94%]
cheta/tests/test_utils.py ...........                                                                                                                                 [100%]

============================================================================= warnings summary ==============================================================================
cheta/cheta/tests/test_comps.py: 14 warnings
  /proj/sot/ska3/flight/lib/python3.12/site-packages/bs4/builder/_lxml.py:124: DeprecationWarning: The 'strip_cdata' option of HTMLParser() has never done anything and will eventually be removed.
    parser = parser(

cheta/cheta/tests/test_comps.py::test_cmd_states
  /proj/sot/ska3/flight/lib/python3.12/site-packages/setuptools_scm/git.py:312: UserWarning: git archive did not support describe output
    warnings.warn("git archive did not support describe output")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================== 185 passed, 2 skipped, 15 warnings in 146.90s (0:02:26) ==========================================================
ska3-jeanconn-kady> git rev-parse HEAD
2cb5c39aba3a4d77a02722ff7495a97d179710bb
ska3-jeanconn-kady> python -c "import kadi; print(kadi.__version__); import ska_helpers; print(ska_helpers.__version__)"
7.17.5.dev2+gb9bb9d1
0.19.1.dev7+g92558a6

Functional tests

No functional testing.

@taldcroft taldcroft changed the title Improve robustness and retry testing of ephem_stk Update ephem_stk code and testing for kadi.occweb built-in retry Nov 13, 2025
Copy link
Contributor

@jeanconn jeanconn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - it is a bit weird to monkey patch the defaults in ska_helpers to do test_stk_ephem_timeout, but I see where it can work as a convenience in this case since there's no configureable for get_occweb.

@taldcroft
Copy link
Member Author

Yeah, the monkeypatch is a bit odd, but that was sort of my point in the other PR that this should be inconvenient and probably only something done in testing.

@taldcroft taldcroft merged commit 1923e0c into master Nov 14, 2025
2 checks passed
@taldcroft taldcroft deleted the retry-for-stk-ephemeris branch November 14, 2025 16:02
This was referenced Nov 14, 2025
@javierggt javierggt mentioned this pull request Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants