Skip to content

Ap 857 post jobs - #3

Merged
steve-sullivan merged 4 commits into
mainfrom
AP-857-post-jobs
Sep 28, 2026
Merged

steve-sullivan merged 4 commits into
mainfrom
AP-857-post-jobs

Conversation

@steve-sullivan

Copy link
Copy Markdown
Contributor
  • Adds POST /jobs endpoint for submitting OCR jobs
  • Validates required filelist, languages, and output parameters
  • Validates that filelist exists and is a file
  • Queues valid jobs using the Celery run_tesseract_job task
  • Returns Celery job ID, initial PENDING status, and job-status URL
  • Returns 422 responses for invalid requests and 500 responses for queue failures
  • Adds unit tests for validation, successful job submission, and queue failures

@jason-raitz

Copy link
Copy Markdown
Contributor

@steve-sullivan When I submit a POST to the /jobs endpoint with a properly configured json, I got a 500 error response and a stack trace complaining that psycopg is not installed.

From what I can tell, the way we configure the quiabo result backend makes sqlalchemy assume that we have psycopg v3 installed.
in docker-compose.yml
QUIABO_CELERY__result_backend: ${QUIABO__CELERY__result_backend:-db+postgresql://${POSTGRES_USER:-quiabo}:${POSTGRES_PASSWORD:-quiabo}@${POSTGRES_HOST:-db}:${POSTGRES_PORT:-5432}/${POSTGRES_DB:-quiabo}}

I think the easiest fix is to change the psycopg dependency line in our pyproject.toml:
"psycopg2", -> '"psycopg[binary]",`

I did that locally, rebuilt, and then my POST's gave a proper celery response.

@anarchivist

anarchivist commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

fwiw changing psycopg2 to psycopg[c] in the pyproject.toml is probably better (instead of psycopg[binary]) because it's already downloading the necessary dependencies to build the Python package. (that's why we're installing gcc and libpq-dev.) the reason why this is better is listed in the Psycopg 3 docs:

A “Local installation” results in a performing and maintainable library. The library will include the speed-up C module and will be linked to the system libraries (libpq, libssl…) so that system upgrade of libraries will upgrade the libraries used by Psycopg 3 too. This is the preferred way to install Psycopg for a production site.

@anarchivist anarchivist left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rw+c - this looks really great! the one thing to fix is the psycopg dependency as Jason and I reference in our comments.

@jason-raitz jason-raitz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rw+c; as we discussed above.

@steve-sullivan
steve-sullivan merged commit 5f4f117 into main Sep 28, 2026
5 checks passed
@steve-sullivan
steve-sullivan deleted the AP-857-post-jobs branch September 28, 2026 20:28
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