Skip to content

Commit 4e945ee

Browse files
committed
feat: enhance flow initialization with Kafka topic creation and optimize producer configurations
1 parent 2f8da15 commit 4e945ee

31 files changed

Lines changed: 175 additions & 49 deletions

File tree

.changeset/pre.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"rude-parts-heal",
3333
"sixty-humans-smile",
3434
"tiny-things-report",
35-
"tired-days-sleep"
35+
"tired-days-sleep",
36+
"tough-rice-spend"
3637
]
3738
}

apps/chaingraph-backend/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @badaitech/chaingraph-backend
22

3+
## 0.5.5-dev.19
4+
5+
### Patch Changes
6+
7+
- feat: enhance flow initialization with Kafka topic creation and optimize producer configurations
8+
39
## 0.5.5-dev.18
410

511
### Patch Changes

apps/chaingraph-backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@badaitech/chaingraph-backend",
33
"type": "module",
4-
"version": "0.5.5-dev.18",
4+
"version": "0.5.5-dev.19",
55
"private": false,
66
"description": "Backend server for the Chaingraph project",
77
"license": "BUSL-1.1",

apps/chaingraph-execution-api/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# @badaitech/chaingraph-execution-api
22

3+
## 0.5.5-dev.19
4+
5+
### Patch Changes
6+
7+
- feat: enhance flow initialization with Kafka topic creation and optimize producer configurations
8+
- Updated dependencies
9+
- @badaitech/chaingraph-executor@0.5.5-dev.19
10+
- @badaitech/chaingraph-types@0.5.5-dev.19
11+
- @badaitech/chaingraph-trpc@0.5.5-dev.19
12+
313
## 0.5.5-dev.18
414

515
### Patch Changes

apps/chaingraph-execution-api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@badaitech/chaingraph-execution-api",
33
"type": "module",
4-
"version": "0.5.5-dev.18",
4+
"version": "0.5.5-dev.19",
55
"private": false,
66
"description": "Chaingraph tRPC Server - Scalable API server for Chaingraph execution management",
77
"license": "BUSL-1.1",

apps/chaingraph-execution-worker/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# @badaitech/chaingraph-execution-worker
22

3+
## 0.5.5-dev.19
4+
5+
### Patch Changes
6+
7+
- feat: enhance flow initialization with Kafka topic creation and optimize producer configurations
8+
- Updated dependencies
9+
- @badaitech/chaingraph-executor@0.5.5-dev.19
10+
- @badaitech/chaingraph-nodes@0.5.5-dev.19
11+
- @badaitech/chaingraph-types@0.5.5-dev.19
12+
- @badaitech/chaingraph-trpc@0.5.5-dev.19
13+
314
## 0.5.5-dev.18
415

516
### Patch Changes

apps/chaingraph-execution-worker/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@badaitech/chaingraph-execution-worker",
33
"type": "module",
4-
"version": "0.5.5-dev.18",
4+
"version": "0.5.5-dev.19",
55
"private": false,
66
"description": "Chaingraph Execution Worker Service which connected to Kafka and process the flow executions",
77
"license": "BUSL-1.1",

apps/chaingraph-execution-worker/src/index.ts

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,36 @@
88

99
import cluster from 'node:cluster'
1010
import process from 'node:process'
11+
import { createTopicsIfNotExist } from '@badaitech/chaingraph-executor/server'
1112
import { config } from './config'
1213
import { logger } from './logger'
1314
import { startMaster } from './master'
1415
import { startWorker } from './worker'
1516

1617
// Determine if this is the master process or a worker
17-
if (cluster.isPrimary) {
18-
logger.info('🚀 Starting Chaingraph Execution Worker Service')
19-
logger.info({
20-
masterPid: process.pid,
21-
workers: config.workers.count,
22-
mode: config.executionMode,
23-
}, 'Service configuration')
18+
async function main() {
19+
if (cluster.isPrimary) {
20+
logger.info('🚀 Starting Chaingraph Execution Worker Service')
21+
logger.info({
22+
masterPid: process.pid,
23+
workers: config.workers.count,
24+
mode: config.executionMode,
25+
}, 'Service configuration')
2426

25-
startMaster()
26-
} else {
27-
// This is a worker process
28-
startWorker()
27+
// Create Kafka topics if in distributed mode
28+
if (config.executionMode === 'distributed') {
29+
logger.info('Creating Kafka topics if they don\'t exist')
30+
await createTopicsIfNotExist()
31+
}
32+
33+
startMaster()
34+
} else {
35+
// This is a worker process
36+
await startWorker()
37+
}
2938
}
39+
40+
main().catch((error) => {
41+
logger.error({ error }, 'Failed to start service')
42+
process.exit(1)
43+
})

apps/chaingraph-frontend/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# @badaitech/chaingraph-frontend
22

3+
## 0.5.5-dev.19
4+
5+
### Patch Changes
6+
7+
- feat: enhance flow initialization with Kafka topic creation and optimize producer configurations
8+
- Updated dependencies
9+
- @badaitech/chaingraph-executor@0.5.5-dev.19
10+
- @badaitech/chaingraph-nodes@0.5.5-dev.19
11+
- @badaitech/chaingraph-types@0.5.5-dev.19
12+
- @badaitech/chaingraph-trpc@0.5.5-dev.19
13+
- @badaitech/badai-api@0.5.5-dev.19
14+
315
## 0.5.5-dev.18
416

517
### Patch Changes

apps/chaingraph-frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@badaitech/chaingraph-frontend",
33
"type": "module",
4-
"version": "0.5.5-dev.18",
4+
"version": "0.5.5-dev.19",
55
"private": false,
66
"description": "Frontend application for the Chaingraph project",
77
"license": "BUSL-1.1",

0 commit comments

Comments
 (0)