Skip to content

Commit 0c6e428

Browse files
committed
fix: how things can be solved when --sim-cpu parameters are added to carbontracker
1 parent 8c142c0 commit 0c6e428

File tree

1 file changed

+7
-1
lines changed
  • carbontracker/src/fastapi_agent

1 file changed

+7
-1
lines changed

carbontracker/src/fastapi_agent/main.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@ class InputData(BaseModel):
1111
data: str
1212

1313
@app.post("/process")
14-
async def process(data: InputData):
14+
async def process(
15+
data: InputData,
16+
sim_cpu: str = None, sim_cpu_tdp: str = None, sim_cpu_util: str = None,
17+
sim_gpu: str = None, sim_gpu_watts: str = None, sim_gpu_util: str = None):
1518
store_data_temporarily(data.data) # is stored as data.json
19+
command = ["uv", "run", "carbontracker", "--simpipe", "data.json"]
20+
if sim_cpu:
21+
command.extend(["--sim-cpu", sim_cpu]) # Not working yet (CLI option not implemented?)
1622
completed_process = subprocess.run(
1723
["uv", "run", "carbontracker", "--simpipe", "data.json"],
1824
check=True,

0 commit comments

Comments
 (0)