GreenScheduler / cats

CATS: the Climate-Aware Task Scheduler :cat2: :tiger2: :leopard:
https://greenscheduler.github.io/cats/
MIT License
50 stars 8 forks source link

Errors when duration close to 48h #99

Closed abhidg closed 3 months ago

abhidg commented 4 months ago
> cats -d 2820 --loc OX1
WARNING:root:config file not found
WARNING:root:Unspecified carbon intensity forecast service, using carbonintensity.org.uk
Traceback (most recent call last):
  File "/Users/abhidg/.local/bin/cats", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/abhidg/.local/pipx/venvs/climate-aware-task-scheduler/lib/python3.12/site-packages/cats/__init__.py", line 284, in main
    now_avg, best_avg = get_avg_estimates(CI_forecast, duration=duration)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/abhidg/.local/pipx/venvs/climate-aware-task-scheduler/lib/python3.12/site-packages/cats/optimise_starttime.py", line 26, in get_avg_estimates
    return wf[0], min(wf)
                  ^^^^^^^
ValueError: min() iterable argument is empty
> cats -d 2860 --loc OX1
WARNING:root:config file not found
WARNING:root:Unspecified carbon intensity forecast service, using carbonintensity.org.uk
Traceback (most recent call last):
  File "/Users/abhidg/.local/bin/cats", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/abhidg/.local/pipx/venvs/climate-aware-task-scheduler/lib/python3.12/site-packages/cats/__init__.py", line 284, in main
    now_avg, best_avg = get_avg_estimates(CI_forecast, duration=duration)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/abhidg/.local/pipx/venvs/climate-aware-task-scheduler/lib/python3.12/site-packages/cats/optimise_starttime.py", line 25, in get_avg_estimates
    wf = WindowedForecast(data, duration, start=datetime.now().astimezone())
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/abhidg/.local/pipx/venvs/climate-aware-task-scheduler/lib/python3.12/site-packages/cats/forecast.py", line 68, in __init__
    self.ndata = bisect_left(self.data, self.end) + 1
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

Durations below 2810 work fine - this of course may vary depending on the forecast carbon intensity. I have cached the output from the API: carbonIntensityOX1_2024-05-20T1201Z.json