funkyfuture / deck-chores

A job scheduler for Docker containers, configured via labels.
https://deck-chores.readthedocs.io/
ISC License
197 stars 27 forks source link

Issue with checking container StartedAt values #66

Closed zxpower closed 3 years ago

zxpower commented 3 years ago

It could happen that container is started with quite precise timing and its StartedAt returns sting shorter than expeced by inspect_running_containers() function here: https://github.com/funkyfuture/deck-chores/blob/538d9f52b25c18cf36bb4c9aedc97e438fb9ec0e/deck_chores/main.py#L104 therefore causing endless loop of container restarting with this error:

Deck Chores 1.1.7 started.
2021-03-08 14:33:18,567|INFO    |Inspecting running containers.
2021-03-08 14:33:18,628|ERROR   |Caught unhandled exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/deck_chores/main.py", line 300, in main
    last_event_time = inspect_running_containers()
  File "/usr/local/lib/python3.9/site-packages/deck_chores/main.py", line 104, in inspect_running_containers
    datetime.fromisoformat(data['State']['StartedAt'][:26]),  # type: ignore
ValueError: Invalid isoformat string: '2021-03-06T21:58:12.7094Z'

Deck Chores version used: v1.1.7

Suggested actions:

funkyfuture commented 3 years ago

thanks for reporting!