Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/codegen/runner/models/apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class ServerInfo(BaseModel):


class UtilizationMetrics(BaseModel):
container_id: str
timestamp: str
memory_rss_gb: float
memory_vms_gb: float
Expand Down
3 changes: 0 additions & 3 deletions src/codegen/runner/sandbox/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class SandboxRunner:
"""Responsible for orchestrating the lifecycle of a warmed sandbox"""

# =====[ __init__ instance attributes ]=====
container_id: str
repo: RepoConfig
commit: GitCommit
op: RemoteRepoOperator | None
Expand All @@ -35,10 +34,8 @@ class SandboxRunner:

def __init__(
self,
container_id: str,
repo_config: RepoConfig,
) -> None:
self.container_id = container_id
self.repo = repo_config
self.op = RemoteRepoOperator(repo_config, base_dir=repo_config.base_dir, github_type=GithubType.Github)
self.commit = self.op.git_cli.head.commit
Expand Down
7 changes: 3 additions & 4 deletions src/codegen/runner/sandbox/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ async def lifespan(server: FastAPI):
try:
repo_config = get_repo_config()
server_info = ServerInfo(repo_name=repo_config.full_name)
logger.info(f"Starting up sandbox fastapi server for repo_id={server_info.repo_id} in container ID={server_info.container_id}")
logger.info(f"Starting up sandbox fastapi server for repo_name={server_info.repo_name}")

runner = SandboxRunner(container_id=server_info.container_id, repo_config=repo_config)
runner = SandboxRunner(repo_config=repo_config)
server_info.warmup_state = WarmupState.PENDING
await runner.warmup()
server_info.warmup_state = WarmupState.COMPLETED
Expand Down Expand Up @@ -82,7 +82,6 @@ async def utilization_metrics() -> UtilizationMetrics:
memory_stats = get_memory_stats()

return UtilizationMetrics(
container_id=os.getenv("MODAL_TASK_ID"),
timestamp=datetime.now(dt.UTC).isoformat(),
memory_rss_gb=memory_stats.memory_rss_gb,
memory_vms_gb=memory_stats.memory_vms_gb,
Expand All @@ -94,7 +93,7 @@ async def utilization_metrics() -> UtilizationMetrics:

@app.post(SIGNAL_SHUTDOWN_ENDPOINT)
async def signal_shutdown() -> SignalShutdownResponse:
logger.info(f"repo_id={server_info.repo_id} container ID={server_info.container_id} received signal_shutdown")
logger.info(f"repo_name={server_info.repo_name} received signal_shutdown")
server_info.is_shutting_down = True
return SignalShutdownResponse(is_ready_to_shutdown=not server_info.is_running_codemod)

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/codegen/runner/sandbox/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def runner(codebase: Codebase, tmpdir):
mock_init_codebase.return_value = codebase
mock_op.return_value = codebase.op

yield SandboxRunner(container_id="ta-123", repo_config=codebase.op.repo_config)
yield SandboxRunner(repo_config=codebase.op.repo_config)


@pytest.fixture(autouse=True)
Expand Down
Loading