Skip to content

Commit

Permalink
python: update suggested version to 3.8.12 (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
waltzofpearls committed Dec 5, 2021
1 parent e0a4b70 commit 533e47f
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
go_version: ["1.16.10"]
python_version: ["3.7.12"]
python_version: ["3.8.12"]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
APP := reckon
PYTHON_VERSION := 3.7.12
PYTHON_VERSION := 3.8.12
GO_VERSION := 1.16.10
GORELEASER_VERSION := 0.174.0
OSX_SDK_VERSION := 11.3
PORT := 8080:8080
PORT := 9999:9999
PROM_CLIENT_URL ?= http://prometheus.rpi.topbass.studio:9090
PROM_EXPORTER_ADDR ?= :8080
PROM_EXPORTER_ADDR ?= :9999
# comma separated list or inline yaml
# WATCH_LIST ?= sensehat_temperature,sensehat_humidity
WATCH_LIST ?= {sensehat_temperature: [Prophet, Tangram], sensehat_humidity: [Prophet, Tangram]}
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ Go, Python and Virtualenv. Make sure you have Go 1.16+ and Python 3.7
- Pyenv: `brew install pyenv` or [follow this guide](https://github.com/pyenv/pyenv#installation)
- Python3.7
- find a Python 3.7 version with `pyenv install -l | grep '^\s*3.7'`
- select a version (eg. `3.7.12`) and install it with `pyenv install 3.7.12`
- switch to the installed version `pyenv global 3.7.12`
- select a version (eg. `3.8.12`) and install it with `pyenv install 3.8.12`
- switch to the installed version `pyenv global 3.8.12`
- Virtualenvwrapper: `pip install virtualenvwrapper` AND [follow this guide](https://virtualenvwrapper.readthedocs.io/en/latest/install.html)

```shell
Expand All @@ -95,7 +95,7 @@ Reckon can be configured with the following environment variables:
| `TIMEZONE` | Yes | `America/Vancouver` | timezone for calculating schedule |
| `WATCH_LIST` | Yes | | metrics to scrape, YAML (model names specified on each metric) or comma separated list (needs `MODELS`) |
| `MODELS` | Yes | `Prophet` | ML models for training and forecasting, required if `WATCH_LIST` is a comma separated list |
| `PROM_EXPORTER_ADDR` | Yes | `:8080` | address for reckon to expose forecasted metrics |
| `PROM_EXPORTER_ADDR` | Yes | `:9999` | address for reckon to expose forecasted metrics |
| `PROM_CLIENT_URL` | Yes | | reckon will scrape metrics from this URL |
| `PROM_CLIENT_TLS_CA` | No | | CA cert if `PROM_CLIENT_URL` is https |
| `PROM_CLIENT_TLS_CERT` | No | | TLS cert if `PROM_CLIENT_URL` is https |
Expand Down Expand Up @@ -163,5 +163,5 @@ Reckon exposes build info through `reckon_build_info`
```
# HELP reckon_build_info Information about reckon build.
# TYPE reckon_build_info gauge
reckon_build_info{commit="c5159d0375d59b0255069eeec3fe3d3ccfe42207",date="2021-11-24T08:05:34Z",go_version="1.16.10",goreleaser_version="0.174.0",python_version="3.7.12",version="0.5.2"} 1
reckon_build_info{commit="c5159d0375d59b0255069eeec3fe3d3ccfe42207",date="2021-11-24T08:05:34Z",go_version="1.16.10",goreleaser_version="0.174.0",python_version="3.8.12",version="0.5.2"} 1
```
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Config struct {
Schedule string `envconfig:"SCHEDULE" default:"@every 120m"`
Timezone string `envconfig:"TIMEZONE" default:"America/Vancouver"`

PromExporterAddr string `envconfig:"PROM_EXPORTER_ADDR" default:":8080"`
PromExporterAddr string `envconfig:"PROM_EXPORTER_ADDR" default:":9999"`

PromClientURL string `envconfig:"PROM_CLIENT_URL"`
PromClientTLSCA string `envconfig:"PROM_CLIENT_TLS_CA"`
Expand Down
2 changes: 1 addition & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestConfigLoad(t *testing.T) {
// from default values
Schedule: "@every 120m",
Timezone: "America/Vancouver",
PromExporterAddr: ":8080",
PromExporterAddr: ":9999",
Models: []string{"Prophet"},
DefaultChunkSize: 120 * time.Minute,
GRPCServerAddress: "localhost:18443",
Expand Down
2 changes: 2 additions & 0 deletions metric/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ func (s *Scheduler) Start(ctx context.Context) func() error {
}()
})
}); err != nil {
s.logger.Error("failed to schedule cron job",
zap.String("schedule", s.config.Schedule), zap.Error(err))
return err
}

Expand Down
2 changes: 2 additions & 0 deletions model/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ matplotlib==3.4.2
numpy==1.21.0
pandas==1.3.0
Pillow==8.3.2
plotly==5.4.0
protobuf==3.19.1
PyMeeus==0.5.11
pyparsing==2.4.7
Expand All @@ -22,5 +23,6 @@ python-json-logger==2.0.2
pytz==2021.1
setuptools-git==1.2
six==1.16.0
tenacity==8.0.1
tqdm==4.61.1
ujson==4.0.2
4 changes: 3 additions & 1 deletion prom/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func (e *Exporter) Start(ctx context.Context) func() error {
addrField := zap.String("addr", e.config.PromExporterAddr)
e.logger.Info("starting prometheus exporter server...", addrField)
if err := e.server.ListenAndServe(); err != http.ErrServerClosed {
e.logger.Error("prometheus exporter server stopped", zap.Error(err))
return fmt.Errorf("prometheus exporter server stopped: %w", err)
}
e.logger.Info("prometheus exporter server stopped", addrField)
Expand All @@ -56,7 +57,8 @@ func (e *Exporter) Shutdown(ctx context.Context) func() error {
defer cancel()

if err := e.server.Shutdown(timeout); err != nil {
err = fmt.Errorf("failed to gracefully stop prometheus exporter server: %w", err)
e.logger.Error("failed to gracefully stop prometheus exporter server", zap.Error(err))
return fmt.Errorf("failed to gracefully stop prometheus exporter server: %w", err)
}
return nil
}
Expand Down

0 comments on commit 533e47f

Please sign in to comment.