Back to the room

Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works

Code Observatory / module

jobs

codeintel.jobs

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 symbols

Loading

Contains (14)
SymbolFileResolved by
canceljobs.pysame file
claimjobs.pysame file
classify_errorjobs.pysame file
default_worker_idjobs.pysame file
heartbeatjobs.pysame file
next_queued_idsjobs.pysame file
queue_summaryjobs.pysame file
QueueFulljobs.pysame file
recover_stalejobs.pysame file
retry_delay_secondsjobs.pysame file
runjobs.pysame file
Submissionjobs.pysame file
submitjobs.pysame file
utcnowjobs.pysame file
Imports (3)
SymbolFileResolved by
embeddingsembeddings.pythrough an import
git_sourcegit_source.pythrough an import
indexerindexer.pythrough an import
Imported by (1)
SymbolFileResolved by
routerrouter.pythrough an import
codeintel.jobsbackend/app/codeintel/jobs.py, lines 1–40Open source
"""Durable ingestion jobs.PostgreSQL is the source of truth; Redis (optional) only carries wake-upnotifications. Consequences:* A lost notification never loses a job — workers also poll for queued jobs  and re-notify on startup.* A duplicated notification never runs a job twice — :func:`claim` is an  atomic conditional UPDATE (``WHERE status = 'queued'``).* A worker that dies mid-job leaves a ``running`` row with a stale  heartbeat; :func:`recover_stale` puts it back in the queue (or fails it  once attempts are exhausted).* Submitting a repository that already has an active job returns that job  (``uq_ingestion_jobs_active``) instead of queueing a second clone.Every job ends in exactly one terminal state: ``succeeded``, ``failed`` or``cancelled``.The queue helpers (:func:`claim`, :func:`next_queued_ids`, :func:`heartbeat`,:func:`cancel`, :func:`queue_summary`, :func:`recover_stale`) take the jobmodel, so learning jobs (``LearningJob``) share this state machine."""from __future__ import annotationsimport loggingimport socketimport uuidfrom dataclasses import dataclassfrom datetime import UTC, datetime, timedeltafrom sqlalchemy import func, or_, select, updatefrom sqlalchemy.exc import IntegrityErrorfrom sqlalchemy.orm import Sessionfrom ..database.models import IngestionJob, LearningJob, Repositoryfrom .embeddings import Embedder, EmbeddingUnavailablefrom .git_source import GitError, RepoRef, RepoSpecErrorfrom .indexer import CodeIndexer

Shows the first 40 of 302 lines. The rest is on GitHub at this commit.

What the index recorded

Signature
module backend.app.codeintel.jobs
File
backend/app/codeintel/jobs.py
Lines
1–302
Parser
python-ast
Git blob
54c9a5d84ee5feda5176c3e05d0aa9a7d46f6016
Call sites
1 named, 0 resolved, 1 left unlinked
Outside this subset
10 more edges reach code outside the graph shown here

Read it on GitHub at this commit