From 10725b91a2e09a0a4f136578162300799eb4278d Mon Sep 17 00:00:00 2001 From: joschrew Date: Wed, 19 Jul 2023 14:53:58 +0200 Subject: [PATCH] Get processor name in delegator from argv --- Makefile-slim | 2 +- slim-containers-files/delegator_template.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile-slim b/Makefile-slim index b300407c..f358550a 100644 --- a/Makefile-slim +++ b/Makefile-slim @@ -14,7 +14,7 @@ slim-venv: docker-compose.yaml .env $(DELEGATORS) | $(VIRTUAL_ENV) # create a delegator to the processing server for the processor $(BIN)/ocrd-%: | $(VIRTUAL_ENV) - @sed -e "s/{{\s*processor_name\s*}}/$(subst $(BIN)/,,$@)/" -e "s/{{\s*OCRD_PS_PORT\s*}}/$(OCRD_PS_PORT)/" slim-containers-files/delegator_template.py > $@; + @sed -e "s/{{\s*OCRD_PS_PORT\s*}}/$(OCRD_PS_PORT)/" slim-containers-files/delegator_template.py > $@; @chmod u+x $@ diff --git a/slim-containers-files/delegator_template.py b/slim-containers-files/delegator_template.py index 22081139..34f06577 100755 --- a/slim-containers-files/delegator_template.py +++ b/slim-containers-files/delegator_template.py @@ -2,9 +2,10 @@ import sys import subprocess from http.server import BaseHTTPRequestHandler, HTTPServer +from os.path import basename processing_server_address = "http://localhost:{{ OCRD_PS_PORT }}" -processor_name = "{{ processor_name }}" +processor_name = basename(sys.argv[0]) STOP_WAITING_SERVER = False