Skip to content

Conversation

@janosh
Copy link
Member

@janosh janosh commented Dec 4, 2025

Normalize timezone-naive datetimes to UTC-aware in Launch._get_time() to prevent
TypeError when subtracting mixed naive/aware datetimes from MongoDB.

Traceback (most recent call last):
  File "/Users/matt/git/periodic-mono/.venv/bin/lpad", line 10, in <module>
    sys.exit(lpad())
             ^^^^^^
  File "/Users/matt/git/periodic-mono/.venv/lib/python3.12/site-packages/fireworks/scripts/lpad_run.py", line 1578, in lpad
    args.func(args)
  File "/Users/matt/git/periodic-mono/.venv/lib/python3.12/site-packages/fireworks/scripts/lpad_run.py", line 503, in detect_lostruns
    fl, ff, fi = lp.detect_lostruns(
                 ^^^^^^^^^^^^^^^^^^^
  File "/Users/matt/git/periodic-mono/.venv/lib/python3.12/site-packages/fireworks/core/launchpad.py", line 1401, in detect_lostruns
    self.mark_fizzled(lid)
  File "/Users/matt/git/periodic-mono/.venv/lib/python3.12/site-packages/fireworks/core/launchpad.py", line 1290, in mark_fizzled
    self.complete_launch(launch_id, state="FIZZLED")
  File "/Users/matt/git/periodic-mono/.venv/lib/python3.12/site-packages/fireworks/core/launchpad.py", line 1572, in complete_launch
    self.launches.find_one_and_replace({"launch_id": m_launch.launch_id}, m_launch.to_db_dict(), upsert=True)
                                                                          ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matt/git/periodic-mono/.venv/lib/python3.12/site-packages/fireworks/utilities/fw_serializers.py", line 153, in _decorator
    m_dict = func(self, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matt/git/periodic-mono/.venv/lib/python3.12/site-packages/fireworks/core/firework.py", line 610, in to_db_dict
    m_d["runtime_secs"] = self.runtime_secs
                          ^^^^^^^^^^^^^^^^^
  File "/Users/matt/git/periodic-mono/.venv/lib/python3.12/site-packages/fireworks/core/firework.py", line 576, in runtime_secs
    return (end - start).total_seconds()
            ~~~~^~~~~~~
TypeError: can't subtract offset-naive and offset-aware datetimes

Normalize timezone-naive datetimes to UTC-aware in _get_time() to prevent
TypeError when subtracting mixed naive/aware datetimes from MongoDB.
@computron computron merged commit ee9d907 into materialsproject:main Dec 5, 2025
4 checks passed
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.

2 participants