Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
2b94805
bennaaym/labgraph_monitor: set up typescript template for labgraph mo…
bennaaym Feb 10, 2022
5b2cc11
bennaaym/labgraph_monitor: graph layout set up using mock data
bennaaym Feb 11, 2022
80c42a9
bennaaym/labgraph_monitor: organize the graph layout using dagre
bennaaym Feb 11, 2022
a411e88
bennaaym/labgraph_monitor: graph style updated
bennaaym Feb 11, 2022
712a69b
bennaaym/labgraph_monitor: SettingPanel initial implementation
bennaaym Feb 11, 2022
7289e37
bennaaym/labgraph_monitor: SettingPanel updated
bennaaym Feb 11, 2022
ac5d453
bennaaym/labgraph_monitor: UIContext implemented
bennaaym Feb 12, 2022
f1a115f
bennaaym/labgraph_monitor: GraphSettings component initial implementa…
bennaaym Feb 13, 2022
32c99de
bennaaym/labgraph_monitor: mock examples added
bennaaym Feb 13, 2022
2220577
bennaaym/labgraph_monitor: GraphSettings connect form added
bennaaym Feb 13, 2022
377aed5
bennaaym/labgraph_monitor: websocket connection set up with the backe…
bennaaym Feb 14, 2022
41de247
bennaaym/labgraph_monitor: optimize rendering, render only if the pre…
bennaaym Feb 14, 2022
26c8022
bennaaym/labgraph_monitor: NodeSetting, EdgeSetting comonent updated …
bennaaym Feb 15, 2022
a689772
bennaaym/labgraph_monitor: EdgeSetting component updated
bennaaym Feb 15, 2022
033ee90
bennaaym/labgraph_monitor: migrate ConfigContext to redux store
bennaaym Feb 16, 2022
56327cb
bennaaym/labgraph_monitor: migrating WSContext to redux store
bennaaym Feb 16, 2022
203f52e
bennaaym/labgraph_monitor: copyright header added
bennaaym Feb 16, 2022
cc5529e
bennaaym/labgraph: updated .husky script to detect changes only insid…
bennaaym Feb 16, 2022
09598cf
bennaaym/labgraph_monitor: first unittest added, test Home component
bennaaym Feb 18, 2022
b421b4a
bennaaym/labgraph_monitor: unittest added
bennaaym Feb 18, 2022
b72e544
bennaaym/labgraph_monitor: adding documentation comments
bennaaym Feb 18, 2022
8e68cb5
bennaaym/labgraph_monitor: README updated
bennaaym Feb 18, 2022
1983088
bennaaym/labgraph: update from graph/ to Graph/ issue resolved
bennaaym Feb 18, 2022
0666023
bennaaym/labgraph_monitor: github action added
bennaaym Feb 18, 2022
538147a
Delete extensions/prototypes/labgraph_monitor/src/components/graph di…
bennaaym Feb 18, 2022
3bb54ee
Delete extensions/prototypes/labgraph_monitor/src/pages/home directory
bennaaym Mar 2, 2022
b3c97de
bennaaym/labgraph_monitor: directories refactored, README updated, ty…
bennaaym Mar 12, 2022
4739bd6
bennaaym/labgraph_monitor: WSContext updated
bennaaym Mar 12, 2022
64c8342
bennaaym/labgraph_monitor: github action updated
bennaaym Mar 12, 2022
5938270
bennaaym/labgraph_monitor: public/ updated
bennaaym Mar 12, 2022
3d2d640
bennaaym/labgraph_monitor: get rid of inline-style | add interface fo…
bennaaym Mar 12, 2022
2668d5c
Launch Signal Processing folder with examples.
jfResearchEng Mar 20, 2022
dbd9f51
Update for Dockerfile instructions.
jfResearchEng Mar 23, 2022
f4d97a3
Remove Signal Processing V0 code.
jfResearchEng Mar 23, 2022
e0911bc
Update for typing_extensions
jfResearchEng Mar 23, 2022
b25db24
Add dependency on kiwisolver and cppy.
jfResearchEng Mar 23, 2022
61384d5
Updates for kiwisolver.
jfResearchEng Mar 23, 2022
cf7cb60
Updates for cppy.
jfResearchEng Mar 23, 2022
6babf64
WIP real-time messaging example
dtemir Mar 25, 2022
b4a1c8c
WIP updated serialized message representation
dtemir Mar 25, 2022
1554008
Merge pull request #65 from facebookresearch/signal_processing
jfResearchEng Mar 28, 2022
8af468a
Rename README to README.md
jfResearchEng Mar 28, 2022
3db857e
Update README file type.
jfResearchEng Mar 28, 2022
a5cb283
Update README.md
jfResearchEng Mar 28, 2022
5f7368d
Add main contributors in README
jfResearchEng Mar 28, 2022
0f53f64
Merge pull request #66 from facebookresearch/signal-processing-docs-u…
jfResearchEng Mar 28, 2022
f9af520
WIP separated real-time messaging example from lg_monitor_server.py
dtemir Mar 28, 2022
1e578c9
Update name for main contributors.
jfResearchEng Mar 28, 2022
4814e08
Merge pull request #67 from facebookresearch/signal-processing-readme…
jfResearchEng Mar 28, 2022
33b07e4
WIP updated documentation and function names
dtemir Mar 29, 2022
34fc145
WIP updated labgraph monitor example
dtemir Mar 29, 2022
3658f8d
Merge pull request #58 from bennaaym/bennaaym/yaml_support
jfResearchEng Apr 3, 2022
adf27ac
Merge pull request #60 from bennaaym/bennaaym/labgraph_monitor
jfResearchEng Apr 3, 2022
40c5126
updated graphviz demo graph for work with labgraph monitor
dtemir Apr 3, 2022
76e1119
matched subscriber topic paths with their publishers
dtemir Apr 8, 2022
5dd7a2d
added code review suggestions
dtemir Apr 9, 2022
ff2b8ec
Merge branch 'facebookresearch:main' into real_time_messages
dtemir Apr 9, 2022
05a3937
updated labgraph monitor readme and fixed test cases
dtemir Apr 10, 2022
c33de90
built a LabgraphMonitor facade for entry point
dtemir Apr 14, 2022
6151edf
added Facebook Rights Reserved
dtemir Apr 14, 2022
4751118
updated labgraph monitor readme
dtemir Apr 18, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/labgraph_monitor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: |
cd extensions/prototypes/labgraph_monitor
yarn
- name: Run labgraph_monitor tests
run: |
cd extensions/prototypes/labgraph_monitor
yarn test --watchAll=false
yarn build
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
FROM quay.io/pypa/manylinux2014_x86_64

