Skip to content

feat(api): dual-write Resource rows for new jobs and deploys - #279

Open
eLRuLL wants to merge 1 commit into
adr001/resource-modelfrom
adr001/resource-dual-write
Open

feat(api): dual-write Resource rows for new jobs and deploys#279
eLRuLL wants to merge 1 commit into
adr001/resource-modelfrom
adr001/resource-dual-write

Conversation

@eLRuLL

@eLRuLL eLRuLL commented Apr 29, 2026

Copy link
Copy Markdown
Member

Description

when a SpiderJob or Deploy is created through the existing serializers, optionally create a linked Resource row and set SpiderJob.resource / Deploy.resource.

  • New helper module core/resource_dual_write.py with attach_spider_job_resource and attach_deploy_resource (idempotent, uses transaction.atomic + select_for_update).
  • Wired from SpiderJobCreateSerializer.create (covers API job creation and launch_job) and DeployCreateSerializer.create.
  • Gated by RESOURCE_DUAL_WRITE (default False via django-environ) so production is unchanged until explicitly enabled.
  • Documented in .env.example.

Initial phase mapping: spider IN_QUEUEPENDING, WAITINGPROVISIONING; deploy BUILDINGPROVISIONING. desired_spec holds minimal identifiers (jid / did).

No changes to Kubernetes dispatch, job lifecycle, or public API contracts.

Issue

  • _N/A

Checklist before requesting a review

  • I have performed a self-review of my code.
  • My code follows the style guidelines of this project.
  • I have made corresponding changes to the documentation. (.env.example only)
  • New and existing tests pass locally with my changes.
  • If this change is a core feature, I have added thorough tests. (optional; flag defaults off)
  • If this change affects or depends on the behavior of other estela repositories, I have created pull requests with the relevant changes in the affected repositories. (not applicable)
  • I understand that my pull request may be closed if it becomes obvious or I did not perform all of the steps above.

@eLRuLL
eLRuLL requested review from erick-GeGe and joaquingx April 29, 2026 15:07
Comment thread estela-api/core/resource_dual_write.py
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.

2 participants