Skip to content

Commit 7bd63b8

Browse files
Add graph creation endpoint and update TODO progress
- Implement /v0/create_graph endpoint to initialize new TaskGraph instances - Add ID field to TaskGraph model with UUID generation - Mark completed features in TODO.md and add new pending items - Remove unused import and fix spacing in app.py
1 parent ba3a9f3 commit 7bd63b8

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

TODO.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
- [ ] docker backend endpoint
2-
- [ ] custom task-nodes
3-
- [ ] frontend and backend API connection
1+
- [x] docker backend endpoint
2+
- [x] custom task-nodes
3+
- [x] frontend and backend API connection
4+
- [ ] node connection
5+
- [ ] task graph creation (multigraph support/auth)

meshwork/backend/app.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ async def health():
3535
return {"status": "healthy", "service": "meshwork-backend"}
3636

3737

38+
@app.post("/v0/create_graph")
39+
async def create_graph():
40+
new_graph = TaskGraph()
41+
task_graphs[new_graph.id] = new_graph
42+
return {"ID": new_graph.id}
43+
3844
@app.post("/v0/{graph_id}/task/add/")
3945
async def add_task(graph_id: str, task: Task):
4046
task_graphs[graph_id].add_task(task)
@@ -50,7 +56,6 @@ async def get_task(graph_id: str, task_id: str) -> Task:
5056
return task_graphs[graph_id].get_task(task_id)
5157

5258

53-
5459
@app.delete("/v0/{graph_id}/task/{task_id}")
5560
async def delete_task(graph_id: str, task_id: str):
5661
task_graphs[graph_id].delete_task(task_id)

meshwork/backend/core/graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import datetime
33
import logging
44
import time
5-
import os
65
import uuid
76

87
import schedule
@@ -19,6 +18,7 @@
1918
class TaskGraph(BaseModel):
2019
"""A directed graph representing tasks and their dependencies."""
2120

21+
id: str = Field(default=uuid.uuid4().hex)
2222
graph: DiGraph = Field(default_factory=DiGraph)
2323
name: str = Field(default_factory=str)
2424
backup_interval: int = Field(default=10)

0 commit comments

Comments
 (0)