# Install devtoolset-9
RUN yum update -y
RUN yum install -y centos-release-scl
RUN yum install -y devtoolset-9
RUN echo "source /opt/rh/devtoolset-9/enable" >> /etc/bashrc
Expand Down
33 changes: 22 additions & 11 deletions extensions/graphviz_support/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Graphviz for LabGraph graphs

This extension provides an API to generate a graphviz visualization of the LabGraph topology.
This extension provides an API to generate a [graphviz](https://graphviz.org/) visualization of the LabGraph topology.

## Quick Start

Expand All @@ -23,22 +23,33 @@ python setup.py install

To make sure things are working:

1- Move to the root of the LabGraph directory:
```
labgraph\extensions\graphviz_support> cd ../..
1. Move to the root of the LabGraph directory:

```bash
labgraph/extensions/graphviz_support> cd ../..
labgraph>
```
2- Run the following test
```
2. Run the following test

```bash
python -m extensions.graphviz_support.graphviz_support.tests.test_lg_graphviz_api
```
**The output of the file for this test can be found at:**\
extensions\graphviz_support\graphviz_support\tests\output

**The output of the file for this test can be found at:**

`extensions/graphviz_support/graphviz_support/tests/output/test.svg`

### Generating a graphviz file

To generate a graph visualization just call 'generate_graphviz' function and pass the appropriate parameters
```
from extensions/graphviz_support/graphviz_support/generate_graphviz/generate_graphviz.py import generate_graphviz.py

generate_graphviz(graph, output_file)
```python
from extensions.graphviz_support.graphviz_support.generate_graphviz.generate_graphviz import generate_graphviz
from extensions.graphviz_support.graphviz_support.tests.demo_graph.demo import Demo

generate_graphviz(Demo(), "output.png") # you can also use "output.svg"
```

**It will produce the following diagram named `output.png` in your current directory:**

![Graphviz diagram for nodes: RollingAverager, NoiseGenerator, Amplifier, Sink, and Attenuator](https://i.imgur.com/M4yL39x.png)
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ class AmplifierConfig(lg.Config):


class Amplifier(lg.Node):
INPUT = lg.Topic(RandomMessage)
OUTPUT = lg.Topic(RandomMessage)
AMPLIFIER_INPUT = lg.Topic(RandomMessage)
AMPLIFIER_OUTPUT = lg.Topic(RandomMessage)
config: AmplifierConfig

def output(self, _in: float) -> float:
return self.config.out_in_ratio * _in

@lg.subscriber(INPUT)
@lg.publisher(OUTPUT)
@lg.subscriber(AMPLIFIER_INPUT)
@lg.publisher(AMPLIFIER_OUTPUT)
async def amplify(self, message: RandomMessage) -> lg.AsyncPublisher:
current_time = time.time()
output_data = np.array(
[self.output(_in) for _in in message.data]
)
yield self.OUTPUT, RandomMessage(
yield self.AMPLIFIER_OUTPUT, RandomMessage(
timestamp=current_time, data=output_data
)
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ class AttenuatorConfig(lg.Config):


class Attenuator(lg.Node):
INPUT = lg.Topic(RandomMessage)
OUTPUT = lg.Topic(RandomMessage)
ATTENUATOR_INPUT = lg.Topic(RandomMessage)
ATTENUATOR_OUTPUT = lg.Topic(RandomMessage)
config: AttenuatorConfig

def output(self, _in: float) -> float:
return pow(10, (self.config.attenuation / 20)) * _in

@lg.subscriber(INPUT)
@lg.publisher(OUTPUT)
@lg.subscriber(ATTENUATOR_INPUT)
@lg.publisher(ATTENUATOR_OUTPUT)
async def attenuate(self, message: RandomMessage) -> lg.AsyncPublisher:
current_time = time.time()
output_data = np.array(
[self.output(_in) for _in in message.data]
)
yield self.OUTPUT, RandomMessage(
yield self.ATTENUATOR_OUTPUT, RandomMessage(
timestamp=current_time, data=output_data
)
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ def setup(self) -> None:

def connections(self) -> lg.Connections:
return (
(self.NOISE_GENERATOR.OUTPUT, self.ROLLING_AVERAGER.INPUT),
(self.NOISE_GENERATOR.OUTPUT, self.AMPLIFIER.INPUT),
(self.NOISE_GENERATOR.OUTPUT, self.ATTENUATOR.INPUT),
(self.ROLLING_AVERAGER.OUTPUT, self.SINK.INPUT_1),
(self.AMPLIFIER.OUTPUT, self.SINK.INPUT_2),
(self.ATTENUATOR.OUTPUT, self.SINK.INPUT_3),
(self.NOISE_GENERATOR.NOISE_GENERATOR_OUTPUT, self.ROLLING_AVERAGER.ROLLING_AVERAGER_INPUT),
(self.NOISE_GENERATOR.NOISE_GENERATOR_OUTPUT, self.AMPLIFIER.AMPLIFIER_INPUT),
(self.NOISE_GENERATOR.NOISE_GENERATOR_OUTPUT, self.ATTENUATOR.ATTENUATOR_INPUT),
(self.ROLLING_AVERAGER.ROLLING_AVERAGER_OUTPUT, self.SINK.SINK_INPUT_1),
(self.AMPLIFIER.AMPLIFIER_OUTPUT, self.SINK.SINK_INPUT_2),
(self.ATTENUATOR.ATTENUATOR_OUTPUT, self.SINK.SINK_INPUT_3),
)

def process_modules(self) -> Tuple[lg.Module, ...]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ class NoiseGeneratorConfig(lg.Config):


class NoiseGenerator(lg.Node):
OUTPUT = lg.Topic(RandomMessage)
NOISE_GENERATOR_OUTPUT = lg.Topic(RandomMessage)
config: NoiseGeneratorConfig

@lg.publisher(OUTPUT)
@lg.publisher(NOISE_GENERATOR_OUTPUT)
async def generate_noise(self) -> lg.AsyncPublisher:
while True:
yield self.OUTPUT, RandomMessage(
yield self.NOISE_GENERATOR_OUTPUT, RandomMessage(
timestamp=time.time(),
data=np.random.rand(self.config.num_features)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ class RollingConfig(lg.Config):


class RollingAverager(lg.Node):
INPUT = lg.Topic(RandomMessage)
OUTPUT = lg.Topic(RandomMessage)
ROLLING_AVERAGER_INPUT = lg.Topic(RandomMessage)
ROLLING_AVERAGER_OUTPUT = lg.Topic(RandomMessage)

state: RollingState
config: RollingConfig

@lg.subscriber(INPUT)
@lg.publisher(OUTPUT)
@lg.subscriber(ROLLING_AVERAGER_INPUT)
@lg.publisher(ROLLING_AVERAGER_OUTPUT)
async def average(self, message: RandomMessage) -> lg.AsyncPublisher:
current_time = time.time()
self.state.messages.append(message)
Expand All @@ -40,7 +40,7 @@ async def average(self, message: RandomMessage) -> lg.AsyncPublisher:
[message.data for message in self.state.messages]
)
mean_data = np.mean(all_data, axis=0)
yield self.OUTPUT, RandomMessage(
yield self.ROLLING_AVERAGER_OUTPUT, RandomMessage(
timestamp=current_time,
data=mean_data
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ class SinkState(lg.State):


class Sink(lg.Node):
INPUT_1 = lg.Topic(RandomMessage)
INPUT_2 = lg.Topic(RandomMessage)
INPUT_3 = lg.Topic(RandomMessage)
SINK_INPUT_1 = lg.Topic(RandomMessage)
SINK_INPUT_2 = lg.Topic(RandomMessage)
SINK_INPUT_3 = lg.Topic(RandomMessage)
state: SinkState

@lg.subscriber(INPUT_1)
@lg.subscriber(SINK_INPUT_1)
def got_message(self, message: RandomMessage) -> None:
self.state.data_1 = message.data

@lg.subscriber(INPUT_2)
@lg.subscriber(SINK_INPUT_2)
def got_message_2(self, message: RandomMessage) -> None:
self.state.data_2 = message.data

@lg.subscriber(INPUT_3)
@lg.subscriber(SINK_INPUT_3)
def got_message_3(self, message: RandomMessage) -> None:
self.state.data_3 = message.data

Expand Down
17 changes: 17 additions & 0 deletions extensions/graphviz_support/graphviz_support/tests/output/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
digraph Demo {
center=true rankdir=LR
node [fontsize=12 height=1.5 shape=circle width=1.5]
NoiseGenerator
RollingAverager
Amplifier
Attenuator
Sink
Sink
Sink
NoiseGenerator -> RollingAverager
NoiseGenerator -> Amplifier
NoiseGenerator -> Attenuator
RollingAverager -> Sink
Amplifier -> Sink
Attenuator -> Sink
}
79 changes: 79 additions & 0 deletions extensions/graphviz_support/graphviz_support/tests/output/test.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -33,47 +33,47 @@ def test_out_edge_node_mapper(self) -> None:
self.assertEqual(4, len(out_edge_node_map))
self.assertEqual(
'generate_noise',
out_edge_node_map['NOISE_GENERATOR/OUTPUT'].name
out_edge_node_map['NOISE_GENERATOR/NOISE_GENERATOR_OUTPUT'].name
)
self.assertEqual(
'average',
out_edge_node_map['ROLLING_AVERAGER/OUTPUT'].name
out_edge_node_map['ROLLING_AVERAGER/ROLLING_AVERAGER_OUTPUT'].name
)
self.assertEqual(
'amplify',
out_edge_node_map['AMPLIFIER/OUTPUT'].name
out_edge_node_map['AMPLIFIER/AMPLIFIER_OUTPUT'].name
)
self.assertEqual(
'attenuate',
out_edge_node_map['ATTENUATOR/OUTPUT'].name
out_edge_node_map['ATTENUATOR/ATTENUATOR_OUTPUT'].name
)

def test_in_out_edge_mapper(self) -> None:
in_out_edge_map = in_out_edge_mapper(self.graph.__streams__.values())
self.assertEqual(6, len(in_out_edge_map))
self.assertEqual(
'NOISE_GENERATOR/OUTPUT',
in_out_edge_map['ROLLING_AVERAGER/INPUT']
'NOISE_GENERATOR/NOISE_GENERATOR_OUTPUT',
in_out_edge_map['ROLLING_AVERAGER/ROLLING_AVERAGER_INPUT']
)
self.assertEqual(
'NOISE_GENERATOR/OUTPUT',
in_out_edge_map['AMPLIFIER/INPUT']
'NOISE_GENERATOR/NOISE_GENERATOR_OUTPUT',
in_out_edge_map['AMPLIFIER/AMPLIFIER_INPUT']
)
self.assertEqual(
'NOISE_GENERATOR/OUTPUT',
in_out_edge_map['ATTENUATOR/INPUT']
'NOISE_GENERATOR/NOISE_GENERATOR_OUTPUT',
in_out_edge_map['ATTENUATOR/ATTENUATOR_INPUT']
)
self.assertEqual(
'ROLLING_AVERAGER/OUTPUT',
in_out_edge_map['SINK/INPUT_1']
'ROLLING_AVERAGER/ROLLING_AVERAGER_OUTPUT',
in_out_edge_map['SINK/SINK_INPUT_1']
)
self.assertEqual(
'AMPLIFIER/OUTPUT',
in_out_edge_map['SINK/INPUT_2']
'AMPLIFIER/AMPLIFIER_OUTPUT',
in_out_edge_map['SINK/SINK_INPUT_2']
)
self.assertEqual(
'ATTENUATOR/OUTPUT',
in_out_edge_map['SINK/INPUT_3']
'ATTENUATOR/ATTENUATOR_OUTPUT',
in_out_edge_map['SINK/SINK_INPUT_3']
)

def test_connect_to_upstream(self) -> None:
Expand Down
2 changes: 2 additions & 0 deletions extensions/prototypes/labgraph_monitor/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
public
Loading