Job Images
Anlegen und Bearbeiten eines Jobs (UI)
Ein Job im Frontend ist nur eine Definition in der Datenbank, die auf ein Image zeigt. Der eigentliche Job-Code steckt im Image. Reihenfolge daher immer: erst das Image nach Nexus pushen, dann den Job in der UI anlegen.
1. Image bauen und pushen
Aus dem Repo-Root (Build-Kontext = Root), Beispiel News-Crawler (jedes Dockerfile nennt in seinem Kopf den eigenen Build-Befehl):
docker build -f service/scripts/jobs-image/news-crawl/Dockerfile \
-t docker.nes.uni-due.de/inse/jobs/news-crawl:latest .
docker push docker.nes.uni-due.de/inse/jobs/news-crawl:latest
Login zu Nexus vorher, falls nötig: docker login docker.nes.uni-due.de
(Zugangsdaten wie in der Backend-.env, BACKGROUND_JOBS_REGISTRY_*).
Erst wenn Push erfolgreich war, taucht das Image in der Image-Auswahl der UI auf.
2. Job anlegen
- Als Superadmin anmelden und die Seite Jobs öffnen.
- Oben rechts prüfen, dass die Karten Docker-Daemon und Nexus-Registry
grün („Erreichbar") sind. Ist Nexus rot, bleibt die Image-Auswahl leer —
dann Registry/
.envprüfen, bevor es weitergeht. - Auf Neuer Job klicken. Im Dialog:
- Name – Pflichtfeld, muss eindeutig sein (sonst 409).
- Beschreibung, Ziel-Index – optional, nur zur Anzeige.
- Image – Pflichtfeld. In das Feld tippen und aus der
Nexus-Autovervollständigung den passenden Tag wählen, z. B.
docker.nes.uni-due.de/inse/jobs/news-crawl:latest. Leer = Fehler. - Befehl – optional. Wird an den
ENTRYPOINTdes Images angehängt (z. B.--max-items 50). Leer lassen, wenn die Image-Defaults reichen. - Umgebungsvariablen – optional,
KEY=VALUEpro Zeile. Bei Nexus-Images werden die INSE-Zugangsdaten (Elasticsearch/LLM) ohnehin automatisch ergänzt; hier nur Zusätzliches/Overrides.
- Speichern. Der Job erscheint in der Tabelle, zunächst ohne Zeitplan (= nur manuell).
3. Job ausführen und beobachten
- ▶ Jetzt ausführen startet einen Lauf. Das Backend pullt das Image und
startet einen Container namens
<job-slug>-run-<id>. - ⏹ Stoppen bricht einen laufenden Lauf ab.
- 🗎 Logs zeigt die Container-Logs (live während des Laufs, danach die in der DB gespeicherten letzten Zeilen) sowie Dauer bzw. „läuft seit".
- Schlägt der Pull fehl (Image gelöscht/nicht gepusht), wird der Lauf
fehlgeschlagen mit
failed to pull image …im Log — dann Image neu pushen.
4. Job bearbeiten
- In der Name-Spalte erscheint beim Hovern ein Stift-Symbol → öffnet den Bearbeiten-Dialog. Dort lassen sich Name, Beschreibung, Ziel-Index, Image, Befehl und Env ändern (gleiche Validierung wie beim Anlegen).
- Das Kalender-Symbol in der Aktionsspalte öffnet den Zeitplan-Dialog: Cron-Ausdruck setzen (5 Felder) und Job aktiv/inaktiv schalten. Ein Zeitplan macht aus einem manuellen Job einen automatisch laufenden.
- Bearbeiten ist gesperrt, solange ein Lauf des Jobs läuft.
5. Job löschen
Das Papierkorb-Symbol entfernt die Job-Definition. Das Image in Nexus bleibt davon unberührt (siehe unten zum Image-Löschen).
One Docker image per job script. Each image installs only its own dependencies
and bakes its script as the ENTRYPOINT. Most jobs then run with no command
override — the job definition just points image at the matching tag. Where
several jobs share one script (the demos), they point at the same image and
differ only by their command.
Images
| Job (DB name) | Image | Entrypoint | Notes |
|---|---|---|---|
| News-Crawler | jobs/news-crawl |
run_pipeline.py |
scrapy<2.13, Twisted<24.7; uploads to NEWS_UPLOAD_INDEX |
| Bund-Crawler | jobs/bund-crawl |
gpc.data.py --max-rows 200 |
headless Chrome; uploads to BUND_UPLOAD_INDEX; capped, full export is ~300k rows |
| Project-Topic-Mapping | jobs/project-topics |
map_project_topics --output-index docker-job_test |
reads projects_bund_v1; needs host backend |
| News-Topic-Mapping | jobs/news-topics |
map_news_topics --output-index aktuell_openalex_topics |
bundles both topic_mapper pkgs; needs host backend |
| News-Keyword-Extraction | jobs/news-keywords |
sync.py --update-keywords --target-index docker-job_test |
ES + LLM creds; writes to test index |
| UDE OrgMiner Verified Persons | jobs/orgminer-verified-persons-ude |
upload_orgminer_verified_persons_ude.py --progress-file /state/orgminer_verified_persons_ude_progress.json |
Writes orgminer_verified_persons_ude; image-scoped NES creds; persistent checkpoint |
| Demo-Job A / B / C | jobs/demo |
demo.py (seconds via command: 20 / 25 / 30) |
no dependencies; one image, three job rows |
Each image is its own repository under the jobs/ path namespace, prefixed
docker.nes.uni-due.de/inse/ (e.g. docker.nes.uni-due.de/inse/jobs/news-crawl:latest).
The three demo jobs share the single jobs/demo repository.
The entrypoints carry no run limits: anything set in the job's command field is
appended to the entrypoint, so limits (--max-items, --max-docs, --limit) are
passed per run from the UI. The one exception is the Bund-Crawler, which keeps a
--max-rows cap in the image because its full export is ~300k rows.
Build
From the repo root (the build context must be the repo root so the Dockerfiles
can copy service/scripts/… and background-jobs/app/):
docker build -f service/scripts/jobs-image/news-crawl/Dockerfile \
-t docker.nes.uni-due.de/inse/jobs/news-crawl:latest .
docker push docker.nes.uni-due.de/inse/jobs/news-crawl:latest
Each image's Dockerfile header lists its own build command.
UDE OrgMiner verified persons
docker build -f service/scripts/jobs-image/orgminer-verified-persons-ude/Dockerfile \
-t docker.nes.uni-due.de/inse/jobs/orgminer-verified-persons-ude:latest .
docker push docker.nes.uni-due.de/inse/jobs/orgminer-verified-persons-ude:latest
Create a manual-only job in the Jobs UI with this image and set Persistent
directory to /state. The image's entrypoint writes its JSON checkpoint to
/state/orgminer_verified_persons_ude_progress.json; the runner mounts a task-specific Docker volume there so
separate runs resume. Keep the job definition if you need to keep its checkpoint
(deleting the definition also removes its volume). Leave Command empty for a
full resumable run, or set it to --limit 5 for a small first run. Set Command
to --fresh if every invocation should delete the checkpoint and start at the
first organization. Organizations are processed sequentially; no concurrency
flags exist. The target index is orgminer_verified_persons_ude.
If the run stops without a Finished: line and reports exit 137, the
container was killed (usually by the host's out-of-memory killer) and no Python
traceback exists. The run log then gets a [system] ... ran out of memory ...
note from the runner. A job without a Persistent directory always starts
from the first organization, which makes such a restart look identical.
Running locally without pushing
Before each run the backend pulls the job's image from the registry when it is a
registry image (host docker.nes.uni-due.de). There is no fallback to a local
copy: if the pull fails, the run is marked failed and the error is written to
the run log — a stale local image is never used silently. To run a locally built
image without pushing it, skip the pull attempt entirely:
export BACKGROUND_JOBS_PULL_BEFORE_RUN=false
With the pull disabled the backend uses whatever image with that tag exists on
the Docker host, so docker build -t docker.nes.uni-due.de/inse/jobs/<name>:latest .
is enough for local runs.
Env vars
Because every tag lives under the docker.nes.uni-due.de registry host, the
backend treats these as registry images and injects the INSE Elasticsearch / LLM
credentials automatically (plus any per-job env).
The orgminer-verified-persons-ude image also receives ELASTICSEARCH_URL and
ELASTICSEARCH_API_KEY from backend settings, and only that exact repository
gets those NES credentials. Other job images continue to receive INSE/LLM
credentials only.
Most images write to the test index by default: the crawlers upload into the
index named by NEWS_UPLOAD_INDEX / BUND_UPLOAD_INDEX (both baked to
docker-job_test in their Dockerfile), and the project mapper and the keyword
extraction write to docker-job_test via --output-index / --target-index.
The exception is News-Topic-Mapping, which writes to aktuell_openalex_topics.
To not contact Elasticsearch at all, pass --skip-upload (crawlers) or
--dry-run (mappers) through the job's command field.