Back to the room

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

Code Observatory / function

submit

codeintel.jobs.submit

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

Calls (2)
SymbolFileResolved by
QueueFulljobs.pysame file
Submissionjobs.pysame file
Called by (1)
SymbolFileResolved by
submit_repositoryrouter.pyunique name
Inside (1)
SymbolFileResolved by
jobsjobs.pysame file
codeintel.jobs.submitbackend/app/codeintel/jobs.py, lines 72–115Open source
def submit(db: Session, ref: RepoRef, branch: str | None = None, *, force: bool = False,           max_attempts: int = 3, max_queued: int | None = None) -> Submission:    """Queue an ingestion job, or return the repository's active job.    ``max_queued`` caps how many jobs may wait in ``queued`` (the API passes    ``QUEUE_SIZE``); resubmitting a repository that already has an active job    is never refused. The cap is checked before the insert, so concurrent    submissions can overshoot it slightly (a soft cap).    """    existing = db.execute(        select(IngestionJob).where(IngestionJob.repo_url == ref.canonical_url, IngestionJob.status.in_(ACTIVE))    ).scalar_one_or_none()    if existing is not None:        return Submission(existing, created=False)    if max_queued is not None:        queued = db.execute(            select(func.count()).select_from(IngestionJob).where(IngestionJob.status == "queued")        ).scalar_one()        if queued >= max_queued:            raise QueueFull(queued, max_queued)    repo = db.execute(select(Repository).where(Repository.url == ref.canonical_url)).scalar_one_or_none()    job = IngestionJob(        repository_id=repo.id if repo else None,        repo_url=ref.canonical_url,        branch_key=branch or "",        force=force,        status="queued",        attempts=0,        max_attempts=max_attempts,    )    db.add(job)    try:        db.commit()    except IntegrityError:        # Lost a race with a concurrent submission: return the winner.        db.rollback()        existing = db.execute(            select(IngestionJob).where(                IngestionJob.repo_url == ref.canonical_url, IngestionJob.status.in_(ACTIVE)            )        ).scalar_one()        return Submission(existing, created=False)    db.refresh(job)    return Submission(job, created=True)

What the index recorded

Signature
def submit(db: Session, ref: RepoRef, branch: str | None, *, force: bool, max_attempts: int, max_queued: int | None) -> Submission:
File
backend/app/codeintel/jobs.py
Lines
72–115
Parser
python-ast
Git blob
54c9a5d84ee5feda5176c3e05d0aa9a7d46f6016
Call sites
15 named, 6 resolved, 9 left unlinked
Outside this subset
26 more edges reach code outside the graph shown here

Read it on GitHub at this commit