Skip to content

Background workers#83

Open
Yannicked wants to merge 39 commits into
iterorganization:developfrom
Yannicked:feature/celery-tasks
Open

Background workers#83
Yannicked wants to merge 39 commits into
iterorganization:developfrom
Yannicked:feature/celery-tasks

Conversation

@Yannicked

Copy link
Copy Markdown
Collaborator

This PR introduces simulation ingestion via Celery background workers.

When simulations are uploaded through the new v1.3 API endpoint, file copying and status tracking are now handled by Celery tasks (copy_files_task chained with complete_ingestion_task) rather than blocking the HTTP request.

The ingestion pipeline tracks status though the following: QUEUED → COPYING → COPIED → VALIDATING → VALIDATED → COMPLETED, with failure variants.

@Yannicked Yannicked force-pushed the feature/celery-tasks branch from 06bf048 to 68938a1 Compare May 28, 2026 08:19
@Yannicked Yannicked requested a review from ioan-alexandra June 2, 2026 14:28
@Yannicked Yannicked mentioned this pull request Jun 8, 2026
Comment thread src/simdb/enums.py Outdated
Comment thread alembic/versions/b2c52ee8ff12_add_ingestion_status.py
Comment thread src/simdb/workers/tasks.py Outdated
Comment thread src/simdb/workers/tasks.py Outdated
Comment thread src/simdb/remote/models.py Outdated
Comment thread docs/celery.md Outdated
Comment thread docs/developer_guide.md Outdated
Comment thread docs/developer_guide.md Outdated
Comment thread src/simdb/remote/apis/v1_3/simulations.py
Comment thread alembic/versions/b2c52ee8ff12_add_ingestion_status.py Outdated
…3 chain

complete_ingestion_task opened a DB session via get_db() but never closed
it, leaking a connection on every ingestion (it is the terminal task of the
v1.3 chain). Wrap its body in try/finally so the session is always closed,
matching copy_files_task and validate_imas_task.

validate_imas_task was a stub that always set VALIDATED without validating,
and the v1.3 ingestion chain never ran it, so v1.3 silently ignored
validation.auto_validate / error_on_fail that v1/v1.1/v1.2 honor. The task
now runs the same schema Validator v1.2 uses, sets VALIDATION_FAILED and
(when error_on_fail) re-raises to abort the chain before COMPLETED. The v1.3
endpoint inserts the validation step into the chain when auto_validate is set.
to_model_with_path passed the SQLAlchemy URI TypeDecorator (imported from
.types) to sha1_checksum instead of a simdb.uri.URI, so sha1_checksum raised
AttributeError on uri.scheme for any IMAS file. Construct the URI via the
urilib.URI parser, matching from_data / from_data_model.
@Yannicked Yannicked marked this pull request as ready for review June 24, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants