This repository was archived by the owner on Jul 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Predict functionality #92
Open
zilbermanor
wants to merge
17
commits into
v3io:develoment
Choose a base branch
from
zilbermanor:master
base: develoment
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 15 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
50b8535
- Added '/devices' to get devices list
zilbermanor 9dc1943
- Updated devices logic in company
zilbermanor f50da17
-Added tests for /devices
zilbermanor 9006628
-Added KV Appender to ingestor
zilbermanor 1e7f422
-Dockerfile downloading model from args location
zilbermanor d7685e6
-Prediction function and test
zilbermanor a21f4aa
-predict signature chagne
zilbermanor 33d1801
-Seperated predict and generate
zilbermanor 541094c
Makefile and Readme update
zilbermanor 2a6dc99
Merge branch 'master' of https://github.com/v3io/iguazio_api_examples
zilbermanor ca913c0
-Test update
zilbermanor a2a6f2b
-Readme
zilbermanor f42b0be
-docker fixes
zilbermanor 4156069
-docker fixes
zilbermanor 1812af7
updated README
zilbermanor 00aa81c
netops notebook
zilbermanor a920491
Merge pull request #1 from zilbermanor/netops-notebook
zilbermanor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ This demo generates network data and detects, predicts and visualizes anomalies. | |
3. Nuclio functions that generate and ingest historical and real-time metric samples into the Iguazio TSDB and Anodot | ||
4. Grafana for visualization of metrics | ||
|
||
Setting up an Iguazio system including Grafana and Nuclio is out of the scope of this document. | ||
Setting up an Iguazio system including Grafana and Nuclio is out of the scope of this document. | ||
|
||
## Deploying and running the demo | ||
|
||
|
@@ -20,7 +20,7 @@ helm install v3io-demo/netops \ | |
--set ingest.tsdb.path <tsdb path> | ||
``` | ||
|
||
> Note: To ingest into Anodot, add `--set ingest.anodot.token <anodot token>` to the above. | ||
> Note: To ingest into Anodot, add `--set ingest.anodot.token <anodot token>` to the above. | ||
|
||
The demo is configured with defaults, as can be found in the values.yaml (#REF). You can download and modify these settings and pass `--values <values-file-path>` rather than the `--set` arguments above. The generator is configured through a Kubernetes configmap, so it comes up configured. All we need to do is start the generation, including a day of historical data: | ||
|
||
|
@@ -75,6 +75,15 @@ nuctl deploy --run-image iguaziodocker/netops-demo-py:0.0.5 \ | |
--triggers '{"periodic": {"kind": "cron", "workerAllocatorName": "defaultHTTPWorkerAllocator", "attributes": {"interval": "1s"}}}' \ | ||
--platform-config '{"attributes": {"network":"netops"}}' \ | ||
netops-demo-generate | ||
|
||
nuctl deploy --run-image iguaziodocker/netops-demo-py:0.0.5 \ | ||
--runtime python:3.6 \ | ||
--handler functions.predict.predict:predict \ | ||
--readiness-timeout 10 \ | ||
--platform local \ | ||
--triggers '{"periodic": {"kind": "cron", "workerAllocatorName": "defaultHTTPWorkerAllocator", "attributes": {"interval": "1m"}}}' \ | ||
--platform-config '{"attributes": {"network":"netops"}}' \ | ||
netops-demo-predict | ||
``` | ||
|
||
You can choose to follow the logs by running `docker logs -f default-<function name>`, for example: | ||
|
@@ -157,6 +166,22 @@ We can now start the generation: | |
http localhost:<function port>/start | ||
``` | ||
|
||
By default, the predict function is idling - waiting for configuration. Let's configure it by POSTing the following configuration to `/configure`: | ||
``` | ||
echo ' | ||
{ | ||
'metrics': <metrics array>, | ||
'tsdb': <tsdb server url:proemtheus port>, | ||
'state': 'predicting', | ||
zilbermanor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
'target': "function:netops-demo-ingest" | ||
} | ||
' | http localhost:<function port>/configure | ||
``` | ||
We can now start predicting: | ||
|
||
```sh | ||
http localhost:<function port>/start | ||
``` | ||
## Developing | ||
|
||
### Python (Pycharm) | ||
|
@@ -184,11 +209,10 @@ Modify the source code and build the images: | |
NETOPS_TAG=latest make | ||
``` | ||
|
||
This will output `netops-demo-golang:latest` and `netops-demo-py:latest` using Nuclio's ability to [build function images from Dockerfiles](https://github.com/nuclio/nuclio/blob/master/docs/tasks/deploy-functions-from-dockerfile.md). | ||
> The `golang` image contains the `ingest` and `query` functions. The `py` image contains the `generate` and `train` functions. By bunching together a few functions inside a single image we allow for easily sharing code without worrying about versioning, reducing the number of moving parts, etc. | ||
This will output `netops-demo-golang:latest` and `netops-demo-py:latest` using Nuclio's ability to [build function images from Dockerfiles](https://github.com/nuclio/nuclio/blob/master/docs/tasks/deploy-functions-from-dockerfile.md). | ||
> The `golang` image contains the `ingest` and `query` functions. The `py` image contains the `generate` and `train` functions. By bunching together a few functions inside a single image we allow for easily sharing code without worrying about versioning, reducing the number of moving parts, etc. | ||
|
||
Push the images to your favorite Docker registry: | ||
``` | ||
NETOPS_TAG=latest NETOPS_REGISTRY_URL=mydockerhubaccount make push | ||
``` | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are tons of binary / submodule files added in this PR - please check the changed files and make sure only required files are in |
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+52.7 KB
netops_demo/golang/pkg/darwin_amd64/github.com/v3io/demos/functions/ingest.a
Binary file not shown.
Binary file added
BIN
+36.5 KB
netops_demo/golang/pkg/darwin_amd64/github.com/v3io/demos/functions/ingest/anodot.a
Binary file not shown.
Binary file added
BIN
+28.5 KB
netops_demo/golang/pkg/darwin_amd64/github.com/v3io/demos/vendor/github.com/cespare/xxhash.a
Binary file not shown.
Binary file added
BIN
+110 KB
netops_demo/golang/pkg/darwin_amd64/github.com/v3io/demos/vendor/github.com/ghodss/yaml.a
Binary file not shown.
Binary file added
BIN
+80.6 KB
...o/golang/pkg/darwin_amd64/github.com/v3io/demos/vendor/github.com/nuclio/nuclio-test-go.a
Binary file not shown.
Binary file added
BIN
+164 KB
netops_demo/golang/pkg/darwin_amd64/github.com/v3io/demos/vendor/github.com/nuclio/zap.a
Binary file not shown.
Binary file added
BIN
+35.8 KB
...n_amd64/github.com/v3io/demos/vendor/github.com/nuclio/zap/vendor/github.com/mgutz/ansi.a
Binary file not shown.
Binary file added
BIN
+409 KB
...n_amd64/github.com/v3io/demos/vendor/github.com/nuclio/zap/vendor/github.com/pavius/zap.a
Binary file not shown.
Binary file added
BIN
+25.6 KB
.../github.com/v3io/demos/vendor/github.com/nuclio/zap/vendor/github.com/pavius/zap/buffer.a
Binary file not shown.
Binary file added
BIN
+5.8 KB
...3io/demos/vendor/github.com/nuclio/zap/vendor/github.com/pavius/zap/internal/bufferpool.a
Binary file not shown.
Binary file added
BIN
+7.96 KB
...com/v3io/demos/vendor/github.com/nuclio/zap/vendor/github.com/pavius/zap/internal/color.a
Binary file not shown.
Binary file added
BIN
+6.61 KB
....com/v3io/demos/vendor/github.com/nuclio/zap/vendor/github.com/pavius/zap/internal/exit.a
Binary file not shown.
Binary file added
BIN
+584 KB
...github.com/v3io/demos/vendor/github.com/nuclio/zap/vendor/github.com/pavius/zap/zapcore.a
Binary file not shown.
Binary file added
BIN
+52.4 KB
...n_amd64/github.com/v3io/demos/vendor/github.com/nuclio/zap/vendor/github.com/pkg/errors.a
Binary file not shown.
Binary file added
BIN
+51.9 KB
...rwin_amd64/github.com/v3io/demos/vendor/github.com/nuclio/zap/vendor/go.uber.org/atomic.a
Binary file not shown.
Binary file added
BIN
+29.6 KB
...in_amd64/github.com/v3io/demos/vendor/github.com/nuclio/zap/vendor/go.uber.org/multierr.a
Binary file not shown.
Binary file added
BIN
+51.4 KB
netops_demo/golang/pkg/darwin_amd64/github.com/v3io/demos/vendor/github.com/pkg/errors.a
Binary file not shown.
Binary file added
BIN
+341 KB
...golang/pkg/darwin_amd64/github.com/v3io/demos/vendor/github.com/stretchr/testify/assert.a
Binary file not shown.
Binary file added
BIN
+207 KB
...olang/pkg/darwin_amd64/github.com/v3io/demos/vendor/github.com/stretchr/testify/require.a
Binary file not shown.
Binary file added
BIN
+259 KB
.../golang/pkg/darwin_amd64/github.com/v3io/demos/vendor/github.com/stretchr/testify/suite.a
Binary file not shown.
Binary file added
BIN
+129 KB
...om/v3io/demos/vendor/github.com/stretchr/testify/vendor/github.com/davecgh/go-spew/spew.a
Binary file not shown.
Binary file added
BIN
+92.4 KB
...o/demos/vendor/github.com/stretchr/testify/vendor/github.com/pmezard/go-difflib/difflib.a
Binary file not shown.
Binary file added
BIN
+147 KB
...g/pkg/darwin_amd64/github.com/v3io/demos/vendor/github.com/v3io/v3io-tsdb/pkg/aggregate.a
Binary file not shown.
Binary file added
BIN
+186 KB
...ng/pkg/darwin_amd64/github.com/v3io/demos/vendor/github.com/v3io/v3io-tsdb/pkg/appender.a
Binary file not shown.
Binary file added
BIN
+75.5 KB
...ng/pkg/darwin_amd64/github.com/v3io/demos/vendor/github.com/v3io/v3io-tsdb/pkg/chunkenc.a
Binary file not shown.
Binary file added
BIN
+16.6 KB
...lang/pkg/darwin_amd64/github.com/v3io/demos/vendor/github.com/v3io/v3io-tsdb/pkg/config.a
Binary file not shown.
Binary file added
BIN
+49 KB
...ang/pkg/darwin_amd64/github.com/v3io/demos/vendor/github.com/v3io/v3io-tsdb/pkg/partmgr.a
Binary file not shown.
Binary file added
BIN
+159 KB
...ang/pkg/darwin_amd64/github.com/v3io/demos/vendor/github.com/v3io/v3io-tsdb/pkg/querier.a
Binary file not shown.
Binary file added
BIN
+99.7 KB
...golang/pkg/darwin_amd64/github.com/v3io/demos/vendor/github.com/v3io/v3io-tsdb/pkg/tsdb.a
Binary file not shown.
Binary file added
BIN
+180 KB
...olang/pkg/darwin_amd64/github.com/v3io/demos/vendor/github.com/v3io/v3io-tsdb/pkg/utils.a
Binary file not shown.
Binary file added
BIN
+9.22 KB
netops_demo/golang/pkg/darwin_amd64/github.com/v3io/demos/vendor/golang.org/x/net/context.a
Binary file not shown.
Binary file added
BIN
+11.9 KB
...ps_demo/golang/pkg/darwin_amd64/github.com/v3io/demos/vendor/golang.org/x/sync/errgroup.a
Binary file not shown.
Binary file added
BIN
+652 KB
netops_demo/golang/pkg/darwin_amd64/github.com/v3io/demos/vendor/gopkg.in/yaml.v2.a
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+301 KB
...kg/darwin_amd64/github.com/v3io/v3io-go-http/vendor/github.com/klauspost/compress/flate.a
Binary file not shown.
Binary file added
BIN
+62.1 KB
...pkg/darwin_amd64/github.com/v3io/v3io-go-http/vendor/github.com/klauspost/compress/gzip.a
Binary file not shown.
Binary file added
BIN
+42.4 KB
...pkg/darwin_amd64/github.com/v3io/v3io-go-http/vendor/github.com/klauspost/compress/zlib.a
Binary file not shown.
Binary file added
BIN
+112 KB
.../golang/pkg/darwin_amd64/github.com/v3io/v3io-go-http/vendor/github.com/klauspost/cpuid.a
Binary file not shown.
Binary file added
BIN
+52.3 KB
..._demo/golang/pkg/darwin_amd64/github.com/v3io/v3io-go-http/vendor/github.com/pkg/errors.a
Binary file not shown.
Binary file added
BIN
+37.8 KB
.../pkg/darwin_amd64/github.com/v3io/v3io-go-http/vendor/github.com/valyala/bytebufferpool.a
Binary file not shown.
Binary file added
BIN
+1.32 MB
...golang/pkg/darwin_amd64/github.com/v3io/v3io-go-http/vendor/github.com/valyala/fasthttp.a
Binary file not shown.
Binary file added
BIN
+56.6 KB
...rwin_amd64/github.com/v3io/v3io-go-http/vendor/github.com/valyala/fasthttp/fasthttputil.a
Binary file not shown.
Binary file added
BIN
+31.9 KB
.../darwin_amd64/github.com/v3io/v3io-go-http/vendor/github.com/valyala/fasthttp/stackless.a
Binary file not shown.
Submodule logger
added at
ccc5ab
Submodule nuclio-sdk-go
added at
f750b9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 9 additions & 9 deletions
18
netops_demo/golang/src/github.com/v3io/demos/functions/ingest/anodot/appender.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.