Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure project layout #189

Merged
merged 30 commits into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9d9aee1
Remove benchmarks
pschafhalter Jan 14, 2022
73ed977
Remove benchmarks from Cargo.toml
pschafhalter Jan 14, 2022
12f5949
Setup workspace and move rust code to new folder
pschafhalter Jan 14, 2022
fa510c1
Set up python sub-crate
pschafhalter Jan 14, 2022
6b1dad1
Move rust/python logic to python crate
pschafhalter Jan 14, 2022
4d7defc
Rebase
pschafhalter Jan 14, 2022
f756cf4
Move python docs dir
pschafhalter Jan 15, 2022
6e6aad3
Set rust toolchain
pschafhalter Jan 16, 2022
b7d2a87
Update Dockerfile
pschafhalter Jan 16, 2022
d142f51
Update README
pschafhalter Jan 16, 2022
0656b20
Formatting and remove extra dependencies
pschafhalter Jan 16, 2022
8c20ccf
Work on doc
pschafhalter Jan 16, 2022
df865a6
Remove rustfmt.toml
pschafhalter Jan 16, 2022
00960aa
Update python README
pschafhalter Jan 16, 2022
6b94744
Fix CI
pschafhalter Jan 16, 2022
13fc642
Rename rust-toolchain.toml to rust-toolchain
pschafhalter Jan 16, 2022
31a6d10
CI fixes
pschafhalter Jan 16, 2022
0572b55
Update CI
pschafhalter Jan 16, 2022
b3bffdc
Update docs CI build
pschafhalter Jan 16, 2022
5b01ce7
Fix CI python formatting
pschafhalter Jan 16, 2022
dba9c47
try to make pythondoc fail
pschafhalter Jan 16, 2022
dc1e1d0
Fix lib naming collision
pschafhalter Jan 16, 2022
ecf592f
Add numpy dependency
pschafhalter Jan 16, 2022
29dc078
Try to make python doc CI fail
pschafhalter Jan 16, 2022
ac76fa7
Formatting
pschafhalter Jan 16, 2022
57adc67
Fix yapf version
pschafhalter Jan 16, 2022
e29318e
Fix python CI and update README
pschafhalter Jan 16, 2022
6c0af8a
Update Dockerfile
pschafhalter Jan 17, 2022
b3303a7
Update Dockerfile
pschafhalter Jan 17, 2022
c0d3379
Update gitignore
pschafhalter Jan 17, 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: 9 additions & 13 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install latest Rust nightly
- name: Install supported Rust nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
Expand All @@ -24,10 +24,6 @@ jobs:
components: rustfmt, rust-src
- name: Check Rust formatting
run: cargo fmt -- --check
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Build
run: cargo build --verbose
- name: Run tests
Expand All @@ -38,7 +34,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: ["3.7", "3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- name: Setup python
Expand All @@ -47,19 +43,19 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install setuptools_rust flake8 yapf flake8-quotes
python -m pip install maturin flake8 yapf==0.31.0 flake8-quotes
sukritkalra marked this conversation as resolved.
Show resolved Hide resolved
- name: Check Python formatting
run: |
flake8 --inline-quotes="double" ./doc/
flake8 --inline-quotes="double" ./python/doc/
flake8 --inline-quotes="double" ./python/
yapf --diff --recursive ./doc/
yapf --diff --recursive ./python/doc/
yapf --diff --recursive ./python/
- name: Install latest Rust nightly
- name: Install supported Rust nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
components: rustfmt
components: rustfmt, rust-src
- name: Build
# Building with develop is faster than with install
run: python python/setup.py develop
run: cd python && maturin build
16 changes: 5 additions & 11 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install latest Rust nightly
- name: Install supported Rust nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
components: rustfmt, rust-src
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install Python dependencies
run: python -m pip install fire
- name: Build Documentation
run: cargo doc --all --no-deps

Expand All @@ -35,10 +29,10 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.6
python-version: 3.x
- name: Install Python dependencies
run: python -m pip install -r doc/requirements-doc.txt
run: python -m pip install -r python/doc/requirements-doc.txt
- name: Build Documentation
run: |
cd doc
make html
cd python/doc
make html SPHINXOPTS="-W --keep-going -n"
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Cargo.lock
# Python files
*.egg-info
__pycache__
/env
env
pschafhalter marked this conversation as resolved.
Show resolved Hide resolved
*.pyc
dist
/build
Expand All @@ -22,7 +22,7 @@ dist
*~

# Generated documentation files
/doc/build
/python/doc/build
.idea/
venv/
/doc/source/_build
/python/doc/source/_build
64 changes: 5 additions & 59 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,60 +1,6 @@
[package]
name = "erdos"
version = "0.3.1"
authors = ["The ERDOS Team"]
edition = "2018"
default-run = "erdos"
license = "Apache-2.0"
readme = "README.md"
documentation = "https://docs.rs/crate/erdos/"
repository = "https://github.com/erdos-project/erdos"
description = """
ERDOS is a platform for developing self-driving cars and robotics applications.
"""
keywords = ["data-flow", "robotics", "autonomos", "driving"]
[workspace]

[dependencies]
abomonation = "0.7.3"
abomonation_derive = "0.5.0"
async-trait = "0.1.18"
bincode = "1.3.1"
bytes = "1.0.0"
byteorder = "1.3.4"
clap = "2.33.0"
futures = "0.3.5"
futures-delay-queue = "0.4.2"
futures-intrusive = "0.4" # Required for futures-delay-queue
futures-util = "0.3.5"
petgraph = "0.5.0"
pyo3 = { version = "0.14.3", optional = true }
rand = "0.3"
rosrust = { version = "0.9", optional = true }
rosrust_msg = { version = "0.1", optional = true }
serde = { version = "1.0.115", features = ["derive"] }
tracing = "0.1.29"
tracing-appender = "0.2.0"
tracing-subscriber = "0.3.1"
tokio = { version = "1.8.1", features = ["full"] }
tokio-util = { version = "0.6.7", features = ["codec"] }
tokio-serde-bincode = "0.2.1"
uuid = { version = "0.7", features = ["v4", "v5", "serde"] }

[build-dependencies]
slog = "2.4.2"
slog-term = "2.4.2"

[dev-dependencies]
criterion = "0.3.3"
criterion-macro = "0.3.3"
nix = "0.17.0"

[features]
default = []
python = ["pyo3"] # Target python with 'cargo build --features=python
ros = ["rosrust", "rosrust_msg"] # Add ROS operator support with 'cargo build --features=ros

[lib]
crate-type=["rlib", "cdylib"] # Required for python

[[bench]]
name = "latency"
members = [
"erdos",
"python",
]
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04
FROM ubuntu:20.04

# Set up an erdos user first.
RUN apt-get -y update && apt-get -y install sudo
Expand All @@ -18,18 +18,20 @@ ENV SHELL /bin/bash

SHELL ["/bin/bash", "-c"]

# Instal rust.
# Install rust.
RUN sudo apt-get -y install curl clang python3 python3-pip git
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/home/erdos/.cargo/bin:${PATH}"
RUN rustup default nightly
sukritkalra marked this conversation as resolved.
Show resolved Hide resolved

# Get the erdos directory.
RUN pip3 install setuptools setuptools-rust
RUN mkdir -p /home/erdos/workspace
RUN cd /home/erdos/workspace && git clone https://github.com/erdos-project/erdos.git
WORKDIR /home/erdos/workspace/erdos
RUN cd /home/erdos/workspace/erdos

# Install erdos.
RUN cargo build --release
# Install the python package
RUN python3 python/setup.py install --user
ENV PATH="/home/erdos/.local/bin:${PATH}"
sukritkalra marked this conversation as resolved.
Show resolved Hide resolved
RUN pip3 install -U pip>=21.3
RUN cd python && pip3 install -e .
27 changes: 9 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ If you'd like to contribute to ERDOS, first
[install Rust](https://www.rust-lang.org/tools/install).
Then run the following to clone the repository and build ERDOS:
```console
rustup default nightly # use nightly Rust toolchain
git clone https://github.com/erdos-project/erdos.git && cd erdos
cargo build
```
Expand All @@ -48,34 +47,26 @@ To develop an ERDOS application in Python, simply run

If you'd like to contribute to ERDOS, first
[install Rust](https://www.rust-lang.org/tools/install).
Then run the following to clone the repository and build ERDOS:
Within a [virtual environment](https://docs.python.org/3/tutorial/venv.html),
run the following to clone the repository and build ERDOS:
```console
rustup default nightly # use nightly Rust toolchain
git clone https://github.com/erdos-project/erdos.git && cd erdos
python3 python/setup.py develop
git clone https://github.com/erdos-project/erdos.git && cd erdos/python
pip3 install maturin
sukritkalra marked this conversation as resolved.
Show resolved Hide resolved
maturin develop
```

Python files are available under the `python/` directory, and the Python-Rust
bridge interface is developed under `src/python/`.
The Python-Rust bridge interface is developed in the `python` crate, which
also contains user-facing python files under the `python/erdos` directory.

If you'd like to build ERDOS for release (has better performance, but longer
build times), run `python3 python/setup.py install`.
build times), run `maturin develop --release`.

## Running an example

```console
python3 python/examples/simple_pipeline.py
```

## Build parameters

By default, ERDOS supports up to 20 read streams and 10 write streams in a stream bundle (used to add callbacks across multiple streams; see callback builder in Rust docs for more details).
Some applications may require bundles that support more read and write streams. This can be configured by setting the `ERDOS_BUNDLE_MAX_READ_STREAMS` and `ERDOS_BUNDLE_MAX_WRITE_STREAMS` environment variables when building.

Building ERDOS for the first time may be slow because these parameters result in generated code which dominates the build time.
Subsequent builds should be much faster due to caching unless `build.rs` or the code generation scripts are modified.
In that case, consider setting `ERDOS_BUNDLE_MAX_READ_STREAMS` and `ERDOS_BUNDLE_MAX_WRITE_STREAMS` to speed up builds.

# Writing Applications

ERDOS provides Python and Rust interfaces for developing applications.
Expand Down Expand Up @@ -112,7 +103,7 @@ second of data on small clusters. Therefore, ERDOS is optimized to
send small amounts of data (gigabytes as opposed to terabytes)
as quickly as possible.

ERDOS provides determinisim through **watermarks**. Low watermarks
ERDOS provides determinism through **watermarks**. Low watermarks
are a bound on the age of messages received and operators will ignore
any messages older than the most recent watermark received. By processing
on watermarks, applications can avoid non-determinism from processing
Expand Down
Loading