Commit Graph
15 Commits
Author SHA1 Message Date
tao.chen 1994937349 chore: fix dockefile 2026-07-31 15:52:49 +08:00
tao.chen d31fde6abc chore: fix debian source 2026-07-31 15:48:16 +08:00
tao.chen ba96f4f52a chore: update debian source 2026-07-31 15:45:17 +08:00
tao.chenandClaude 9fc886a55e perf: decouple notebook execution and tune pools
schedule:
- New _execution_loop runs alongside _database_event_loop. It claims
  job.node.execute rows, sets a 30-min lease on available_at, then
  dispatches each as asyncio.create_task under a Semaphore(N).
  Polling loop is back to sub-millisecond turnaround for
  schedule.run.requested and job.node.finished. Long notebook
  execution no longer blocks DAG advance events.
- _process_pending_events filters by event_type IN
  ('schedule.run.requested', 'job.node.finished'); the executor
  loop owns job.node.execute exclusively.
- _process_outbox_event builds a plain dict envelope before
  handler dispatch; the previous ORM-row handoff risked
  DetachedInstanceError once the outer session closed.
- _sync_once uses get_job + reschedule_job for existing job ids
  instead of add_job(replace_existing=True). Each cron schedule
  no longer removed-and-readded every 5s.
- service.py threads settings.schedule_execution_concurrency into
  the orchestrator (default 4).

common:
- create_async_engine gets explicit pool_size=10, max_overflow=20,
  pool_recycle=1800. No more relying on SQLAlchemy defaults.
- New schedule_execution_concurrency setting.

runtime:
- scan_workspaces: add missing 'import os' (NameError on startup)
  and switch to asyncio.gather bounded by Semaphore(4) so N
  workspaces start in parallel instead of sequentially.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-31 15:07:57 +08:00
tao.chenandClaude b0f93d976f build: switch services to gunicorn with per-service config
Replace uvicorn with gunicorn + UvicornWorker in backend, runtime,
and schedule Dockerfiles. New gunicorn.conf.py per service exposes
bind/workers/timeout/graceful_timeout as GUNICORN_* env knobs.

Notable details:
- schedule: timeout=0 (disables gunicorn worker heartbeat) so long
  notebook execution isn't killed by gunicorn's silent-worker kill.
- All three configs: drop dead threads=4 setting; UvicornWorker is
  async and ignores threads.
- Pin gunicorn>=26.0.0 in each pyproject; uv.lock regenerated.
- Drop stale 'COPY contracts ./contracts' from runtime and schedule
  Dockerfiles (contracts dir was deleted in an earlier refactor;
  builds would have failed).
- backend Dockerfile: switch to uv sync layout matching runtime/
  schedule; add build deps for native wheels.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-31 15:07:45 +08:00
tao.chen f288c90d37 refactor: remove local fs, add config class to common pacakge 2026-07-31 12:46:31 +08:00
tao.chen 6244dd88b5 refactor: refact schedule module 2026-07-31 12:23:08 +08:00
tao.chen 62c7d7465e Merge branch 'optimize-by-taochen' into develop
# Conflicts:
#	.env.example
#	backend/src/backend/main.py
#	common/src/common/db/models.py
#	common/src/common/eventing.py
#	docker-compose.yml
#	runtime/Dockerfile
#	runtime/pyproject.toml
#	runtime/src/runtime/main.py
#	schedule/src/schedule/main.py
#	schedule/src/schedule/service.py
2026-07-31 09:29:03 +08:00
tao.chen 91767461d6 refactor 2026-07-30 20:52:46 +08:00
tao.chen c32e6e4cae Merge branch 'refactor/remove-redis' into develop
# Conflicts:
#	.env.example
#	CLAUDE.md
#	backend/Dockerfile
#	backend/pyproject.toml
#	backend/src/backend/main.py
#	backend/src/backend/schedule_runs.py
#	common/src/common/db/models.py
#	common/src/common/eventing.py
#	contracts/README.md
#	contracts/demo-core-v1.md
#	contracts/events/README.md
#	contracts/events/event-envelope-v1.json
#	contracts/locks/README.md
#	contracts/locks/file-edit-lock-v1.md
#	contracts/schedules/schedule-definition-api-v1.md
#	docker-compose.yml
#	frontend/README.md
#	migrations/README.md
#	migrations/versions/20260724_0001_v1_schema_baseline.py
#	runtime/Dockerfile
#	runtime/README.md
#	runtime/pyproject.toml
#	runtime/src/runtime/main.py
#	schedule/Dockerfile
#	schedule/README.md
#	schedule/pyproject.toml
#	schedule/src/schedule/main.py
#	schedule/src/schedule/service.py
2026-07-30 20:14:53 +08:00
tao.chen ec53edbce5 refactor 2026-07-30 20:02:19 +08:00
Winnie c74b2abb48 重构模型平台前后端并移除Redis依赖 2026-07-30 19:03:00 +08:00
Winnie 6d6c70cea8 refactor: integrate model platform backend 2026-07-30 13:43:29 +08:00
tao.chen 98b0be11ad feat: add alembic, init common package 2026-07-29 14:07:01 +08:00
tao.chen 233dc90efe feat: add schedule package 2026-07-29 13:35:32 +08:00