Skip to content
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.

Commit

Permalink
feat: initial jinad integration
Browse files Browse the repository at this point in the history
  • Loading branch information
imsergiy committed Jan 27, 2021
1 parent 371543b commit c8f3e4b
Show file tree
Hide file tree
Showing 34 changed files with 2,200 additions and 44,484 deletions.
18 changes: 1 addition & 17 deletions dev-resources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,9 @@
This directory includes a variety of development resources to make it easier to build dashboard features in a controlled environment without having to run any Jina instances.

## testserver
The test server has two functions:
1. Record jina flows
2. Simulate jina flows

### Recording Flows
To record, start a Jina flow and make sure the logserver is enabled. The recorder will connect to the corresponding `url` and store the data received from `yaml`, `profile`, and `log` endpoints as defined in `config.js`. To end the recording, type `ctrl+c` and the recorder will generate a JSON file with the data of the session.

To start recording, run:
```bash
node testserver --record
```

You can override config and point to a specific URL using:
```bash
node testserver --record=<CUSTOM_URL>
```
The test server is designed to mock a jinad instance.

### Simulating Flows
Once you have a valid recorded flow, you can play it back via SSE. A local server is started and transmission begins when a request arrives. Events are scheduled for transmission by their `received` property to simulate order and frequency.

To start a flow simulation, run:
```bash
Expand Down
27 changes: 23 additions & 4 deletions dev-resources/config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
module.exports = {
updateStatusInterval: 1000,
jina_version: "0.9.18",
emitter: {
port: 5000,
endpoints: {
log: "/stream/log",
profile: "/stream/profile",
yaml: "/data/yaml",
home: {
path: "/",
method: "GET",
},
status: {
path: "/status",
method: "GET",
},
getFlows: {
path: "/flows",
method: "GET"
}
},
messageInterval: 100,
source: "examples/hello-world-gradual.json"
source: "examples/sample-output.json"
},
recorder: {
url: "http://localhost:5000",
Expand All @@ -28,4 +38,13 @@ module.exports = {
},
},
},
probe: {
url: "http://localhost:5555",
request: {
interval: 1000,
route: "api/index",
method: "post",
data: { "data": ["hello"] }
}
}
};
271 changes: 0 additions & 271 deletions dev-resources/examples/exampleFlows.js

This file was deleted.

Loading

0 comments on commit c8f3e4b

Please sign in to comment.