Skip to content

Commit 410f85a

Browse files
committed
fix: fix bugs in migration
1 parent e101ba7 commit 410f85a

Some content is hidden

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

47 files changed

+510
-627
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ dump.rdb
1414
*.log
1515
output/
1616
result/
17+
iii-*.yaml
18+
data/
1719

1820
.cursor/
1921
.claude/

api/config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ modules:
1313
config:
1414
port: 3111
1515
host: 0.0.0.0
16-
default_timeout: 30000
16+
default_timeout: 86400000
1717
concurrency_request_limit: 1024
1818
cors:
1919
allowed_origins:
@@ -44,4 +44,4 @@ modules:
4444
watch:
4545
- steps/**/*.py
4646
exec:
47-
- motia dev --dir steps
47+
- PYTHONUNBUFFERED=1 PYTHONPATH=. .venv/bin/motia dev --dir steps
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from motia import ApiRequest, ApiResponse, FlowContext, api
2+
3+
config = {
4+
"name": "build-compiler-api",
5+
"description": "build compiler",
6+
"flows": ["compiler"],
7+
"triggers": [api("POST", "/compiler/build")],
8+
"enqueues": ["compiler.build"],
9+
}
10+
11+
12+
async def handler(request: ApiRequest, ctx: FlowContext) -> ApiResponse:
13+
body = request.body or {}
14+
await ctx.enqueue({"topic": "compiler.build", "data": {**body, "_trace_id": ctx.trace_id}})
15+
return ApiResponse(status=202, body={"trace_id": ctx.trace_id})

api/steps/compiler/01_build_api_step.py

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,19 @@
1010

1111
from utils.path import get_buckyball_path
1212
from utils.stream_run import stream_run_logger
13-
from utils.event_common import check_result
13+
from utils.event_common import check_result, get_origin_trace_id
1414

1515
config = {
16-
"name": "Build Compiler",
17-
"description": "build bitstream",
16+
"name": "build-compiler",
17+
"description": "build compiler",
1818
"flows": ["compiler"],
1919
"triggers": [queue("compiler.build")],
2020
"enqueues": [],
2121
}
2222

2323

2424
async def handler(input_data: dict, ctx: FlowContext) -> None:
25+
origin_tid = get_origin_trace_id(input_data, ctx)
2526
bbdir = get_buckyball_path()
2627
script_dir = f"{bbdir}/workflow/steps/compiler/scripts"
2728
yaml_dir = f"{script_dir}/yaml"
@@ -47,8 +48,7 @@ async def handler(input_data: dict, ctx: FlowContext) -> None:
4748
# Return result to API
4849
# ==================================================================================
4950
success_result, failure_result = await check_result(
50-
ctx, result.returncode, continue_run=False
51-
)
51+
ctx, result.returncode, continue_run=False, trace_id=origin_tid)
5252

5353
# ==================================================================================
5454
# Continue routing
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from motia import ApiRequest, ApiResponse, FlowContext, api
2+
3+
config = {
4+
"name": "firesim-buildbitstream-api",
5+
"description": "build bitstream",
6+
"flows": ["firesim"],
7+
"triggers": [api("POST", "/firesim/buildbitstream")],
8+
"enqueues": ["firesim.buildbitstream"],
9+
}
10+
11+
12+
async def handler(request: ApiRequest, ctx: FlowContext) -> ApiResponse:
13+
body = request.body or {}
14+
await ctx.enqueue({"topic": "firesim.buildbitstream", "data": {**body, "_trace_id": ctx.trace_id}})
15+
return ApiResponse(status=202, body={"trace_id": ctx.trace_id})

api/steps/firesim/01_buildbitstream_api_step.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

api/steps/firesim/01_buildbitstream_event_step.py renamed to api/steps/firesim/01_buildbitstream_event.step.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
from utils.path import get_buckyball_path
1212
from utils.stream_run import stream_run_logger
13-
from utils.event_common import check_result
13+
from utils.event_common import check_result, get_origin_trace_id
1414

1515
config = {
16-
"name": "Firesim Buildbitstream",
16+
"name": "firesim-buildbitstream",
1717
"description": "build bitstream",
1818
"flows": ["firesim"],
1919
"triggers": [queue("firesim.buildbitstream")],
@@ -22,6 +22,7 @@
2222

2323

2424
async def handler(input_data: dict, ctx: FlowContext) -> None:
25+
origin_tid = get_origin_trace_id(input_data, ctx)
2526
bbdir = get_buckyball_path()
2627
script_dir = f"{bbdir}/workflow/steps/firesim/scripts"
2728
yaml_dir = f"{script_dir}/yaml"
@@ -44,8 +45,7 @@ async def handler(input_data: dict, ctx: FlowContext) -> None:
4445
# Return result to API
4546
# ==================================================================================
4647
success_result, failure_result = await check_result(
47-
ctx, result.returncode, continue_run=False
48-
)
48+
ctx, result.returncode, continue_run=False, trace_id=origin_tid)
4949

5050
# ==================================================================================
5151
# Continue routing
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from motia import ApiRequest, ApiResponse, FlowContext, api
2+
3+
config = {
4+
"name": "firesim-infrasetup-api",
5+
"description": "infrasetup",
6+
"flows": ["firesim"],
7+
"triggers": [api("POST", "/firesim/infrasetup")],
8+
"enqueues": ["firesim.infrasetup"],
9+
}
10+
11+
12+
async def handler(request: ApiRequest, ctx: FlowContext) -> ApiResponse:
13+
body = request.body or {}
14+
data = {"jobs": body.get("jobs", 16)}
15+
await ctx.enqueue({"topic": "firesim.infrasetup", "data": {**data, "_trace_id": ctx.trace_id}})
16+
return ApiResponse(status=202, body={"trace_id": ctx.trace_id})

api/steps/firesim/02_infrasetup_api_step.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)