Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / function
claim
codeintel.jobs.claim
PINNED SOURCE Source and edges from the index at this commit. An execution appears only where one was recorded.
PHAROS at 975a38dMIT license
Around this symbol
Search all symbolsLoading
codeintel.jobs.claimbackend/app/codeintel/jobs.py, lines 118–141Open source
def claim(db: Session, job_id: uuid.UUID, worker_id: str, model: JobModel = IngestionJob): """Atomically move a queued job to running. None if someone else got it.""" now = utcnow() result = db.execute( update(model) .where( model.id == job_id, model.status == "queued", or_(model.available_at.is_(None), model.available_at <= now), ) .values( status="running", attempts=model.attempts + 1, worker_id=worker_id, started_at=now, heartbeat_at=now, error=None, error_kind=None, ) ) db.commit() if result.rowcount != 1: return None return db.get(model, job_id)What the index recorded
- Signature
def claim(db: Session, job_id: uuid.UUID, worker_id: str, model: JobModel):- File
backend/app/codeintel/jobs.py- Lines
- 118–141
- Parser
- python-ast
- Git blob
54c9a5d84ee5feda5176c3e05d0aa9a7d46f6016- Call sites
- 9 named, 3 resolved, 6 left unlinked
- Outside this subset
- 16 more edges reach code outside the graph shown here
