Support other APIs and metric types using a new providers interface#196
Support other APIs and metric types using a new providers interface#196abhidg wants to merge 16 commits into
Conversation
ec6aae4 to
4c59ac1
Compare
4c59ac1 to
4a93af2
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #196 +/- ##
==========================================
+ Coverage 87.17% 87.83% +0.65%
==========================================
Files 20 22 +2
Lines 1092 1192 +100
==========================================
+ Hits 952 1047 +95
- Misses 140 145 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
andreww
left a comment
There was a problem hiding this comment.
Happy overall. Probably worth briefly thinking about the location / time aspect of the API. Does this also close some further issues (e.g. renaming CI modules)? If so worth making sure we capture these.
| ----------------- | ||
|
|
||
| This module provides the base provider class from which all API providers for | ||
| CATS are derived from. To define a new provider, create a new class derived from |
There was a problem hiding this comment.
We should probably create space in the documentation for how to do this. Happy to write it as I work out how (probably via wattnet) or you can put a stub in place as part of this PR.
|
The readthedocs and cluster-tests failures look like they linked. Both report not being able to import "cats.providers", but I cannot immediately reproduce locally. |
6acfb37 to
5cdf627
Compare
5cdf627 to
1a3b160
Compare
1a3b160 to
6d6402d
Compare
This PR adds a providers interface that replaces the current
CI_api_queryandCI_api_interfaceclasses. The advantage of the new approach is that it allows further customisation of the provider rather than customising the URL; this is useful to support providers that might need us to interface directly with a databases or with HTTP APIs requiring authentication. New types (Timeseries) have been added to support not just carbon intensity, but any other type of forecast timeseries with customizable units.Other changes:
cats.exceptions) which allows us to consolidate error handling in one place (main()) as well as providing type based checking--save-plotto save plots to fileRemaining refactor would be to move configuration parsing and error handling out of cats/cli.py, this will be done in a subsequent PR.