Skip to content

Commit aafc8e6

Browse files
authored
Merge pull request #127 from firstbatchxyz/erhant/subcrates
Workspaces
2 parents 68c7719 + 2930830 commit aafc8e6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+750
-420
lines changed

.env.example

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@ DKN_ADMIN_PUBLIC_KEY=0208ef5e65a9c656a6f92fb2c770d5d5e2ecffe02a6aade19207f75110b
1010
DKN_MODELS=
1111

1212
## DRIA (optional) ##
13-
# P2P address, you don't need to change this unless you really want this port.
13+
# P2P address, you don't need to change this unless this port is already in use.
1414
DKN_P2P_LISTEN_ADDR=/ip4/0.0.0.0/tcp/4001
1515
# Comma-separated static relay nodes
1616
DKN_RELAY_NODES=
1717
# Comma-separated static bootstrap nodes
1818
DKN_BOOTSTRAP_NODES=
19-
19+
# Set to a number of seconds to wait before exiting, only use in profiling build!
20+
# Otherwise, leave this empty.
21+
DKN_EXIT_TIMEOUT=
22+
2023
## Open AI (if used, required) ##
2124
OPENAI_API_KEY=
2225

.github/workflows/build_dev_container.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@ on:
33
push:
44
branches: ["master"]
55
paths:
6-
- "src/**"
6+
# Source files in each member
7+
- "compute/src/**"
8+
- "p2p/src/**"
9+
- "workflows/src/**"
10+
# Cargo in each member
11+
- "compute/Cargo.toml"
12+
- "p2p/Cargo.toml"
13+
- "workflows/Cargo.toml"
14+
# root-level changes
715
- "Cargo.lock"
8-
- "Cargo.toml"
16+
- "Cross.toml"
917
- "Dockerfile"
1018
- "compose.yml"
1119

@@ -44,7 +52,7 @@ jobs:
4452

4553
- name: Set Image Tag
4654
id: itag
47-
run: echo "itag=${{ steps.branch.outputs.branch }}-${{ steps.sha.outputs.sha }}-${{ steps.timestamp.outputs.timestamp }}" >> $GITHUB_OUTPUT
55+
run: echo "itag=${{ steps.sha.outputs.branch }}-${{ steps.sha.outputs.sha }}-${{ steps.timestamp.outputs.timestamp }}" >> $GITHUB_OUTPUT
4856

4957
- name: Build and push
5058
uses: docker/build-push-action@v6

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: tests
22

33
on:
4-
# push:
5-
workflow_dispatch:
4+
push:
65
branches:
76
- master
7+
workflow_dispatch:
88

99
jobs:
1010
test:
@@ -18,4 +18,4 @@ jobs:
1818
uses: actions-rust-lang/setup-rust-toolchain@v1
1919

2020
- name: Run tests
21-
run: cargo test
21+
run: cargo test --workspace

Cargo.lock

Lines changed: 33 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 21 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,44 @@
1-
[package]
2-
name = "dkn-compute"
3-
version = "0.2.10"
1+
[workspace]
2+
resolver = "2"
3+
members = ["compute", "p2p", "workflows"]
4+
# compute node is the default member, until Oracle comes in
5+
# then, a Launcher will be the default member
6+
default-members = ["compute"]
7+
8+
[workspace.package]
49
edition = "2021"
10+
version = "0.2.11"
511
license = "Apache-2.0"
612
readme = "README.md"
7-
authors = ["Erhan Tezcan <[email protected]>"]
813

914
# profiling build for flamegraphs
1015
[profile.profiling]
1116
inherits = "release"
1217
debug = true
1318

14-
[features]
15-
# used by flamegraphs & instruments
16-
profiling = []
1719

18-
[dependencies]
20+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
21+
22+
[workspace.dependencies]
23+
# async stuff
1924
tokio-util = { version = "0.7.10", features = ["rt"] }
2025
tokio = { version = "1", features = ["macros", "rt-multi-thread", "signal"] }
21-
parking_lot = "0.12.2"
26+
async-trait = "0.1.81"
27+
28+
# serialize & deserialize
2229
serde = { version = "1.0", features = ["derive"] }
2330
serde_json = "1.0"
24-
async-trait = "0.1.81"
31+
32+
# http client
2533
reqwest = "0.12.5"
2634

27-
# utilities
35+
# env reading
2836
dotenvy = "0.15.7"
29-
base64 = "0.22.0"
30-
hex = "0.4.3"
31-
hex-literal = "0.4.1"
32-
url = "2.5.0"
33-
urlencoding = "2.1.3"
34-
uuid = { version = "1.8.0", features = ["v4"] }
37+
38+
# randomization
3539
rand = "0.8.5"
3640

3741
# logging & errors
3842
env_logger = "0.11.3"
3943
log = "0.4.21"
4044
eyre = "0.6.12"
41-
42-
# encryption (ecies) & signatures (ecdsa) & hashing & bloom-filters
43-
ecies = { version = "0.2", default-features = false, features = ["pure"] }
44-
libsecp256k1 = "0.7.1"
45-
sha2 = "0.10.8"
46-
sha3 = "0.10.8"
47-
fastbloom-rs = "0.5.9"
48-
49-
# workflows
50-
ollama-workflows = { git = "https://github.com/andthattoo/ollama-workflows" }
51-
52-
# peer-to-peer
53-
libp2p = { git = "https://github.com/anilaltuner/rust-libp2p.git", rev = "7ce9f9e", features = [
54-
# libp2p = { version = "0.54.1", features = [
55-
"dcutr",
56-
"ping",
57-
"relay",
58-
"autonat",
59-
"identify",
60-
"tokio",
61-
"gossipsub",
62-
"mdns",
63-
"noise",
64-
"macros",
65-
"tcp",
66-
"yamux",
67-
"quic",
68-
"kad",
69-
] }
70-
libp2p-identity = { version = "0.2.9", features = ["secp256k1"] }
71-
tracing = { version = "0.1.40" }
72-
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
73-
port_check = "0.2.1"
74-
75-
# Vendor OpenSSL so that its easier to build cross-platform packages
76-
[dependencies.openssl]
77-
version = "*"
78-
features = ["vendored"]

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ endif
77
###############################################################################
88
.PHONY: launch # | Run with INFO logs in release mode
99
launch:
10-
RUST_LOG=none,dkn_compute=info cargo run --release
10+
RUST_LOG=none,dkn_compute=info,dkn_workflows=info,dkn_p2p=info cargo run --release
1111

