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

siri requester should have better error handling and retry mechanism in case source data is not available #368

Open
OriHoch opened this issue Jan 18, 2022 · 3 comments
Assignees

Comments

@OriHoch
Copy link

OriHoch commented Jan 18, 2022

currently, if source data is not available, siri requester daemon exits with exception and the pod enters a restart loop until it gives up

need to have better handling of this, so it retries until we get a response

Traceback (most recent call last):
  File "/usr/local/bin/open-bus-siri-requester", line 33, in <module>
    sys.exit(load_entry_point('open-bus-siri-requester', 'console_scripts', 'open-bus-siri-requester')())
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/srv/open_bus_siri_requester/cli.py", line 56, in daemon_start
    daemon.start()
  File "/srv/open_bus_siri_requester/daemon.py", line 46, in start
    run_single_iteration(now, last_cleanup_datetime)
  File "/srv/open_bus_siri_requester/daemon.py", line 19, in run_single_iteration
    snapshot_id = store_callback(requester_callback(), now, upload=True)
  File "/srv/open_bus_siri_requester/requester.py", line 45, in request
    return requests.get(
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
@OriHoch OriHoch self-assigned this Jan 18, 2022
@OriHoch
Copy link
Author

OriHoch commented Jan 18, 2022

in case siri source is not available we should try the "test" source - see comment - #367 (comment)

@OriHoch
Copy link
Author

OriHoch commented Jan 19, 2022

additional info from MOT:

בשלב הזה, אני מציע, שתבצעו ניסיון נוסף רק על מקרה של סטטוס http שגוי מסביבת הייצור

אכן המקרה של תשובה ריקה אינו טרווילי, אם כי גם לזה אפשר לנסות לתת מענה.

בתשובה של snapshot יש

"ResponseTimestamp":"2021-10-12T13:38:30+03:00"

אם הזמן שמתקבל הוא נניח יותר משתי דקות, אז זה אומר שלא בוצע תהליך יצירה של מידע חדש, ואז אפשר לבצע ניסיון לפניה לסביבת הייצור.

צריך לקחת בחשבון, שלמערכת שלנו יש לא רק השבתות אלא גם תקלות. שתי הבדיקות והללו וניסיון נוסף למול סביבת הבדיקות יעלה את זמינות המערכת מאוד.

@OriHoch
Copy link
Author

OriHoch commented Feb 9, 2022

fixed in hasadna/open-bus-siri-requester#5

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

No branches or pull requests

1 participant