Merge branch '2.0.0' into 2.0.0-refactoring

This commit is contained in:
Matthias Bisping 2022-06-20 12:46:50 +02:00
commit e73cfe5d87
2 changed files with 5 additions and 4 deletions

View File

@ -7,7 +7,7 @@ service:
response_folder: $RESPONSE_FOLDER|null
# Specifies, how to handle the `page` key of a request. "multi" will download all pages matching the list of pages
# specified in the request
download_strategy: single
download_strategy: $DOWNLOAD_STRATEGY|single
probing_webserver:
host: $PROBING_WEBSERVER_HOST|"0.0.0.0" # Probe webserver address

View File

@ -52,14 +52,15 @@ def __set_up_processing_server_impl(operation2function: Dict[str, QueuedStreamFu
op: LazyRestProcessor(fn, **build_endpoint_suffixes(op)) for op, fn in operation2function.items()
}
def make_summary_instance(op):
def make_summary_instance(op: str):
op = op.replace("_pickup", "")
return Summary(f"redactmanager_{op}_seconds", f"Time spent on {op}.", registry=registry)
submit_operation2processor = {submit_suffix(op): prc for op, prc in operation2processor.items()}
pickup_operation2processor = {pickup_suffix(op): prc for op, prc in operation2processor.items()}
operation2processor = merge(submit_operation2processor, pickup_operation2processor)
operation2metric = {op: make_summary_instance(op) for op in operation2processor}
operation2metric = {op: make_summary_instance(op) for op in pickup_operation2processor}
@app.route("/ready", methods=["GET"])
def ready():
@ -83,7 +84,7 @@ def __set_up_processing_server_impl(operation2function: Dict[str, QueuedStreamFu
@app.route("/<operation>", methods=["GET"])
def pickup(operation):
with operation2metric[operation.replace("_pickup", "")].time():
with operation2metric[operation].time():
return operation2processor[operation].pop()
return app