1212
.PHONY: run # | Run with INFO logs
1313
run:
14-
RUST_LOG=none,dkn_compute=info cargo run
14+
RUST_LOG=none,dkn_compute=info,dkn_workflows=info,dkn_p2p=info cargo run
1515

1616
.PHONY: debug # | Run with DEBUG logs with INFO log-level workflows
1717
debug:
18-
RUST_LOG=warn,dkn_compute=debug,ollama_workflows=info cargo run
18+
RUST_LOG=warn,dkn_compute=debug,dkn_workflows=debug,dkn_p2p=debug,ollama_workflows=info cargo run
1919

2020
.PHONY: trace # | Run with TRACE logs
2121
trace:
@@ -27,21 +27,21 @@ build:
2727

2828
.PHONY: profile-cpu # | Profile CPU usage with flamegraph
2929
profile-cpu:
30-
cargo flamegraph --root --profile=profiling --features=profiling
30+
DKN_EXIT_TIMEOUT=120 cargo flamegraph --root --profile=profiling
3131

3232
.PHONY: profile-mem # | Profile memory usage with instruments
3333
profile-mem:
34-
cargo instruments --profile=profiling --features=profiling -t Allocations
34+
DKN_EXIT_TIMEOUT=120 cargo instruments --profile=profiling -t Allocations
3535

3636
###############################################################################
3737
.PHONY: test # | Run tests
3838
test:
39-
cargo test
39+
cargo test --workspace
4040

4141
###############################################################################
4242
.PHONY: lint # | Run linter (clippy)
4343
lint:
44-
cargo clippy
44+
cargo clippy --workspace
4545

4646
.PHONY: format # | Run formatter (cargo fmt)
4747
format:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Compute nodes can technically do any arbitrary task, from computing the square r
3636

3737
- **Ping/Pong**: Dria Admin Node broadcasts **ping** messages at a set interval, it is a required duty of the compute node to respond with a **pong** to these so that they can be included in the list of available nodes for task assignment. These tasks will respect the type of model provided within the pong message, e.g. if a task requires `gpt-4o` and you are running `phi3`, you won't be selected for that task.
3838

39-
- **Workflows**: Each task is given in the form of a workflow, based on [Ollama Workflows](https://github.com/andthattoo/ollama-workflows) (see repository for more information). In simple terms, each workflow defines the agentic behavior of an LLM, all captured in a single JSON file, and can represent things ranging from simple LLM generations to iterative web searching.
39+
- **Workflows**: Each task is given in the form of a workflow, based on [Ollama Workflows](https://github.com/andthattoo/ollama-workflows). In simple terms, each workflow defines the agentic behavior of an LLM, all captured in a single JSON file, and can represent things ranging from simple LLM generations to iterative web searching.
4040

4141
## Node Running
4242

compute/Cargo.toml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[package]
2+
name = "dkn-compute"
3+
version.workspace = true
4+
edition.workspace = true
5+
license.workspace = true
6+
readme = "README.md"
7+
authors = ["Erhan Tezcan <[email protected]>"]
8+
9+
[dependencies]
10+
tokio-util = { version = "0.7.10", features = ["rt"] }
11+
tokio = { version = "1", features = ["macros", "rt-multi-thread", "signal"] }
12+
serde = { version = "1.0", features = ["derive"] }
13+
serde_json = "1.0"
14+
async-trait = "0.1.81"
15+
reqwest = "0.12.5"
16+
17+
# utilities
18+
dotenvy.workspace = true
19+
base64 = "0.22.0"
20+
hex = "0.4.3"
21+
hex-literal = "0.4.1"
22+
url = "2.5.0"
23+
urlencoding = "2.1.3"
24+
uuid = { version = "1.8.0", features = ["v4"] }
25+
26+
port_check = "0.2.1"
27+
28+
# logging & errors
29+
rand.workspace = true
30+
env_logger.workspace = true
31+
log.workspace = true
32+
eyre.workspace = true
33+
tracing = { version = "0.1.40" }
34+
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
35+
36+
# encryption (ecies) & signatures (ecdsa) & hashing & bloom-filters
37+
ecies = { version = "0.2", default-features = false, features = ["pure"] }
38+
libsecp256k1 = "0.7.1"
39+
sha2 = "0.10.8"
40+
sha3 = "0.10.8"
41+
fastbloom-rs = "0.5.9"
42+
43+
# dria subcrates
44+
dkn-p2p = { path = "../p2p" }
45+
dkn-workflows = { path = "../workflows" }
46+
47+
# Vendor OpenSSL so that its easier to build cross-platform packages
48+
[dependencies.openssl]
49+
version = "*"
50+
features = ["vendored"]

0 commit comments

Comments
 (0)