Skip to content

Commit

Permalink
fixed docs and error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
igorrendulic committed Aug 26, 2020
1 parent c4a8c0b commit 4cc661e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 20 deletions.
44 changes: 31 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ video-edge-ai-proxy is an easy to use collection mechanism from multiple cameras
* [Portal usage](#portal-usage)
* [Client usage](#client-usage)
* [Examples](#examples)
* [Example Prerequisites](#example-prerequisites)
* [Running basic_usage.py](#running-basic_usage.py)
* [Running opencv_display.py](#running-opencv_display.py)
* [Running annotation.py](#running-annotation_display.py)
* [Prerequisites](#example-prerequisites)
* [Running basic_usage.py](#example-prerequisites)
* [Running opencv_display.py](#example-prerequisites)
* [Running annotation.py](#example-prerequisites)
* [Running storage_onoff.py](#example-prerequisites)
* [Build](#build)
* [Custom configuration](#custom-configuration)
* [Custom Redis Configuration](#custom-redis-configuration)
Expand Down Expand Up @@ -133,17 +134,10 @@ We're ready to consume frames from RTSP camera. Check the `/examples` folder.

At this point you should have the video-edge-ai-proxy up and running and your first connection to RTSP camera made.



## Examples

### Example Prerequisites

Generate python grpc stubs:
```
make examples
```

Create conda environment:
```
conda env create -f examples/environment.yml
Expand All @@ -152,6 +146,12 @@ conda env create -f examples/environment.yml
Activate environment:
```
conda activate chrysedgeexamples
cd examples
```

Generate python grpc stubs:
```
make examples
```

### Running `basic_usage.py`
Expand Down Expand Up @@ -219,6 +219,21 @@ python annotation.py --device test --type thisistest
```


### Running `storage_onoff.py`

Storage example turn Chrysalis Cloud storage on or off for the current live stream from the cameras.

Run example to turn storage on for camera `test`:
```
python storage_onoff.py --device test --on true
```

Run example to turn storage off for camera `test`:
```
python storage_onoff.py --device test --on false
```


## Build

Building from source code:
Expand All @@ -237,8 +252,11 @@ Default configuration is in the root folder of this project: `./redis.conf`
2. Uncomment volumes section in redis config
```yaml
# volumes:
# - /data/chrysalis/redis:/var/lib/redis
# - $PWD/redis.conf:/usr/local/etc/redis/redis.conf
# - /data/chrysalis/redis:/data
# - ./redis.conf:/usr/local/etc/redis/redis.conf
# command:
# - redis-server
# - /usr/local/etc/redis/redis.conf
```

## Custom Chrysalis configuration
Expand Down
2 changes: 1 addition & 1 deletion server/grpcapi/grpc_annotation_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func (gih *grpcImageHandler) Annotate(ctx context.Context, req *pb.AnnotateReque
return nil, status.Errorf(codes.InvalidArgument, "failed to read settings")
}
if settings.EdgeKey == "" {
return nil, status.Errorf(codes.InvalidArgument, "can't find edge key in settings. Required to use annotations")
return nil, status.Errorf(codes.InvalidArgument, "Can't find edge key in settings. required to use annotations. Visit https://cloud.chryscloud.com to enable annotations and storage capabilities from the edge.")
}
gih.edgeKey = &settings.EdgeKey
}
Expand Down
2 changes: 1 addition & 1 deletion server/grpcapi/grpc_proxy_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (gih *grpcImageHandler) Proxy(ctx context.Context, req *pb.ProxyRequest) (*
return nil, status.Errorf(codes.InvalidArgument, err.Error())
}
if info.RTMPEndpoint == "" && req.Passthrough {
return nil, status.Errorf(codes.InvalidArgument, "device "+deviceID+" doesn't have an associated RTMP stream")
return nil, status.Errorf(codes.InvalidArgument, "device "+deviceID+" doesn't have an associated RTMP stream. Visit https://cloud.chryscloud.com and add a RTMP stream.")
}

valMap := make(map[string]interface{}, 0)
Expand Down
8 changes: 4 additions & 4 deletions server/grpcapi/grpc_storage_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@ func (gih *grpcImageHandler) enableDisableStorageAPICall(storageOn bool, rtmpEnd
Enable: storageOn,
}
if g.Conf.API.Endpoint == "" {
return errors.New("missing Chrysalis API endpoint")
return errors.New("missing Chrysalis Cloud API endpoint in settings")
}

edgeKey, edgeSecret, eErr := gih.settingsManager.GetCurrentEdgeKeyAndSecret()
if eErr != nil {
g.Log.Error("failed to retreive edge key and secret", eErr)
return eErr
g.Log.Error("Can't find edge key and secret. Visit https://cloud.chryscloud.com to enable annotation and storage.", eErr)
return errors.New("Can't find edge key and secret. Visit https://cloud.chryscloud.com to enable annotation and storage.")
}

_, apiErr := gih.edgeService.CallAPIWithBody("PUT", g.Conf.API.Endpoint+"/api/v1/edge/storage/"+key, input, edgeKey, edgeSecret)
if apiErr != nil {
g.Log.Error("failed to call Chrysalis Edge API: ", apiErr)
g.Log.Error("failed to call Chrysalis Cloud API: ", apiErr)
return apiErr
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func startGrpcServer(processService *services.ProcessManager, settingsService *s
grpcServer = grpc.NewServer()

pb.RegisterImageServer(grpcServer, grpcapi.NewGrpcImageHandler(processService, settingsService, edgeService, rdb))
g.Log.Info("Grpc Servier is ready to handle requests at 50001")
g.Log.Info("Grpc Server is ready to handle requests at 50001")
return grpcServer.Serve(grpcConn)
}

Expand Down

0 comments on commit 4cc661e

Please sign in to comment.