Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

type docker folder #12280

Merged
merged 5 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/12280.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add missing type definition for scripts in docker folder. Contributed by Jorge Florian.
squahtx marked this conversation as resolved.
Show resolved Hide resolved
11 changes: 6 additions & 5 deletions docker/configure_workers_and_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import os
import subprocess
import sys
from typing import Dict, Set, cast

import jinja2
import yaml
Expand Down Expand Up @@ -339,7 +340,7 @@ def generate_worker_files(environ, config_path: str, data_dir: str):
# base shared worker jinja2 template.
#
# This config file will be passed to all workers, included Synapse's main process.
shared_config = {"listeners": listeners}
shared_config: dict = {"listeners": listeners}
squahtx marked this conversation as resolved.
Show resolved Hide resolved

# The supervisord config. The contents of which will be inserted into the
# base supervisord jinja2 template.
Expand All @@ -355,7 +356,7 @@ def generate_worker_files(environ, config_path: str, data_dir: str):
# worker_type: {1234, 1235, ...}}
# }
# and will be used to construct 'upstream' nginx directives.
nginx_upstreams = {}
nginx_upstreams: Dict[str, Set[int]] = {}

# A map of: {"endpoint": "upstream"}, where "upstream" is a str representing what will be
# placed after the proxy_pass directive. The main benefit to representing this data as a
Expand Down Expand Up @@ -384,7 +385,7 @@ def generate_worker_files(environ, config_path: str, data_dir: str):
# A counter of worker_type -> int. Used for determining the name for a given
# worker type when generating its config file, as each worker's name is just
# worker_type + instance #
worker_type_counter = {}
worker_type_counter: Dict[str, int] = {}

# For each worker type specified by the user, create config values
for worker_type in worker_types:
Expand All @@ -404,11 +405,11 @@ def generate_worker_files(environ, config_path: str, data_dir: str):
# e.g. federation_reader1
worker_name = worker_type + str(new_worker_count)
worker_config.update(
{"name": worker_name, "port": worker_port, "config_path": config_path}
{"name": worker_name, "port": str(worker_port), "config_path": config_path}
)

# Update the shared config with any worker-type specific options
shared_config.update(worker_config["shared_extra_conf"])
shared_config.update(cast(dict, worker_config["shared_extra_config"]))
squahtx marked this conversation as resolved.
Show resolved Hide resolved

# Check if more than one instance of this worker type has been specified
worker_type_total_count = worker_types.count(worker_type)
Expand Down
1 change: 1 addition & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ local_partial_types = True
no_implicit_optional = True

files =
docker/,
scripts-dev/,
setup.py,
synapse/,
Expand Down