From d09ae9a0aa36d8c019194a901bd2edf082103108 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Fri, 20 Nov 2026 15:09:06 -0500 Subject: [PATCH 1/4] feat: PANDA_WORKER_IMAGE env var to override the queue-default worker image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Concrete queues inherit the submitter block from the shared template queue via templateQueueName, so render-panda-queues.py can patch the template's containerImage at render time. Without PANDA_WORKER_IMAGE the committed template default (alpine:latest) is kept; consumers with their own worker image (e.g. a snakemake CI that builds one) no longer need to edit the template to use it. Adds test coverage for the queue-template containerImage path, which the smoke test never exercised: it only ever submitted jobs with --container (per-job image), so a broken template -> render -> submitter chain kept CI green. - scripts/render-panda-queues.py: apply PANDA_WORKER_IMAGE to the template queue before rendering concrete queues - docker-compose.yml: pass PANDA_WORKER_IMAGE to the harvester - .env.example, README: document the knob - tests/test_render_panda_queues.py: unit tests for the render script (template invariant, concrete-queue creation, default preserved, override applied), run in a new unit-tests CI job - smoke test: assert the rendered panda_queues.cfg in the live harvester (after the health wait — the file only appears once the entrypoint finishes setup), and run a second E2E job WITHOUT --container, asserting via the docker_submitter log that the queue default (overridden to python:3.13-alpine via env-overrides, distinct from the per-job python:3.12-alpine) was actually used --- .env.example | 8 +++ .github/workflows/ci.yml | 88 ++++++++++++++++++++++++++++ .gitignore | 1 + README.md | 5 +- docker-compose.yml | 1 + scripts/render-panda-queues.py | 10 ++++ tests/test_render_panda_queues.py | 97 +++++++++++++++++++++++++++++++ 7 files changed, 208 insertions(+), 2 deletions(-) create mode 100644 tests/test_render_panda_queues.py diff --git a/.env.example b/.env.example index 8d79818..7676c0c 100644 --- a/.env.example +++ b/.env.example @@ -52,6 +52,14 @@ PANDA_AUTH=None # PANDA_QUEUES=PANDA_COMPOSE_LOCAL E1_BNL E1_JLAB PANDA_QUEUES=PANDA_COMPOSE_LOCAL +# Worker container image for the queue-level default. Concrete queues inherit +# the submitter block from the shared template queue, so this patches the +# template's containerImage before the harvester renders its panda_queues.cfg. +# Leave unset to keep the template default (alpine:latest). Jobs can still +# override per job with pandajob-submit --container IMAGE. +# PANDA_WORKER_IMAGE=myregistry/worker:latest +#PANDA_WORKER_IMAGE= + # ────────────────────────────────────────────── # JEDI task submission # ────────────────────────────────────────────── diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b6cc29..bf2d2a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,14 @@ on: branches: [main] jobs: + unit-tests: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v7 + - name: Run render-panda-queues unit tests + run: python3 -m unittest discover -s tests -v + smoke-test: runs-on: ubuntu-latest timeout-minutes: 30 @@ -19,6 +27,12 @@ jobs: with: ref: ${{ github.sha }} timeout: '300' + # Override the queue-default worker image for the queue-default + # test below: a small public image, deliberately different from + # the per-job image used by the first integration test + # (python:3.12-alpine), so each test proves its own path. + env-overrides: | + PANDA_WORKER_IMAGE=python:3.13-alpine - name: Verify Harvester is running run: | @@ -48,6 +62,28 @@ jobs: fi echo "Harvester is healthy." + - name: Verify rendered queue config (template inheritance) + run: | + # The harvester renders panda_queues.cfg from + # config/harvester/panda_queues.template.json via + # scripts/render-panda-queues.py. Concrete queues must inherit the + # submitter block (incl. containerImage) from the shared template + # queue through templateQueueName — this is what DockerSubmitter + # falls back to for jobs without a per-job container_name. + # Runs after the health wait: the file only appears once the + # harvester entrypoint finishes its setup and renders the config. + docker exec ${PANDA_COMPOSE_PROJECT}-harvester-1 \ + python3 -c " + import json + cfg = json.load(open('/var/lib/panda/panda_queues.cfg')) + template = cfg['panda-compose-local.template'] + assert template['submitter']['name'] == 'DockerSubmitter', template['submitter'] + assert template['submitter']['containerImage'], 'template containerImage must not be empty' + queue = cfg['PANDA_COMPOSE_LOCAL'] + assert queue['templateQueueName'] == 'panda-compose-local.template', queue + print('rendered queue config OK; template containerImage =', template['submitter']['containerImage']) + " + - name: Set up Python uses: actions/setup-python@v7 with: @@ -149,6 +185,58 @@ jobs: exit 1 fi + - name: Integration test — queue-default container image + run: | + echo "=== Submitting job WITHOUT --container (queue default path) ===" + # The job above proves per-job container selection with --container. + # This one proves the queue-level default path: no container_name in + # the job spec, so DockerSubmitter must fall back to the + # containerImage inherited from the queue template + # (config/harvester/panda_queues.template.json), which for this run + # is overridden via PANDA_WORKER_IMAGE=python:3.13-alpine — a small + # public image, distinct from the per-job python:3.12-alpine, so + # each test proves its own path. + JOB_ID=$(python3 $PANDA_COMPOSE_DIR/scripts/pandajob-submit \ + --site PANDA_COMPOSE_LOCAL \ + --transformation sh \ + --output user.alice.ci.default-image.out.txt \ + --params "-c 'echo hello from queue-default image > user.alice.ci.default-image.out.txt; cat /etc/os-release | head -1'" \ + --name ci-queue-default-image-test) + echo "Submitted PanDA job ID: $JOB_ID" + if ! [[ "$JOB_ID" =~ ^[0-9]+$ ]]; then + echo "ERROR: expected integer job ID, got: $JOB_ID" + exit 1 + fi + + echo "=== Waiting for job to reach finished/failed (timeout 20 min) ===" + DEADLINE=$((SECONDS + 1200)) + while [[ $SECONDS -lt $DEADLINE ]]; do + JOB_STATUS=$(python3 $PANDA_COMPOSE_DIR/scripts/pandajob-status "$JOB_ID" \ + | python3 -c "import sys,json; print(json.load(sys.stdin)['jobStatus'])") + echo "[$(date -u '+%H:%M:%S')] Job status: $JOB_STATUS" + case "$JOB_STATUS" in + finished) break ;; + failed|cancelled) + echo "ERROR: job ended in terminal state '$JOB_STATUS'" + exit 1 ;; + esac + sleep 15 + done + if [[ "$JOB_STATUS" != "finished" ]]; then + echo "ERROR: job did not reach 'finished' within 20 minutes (last status: $JOB_STATUS)" + exit 1 + fi + + echo "=== Asserting the queue-default image was actually used ===" + # DockerSubmitter logs which image it picked per worker; prove the + # fallback went through the template (not a per-job override). + docker exec ${PANDA_COMPOSE_PROJECT}-harvester-1 \ + sh -c "grep 'using queue default container image=' /var/log/harvester/panda-docker_submitter.log | tail -1" + docker exec ${PANDA_COMPOSE_PROJECT}-harvester-1 \ + sh -c "grep 'using queue default container image=python:3.13-alpine' /var/log/harvester/panda-docker_submitter.log | tail -1" \ + || { echo "ERROR: queue-default job did not use PANDA_WORKER_IMAGE"; exit 1; } + echo "OK: queue-default container path verified" + - name: Verify job output landed in Rucio run: | echo "=== RSE contents ===" diff --git a/.gitignore b/.gitignore index ecc495d..eba88a4 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ *.key docker-compose.override.yml .hermes/ +__pycache__/ diff --git a/README.md b/README.md index fba2f78..903b37b 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,8 @@ Static configuration is mounted read-only into the containers: The default queue `PANDA_COMPOSE_LOCAL` uses Harvester's `DockerSubmitter` — jobs run as Docker containers on the host Docker daemon. The default container image is -`alpine:latest`; override per job with `--container IMAGE`. +`alpine:latest`; override per job with `--container IMAGE`, or for all jobs on a +queue with the `PANDA_WORKER_IMAGE` environment variable (see `.env.example`). ## Relation to panda-k8s @@ -122,7 +123,7 @@ echo "Submitted PanDA job $JOB_ID" | `--site SITE` | PanDA compute site / queue name (e.g. `TEST_SITE`, `PANDA_COMPOSE_LOCAL`) | | `--transformation PATH` | Executable to run inside the worker container | | `--params STRING` | Arguments passed to the transformation (default: `""`) | -| `--container IMAGE` | Docker image for the job worker (overrides queue default `alpine:latest`) | +| `--container IMAGE` | Docker image for the job worker (overrides queue default; see `PANDA_WORKER_IMAGE`) | | `--script PATH` | Script path (must be accessible inside the worker container) | | `--name NAME` | Human-readable job name (default: `panda-compose-job`) | | `--cores N` | CPU cores requested (default: 1) | diff --git a/docker-compose.yml b/docker-compose.yml index 4ac1646..977c822 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -302,6 +302,7 @@ services: PANDA_VERIFY_HOST: "off" HARVESTER_EXPERIMENT: ${HARVESTER_EXPERIMENT:-wlcg} PANDA_QUEUES: ${PANDA_QUEUES:-PANDA_COMPOSE_LOCAL} + PANDA_WORKER_IMAGE: ${PANDA_WORKER_IMAGE:-} RUCIO_HOME: /opt/rucio RUCIO_CONFIG: /opt/rucio/etc/rucio.cfg http_proxy: ${HTTP_PROXY:-} diff --git a/scripts/render-panda-queues.py b/scripts/render-panda-queues.py index 3d2b584..1df2269 100755 --- a/scripts/render-panda-queues.py +++ b/scripts/render-panda-queues.py @@ -45,6 +45,16 @@ def main(): if TEMPLATE_NAME not in config: sys.exit(f"template queue '{TEMPLATE_NAME}' missing from {template_path}") + # Queue-level worker image override. Concrete queues inherit the + # submitter block from the template queue via templateQueueName, so + # patching the template is enough. Without PANDA_WORKER_IMAGE the + # committed template default (alpine:latest) is kept. + worker_image = os.environ.get("PANDA_WORKER_IMAGE", "").strip() + if worker_image: + submitter = config[TEMPLATE_NAME].setdefault("submitter", {}) + submitter["containerImage"] = worker_image + print(f"Queue worker image override: {worker_image}") + for name in names: config[name] = concrete_queue() diff --git a/tests/test_render_panda_queues.py b/tests/test_render_panda_queues.py new file mode 100644 index 0000000..bb204e9 --- /dev/null +++ b/tests/test_render_panda_queues.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +"""Unit tests for scripts/render-panda-queues.py. + +Run with: python3 -m unittest discover -s tests -v +(or via pytest if available; stdlib-only so CI needs no extra deps) + +Covers the queue-template rendering contract: +- concrete queues are created for each PANDA_QUEUES entry +- concrete queues inherit the submitter block (incl. containerImage) from + the shared template queue via templateQueueName +- PANDA_WORKER_IMAGE patches the template's containerImage before rendering +- without PANDA_WORKER_IMAGE the committed template default is preserved +""" +import json +import subprocess +import sys +import tempfile +import unittest +from pathlib import Path + +REPO_ROOT = Path(__file__).resolve().parent.parent +SCRIPT = REPO_ROOT / "scripts" / "render-panda-queues.py" +TEMPLATE = REPO_ROOT / "config" / "harvester" / "panda_queues.template.json" + +TEMPLATE_QUEUE = "panda-compose-local.template" + + +def run_render(env_extra, template=TEMPLATE): + """Run the render script in a temp env; return (stdout, rendered config).""" + with tempfile.TemporaryDirectory() as tmp: + out = Path(tmp) / "panda_queues.cfg" + env = { + "PANDA_QUEUES_TEMPLATE": str(template), + "PANDA_QUEUES_OUTPUT": str(out), + # start from a clean env; the script only reads these three vars + "PANDA_QUEUES": "PANDA_COMPOSE_LOCAL", + "PANDA_WORKER_IMAGE": "", + } + env.update(env_extra) + proc = subprocess.run( + [sys.executable, str(SCRIPT)], + env=env, + capture_output=True, + text=True, + check=True, + ) + return proc.stdout, json.loads(out.read_text()) + + +class TestRenderPandaQueues(unittest.TestCase): + def test_committed_template_has_submitter_container_image(self): + """The shipped template must carry the queue-default worker image. + + This is the value DockerSubmitter falls back to when a job has no + per-job container_name; if it is missing or malformed every job + without an override breaks. + """ + config = json.loads(TEMPLATE.read_text()) + submitter = config[TEMPLATE_QUEUE]["submitter"] + self.assertEqual(submitter["name"], "DockerSubmitter") + self.assertTrue( + submitter.get("containerImage"), "containerImage must not be empty" + ) + + def test_concrete_queue_created(self): + _, config = run_render({"PANDA_QUEUES": "PANDA_COMPOSE_LOCAL E1_BNL"}) + self.assertIn("PANDA_COMPOSE_LOCAL", config) + self.assertIn("E1_BNL", config) + for name in ("PANDA_COMPOSE_LOCAL", "E1_BNL"): + self.assertEqual(config[name]["queueStatus"], "online") + self.assertEqual(config[name]["templateQueueName"], TEMPLATE_QUEUE) + + def test_default_image_preserved_without_override(self): + """No PANDA_WORKER_IMAGE => the committed template default is kept.""" + template_default = json.loads(TEMPLATE.read_text())[TEMPLATE_QUEUE][ + "submitter" + ]["containerImage"] + _, config = run_render({"PANDA_WORKER_IMAGE": ""}) + self.assertEqual( + config[TEMPLATE_QUEUE]["submitter"]["containerImage"], + template_default, + ) + + def test_worker_image_override_applied(self): + """PANDA_WORKER_IMAGE patches the template's containerImage.""" + stdout, config = run_render( + {"PANDA_WORKER_IMAGE": "panda-compose/snakemake-worker:9.27.1"} + ) + self.assertEqual( + config[TEMPLATE_QUEUE]["submitter"]["containerImage"], + "panda-compose/snakemake-worker:9.27.1", + ) + self.assertIn("panda-compose/snakemake-worker:9.27.1", stdout) + + +if __name__ == "__main__": + unittest.main() From 68c75eaf19876f23b118f94f1f04140fe7e7e832 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Fri, 20 Nov 2026 15:55:30 -0500 Subject: [PATCH 2/4] ci: make the queue-default image assertion actually assert MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit grep ... | tail -1 always exits 0 (a pipeline's status is the last command's), so the queue-default check could never fail the step — it only passed because the image happened to be correct. Drop the pipe for the assertion: grep -q exits 1 when the line is missing, failing the step. The informational grep | tail -1 above it is unchanged. --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf2d2a8..16353ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -230,10 +230,13 @@ jobs: echo "=== Asserting the queue-default image was actually used ===" # DockerSubmitter logs which image it picked per worker; prove the # fallback went through the template (not a per-job override). + # The informational grep below is a pipeline whose status is + # tail's, so it must not be reused for the assertion: grep -q + # fails the step when the line is missing. docker exec ${PANDA_COMPOSE_PROJECT}-harvester-1 \ sh -c "grep 'using queue default container image=' /var/log/harvester/panda-docker_submitter.log | tail -1" docker exec ${PANDA_COMPOSE_PROJECT}-harvester-1 \ - sh -c "grep 'using queue default container image=python:3.13-alpine' /var/log/harvester/panda-docker_submitter.log | tail -1" \ + grep -q 'using queue default container image=python:3.13-alpine' /var/log/harvester/panda-docker_submitter.log \ || { echo "ERROR: queue-default job did not use PANDA_WORKER_IMAGE"; exit 1; } echo "OK: queue-default container path verified" From b877c84d6ebb99c688cdb360a9cb8298e7d39ad1 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Fri, 20 Nov 2026 16:23:58 -0500 Subject: [PATCH 3/4] ci: assert the PANDA_WORKER_IMAGE override in the rendered config; fix stale comment The rendered-config check only asserted containerImage is non-empty, so a broken compose -> env -> render chain for PANDA_WORKER_IMAGE would only surface when the queue-default job lands in the wrong container ~4 minutes later. Assert the exact value CI sets (python:3.13-alpine) right after the health wait, catching the whole chain in seconds. Also update the first integration test's comment: the queue default in CI is no longer alpine:latest but the PANDA_WORKER_IMAGE override; the reasoning (deliberately distinct images prove each path) is unchanged. --- .github/workflows/ci.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16353ba..5401acc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,6 +70,10 @@ jobs: # submitter block (incl. containerImage) from the shared template # queue through templateQueueName — this is what DockerSubmitter # falls back to for jobs without a per-job container_name. + # This also checks the compose -> env -> render chain for + # PANDA_WORKER_IMAGE up front, in seconds, instead of letting a + # broken override surface only when the queue-default job below + # lands in the wrong container ~4 minutes later. # Runs after the health wait: the file only appears once the # harvester entrypoint finishes its setup and renders the config. docker exec ${PANDA_COMPOSE_PROJECT}-harvester-1 \ @@ -78,7 +82,7 @@ jobs: cfg = json.load(open('/var/lib/panda/panda_queues.cfg')) template = cfg['panda-compose-local.template'] assert template['submitter']['name'] == 'DockerSubmitter', template['submitter'] - assert template['submitter']['containerImage'], 'template containerImage must not be empty' + assert template['submitter']['containerImage'] == 'python:3.13-alpine', template['submitter'] queue = cfg['PANDA_COMPOSE_LOCAL'] assert queue['templateQueueName'] == 'panda-compose-local.template', queue print('rendered queue config OK; template containerImage =', template['submitter']['containerImage']) @@ -98,8 +102,9 @@ jobs: # Use --container to specify a per-job container image, mirroring PanDA's # production container_name field. The DockerSubmitter reads this from # job.jobParams["container_name"] and prefers it over the queue-level default. - # python:3.12-alpine is deliberately different from the queue default (alpine:latest) - # to prove per-job container selection is working. + # python:3.12-alpine is deliberately different from the queue default + # (PANDA_WORKER_IMAGE=python:3.13-alpine in this run) to prove per-job + # container selection is working. JOB_ID=$(python3 $PANDA_COMPOSE_DIR/scripts/pandajob-submit \ --site PANDA_COMPOSE_LOCAL \ --container python:3.12-alpine \ From 0d758c1de52b44c24eb2afed37685c017ce60d6c Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Fri, 20 Nov 2026 17:09:48 -0500 Subject: [PATCH 4/4] review: harden the worker-image override per review - render-panda-queues.py: a missing submitter block now fails loudly (sys.exit) instead of setdefault silently creating a nameless, module-less block that no harvester could use - tests: cover that failure mode; fix the env comment (four vars, not three); keep a minimal PATH in the test env in case the script ever shells out - smoke test: assert BOTH jobs' output LFNs are registered in Rucio, not just that some file DID exists (the first job's output alone would satisfy the old check); pattern matches the search's bare JSON list response Co-authored-by: Hermes Agent --- .github/workflows/ci.yml | 22 ++++++++++++++-------- scripts/render-panda-queues.py | 7 ++++++- tests/test_render_panda_queues.py | 14 +++++++++++++- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5401acc..8f939ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -264,14 +264,20 @@ jobs: 'http://localhost/dids/user.alice/dids/search?type=file') echo "$DIDS" - if [[ -z "$DIDS" || "$DIDS" == "[]" ]]; then - echo "ERROR: no output DIDs registered in Rucio scope user.alice" - echo "--- stager log ---" - docker exec ${PANDA_COMPOSE_PROJECT}-harvester-1 \ - tail -n 50 /var/log/harvester/panda-stager.log 2>/dev/null || true - exit 1 - fi - echo "OK: job output is registered in Rucio" + # Both integration jobs declare an output LFN; each must have been + # staged out and registered, otherwise the step passes on the first + # job's output alone. The search returns a bare JSON list of names, + # e.g. ["user.alice.ci.out.txt"]. + for LFN in user.alice.ci.out.txt user.alice.ci.default-image.out.txt; do + if ! grep -q "\"$LFN\"" <<<"$DIDS"; then + echo "ERROR: output DID $LFN not registered in Rucio scope user.alice" + echo "--- stager log ---" + docker exec ${PANDA_COMPOSE_PROJECT}-harvester-1 \ + tail -n 50 /var/log/harvester/panda-stager.log 2>/dev/null || true + exit 1 + fi + done + echo "OK: outputs of both jobs are registered in Rucio" - name: Dump all service logs if: always() diff --git a/scripts/render-panda-queues.py b/scripts/render-panda-queues.py index 1df2269..df1d63b 100755 --- a/scripts/render-panda-queues.py +++ b/scripts/render-panda-queues.py @@ -51,7 +51,12 @@ def main(): # committed template default (alpine:latest) is kept. worker_image = os.environ.get("PANDA_WORKER_IMAGE", "").strip() if worker_image: - submitter = config[TEMPLATE_NAME].setdefault("submitter", {}) + submitter = config[TEMPLATE_NAME].get("submitter") + if not isinstance(submitter, dict): + sys.exit( + f"submitter block missing from template queue '{TEMPLATE_NAME}' " + f"in {template_path}; cannot apply PANDA_WORKER_IMAGE={worker_image}" + ) submitter["containerImage"] = worker_image print(f"Queue worker image override: {worker_image}") diff --git a/tests/test_render_panda_queues.py b/tests/test_render_panda_queues.py index bb204e9..0750507 100644 --- a/tests/test_render_panda_queues.py +++ b/tests/test_render_panda_queues.py @@ -29,10 +29,13 @@ def run_render(env_extra, template=TEMPLATE): """Run the render script in a temp env; return (stdout, rendered config).""" with tempfile.TemporaryDirectory() as tmp: out = Path(tmp) / "panda_queues.cfg" + # The env carries exactly what the script reads: the template and + # output paths plus PANDA_QUEUES and PANDA_WORKER_IMAGE. A minimal + # PATH is kept in case the script ever shells out. env = { + "PATH": "/usr/bin:/bin", "PANDA_QUEUES_TEMPLATE": str(template), "PANDA_QUEUES_OUTPUT": str(out), - # start from a clean env; the script only reads these three vars "PANDA_QUEUES": "PANDA_COMPOSE_LOCAL", "PANDA_WORKER_IMAGE": "", } @@ -92,6 +95,15 @@ def test_worker_image_override_applied(self): ) self.assertIn("panda-compose/snakemake-worker:9.27.1", stdout) + def test_worker_image_override_requires_submitter_block(self): + """PANDA_WORKER_IMAGE with a submitter-less template fails loudly.""" + with tempfile.TemporaryDirectory() as tmp: + bad = Path(tmp) / "template.json" + bad.write_text(json.dumps({TEMPLATE_QUEUE: {}})) + with self.assertRaises(subprocess.CalledProcessError) as ctx: + run_render({"PANDA_WORKER_IMAGE": "img:latest"}, template=bad) + self.assertIn("submitter block missing", ctx.exception.stderr) + if __name__ == "__main__": unittest.main()