Update project-level settings (concurrency, etc.).
(name: str, settings: ProjectSettingsUpdate)
| 487 | |
| 488 | @router.patch("/{name}/settings", response_model=ProjectDetail) |
| 489 | async def update_project_settings(name: str, settings: ProjectSettingsUpdate): |
| 490 | """Update project-level settings (concurrency, etc.).""" |
| 491 | _init_imports() |
| 492 | assert _check_spec_exists is not None # guaranteed by _init_imports() |
| 493 | assert _get_project_prompts_dir is not None # guaranteed by _init_imports() |
| 494 | (_, _, get_project_path, _, _, get_project_concurrency, |
| 495 | set_project_concurrency) = _get_registry_functions() |
| 496 | |
| 497 | name = validate_project_name(name) |
| 498 | project_dir = get_project_path(name) |
| 499 | |
| 500 | if not project_dir: |
| 501 | raise HTTPException(status_code=404, detail=f"Project '{name}' not found") |
| 502 | |
| 503 | if not project_dir.exists(): |
| 504 | raise HTTPException(status_code=404, detail="Project directory not found") |
| 505 | |
| 506 | # Update concurrency if provided |
| 507 | if settings.default_concurrency is not None: |
| 508 | success = set_project_concurrency(name, settings.default_concurrency) |
| 509 | if not success: |
| 510 | raise HTTPException(status_code=500, detail="Failed to update concurrency") |
| 511 | |
| 512 | # Return updated project details |
| 513 | has_spec = _check_spec_exists(project_dir) |
| 514 | stats = get_project_stats(project_dir) |
| 515 | prompts_dir = _get_project_prompts_dir(project_dir) |
| 516 | |
| 517 | return ProjectDetail( |
| 518 | name=name, |
| 519 | path=project_dir.as_posix(), |
| 520 | has_spec=has_spec, |
| 521 | stats=stats, |
| 522 | prompts_dir=str(prompts_dir), |
| 523 | default_concurrency=get_project_concurrency(name), |
| 524 | ) |
nothing calls this directly
no test coverage detected