Skip to content

Commit

Permalink
super hack: multiple rankings
Browse files Browse the repository at this point in the history
  • Loading branch information
Virv12 committed Nov 7, 2024
1 parent 62fa2e1 commit 785ebfa
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 19 deletions.
12 changes: 9 additions & 3 deletions cms/service/ProxyService.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,10 @@ def __init__(self, shard, contest_id):
"""
super().__init__(shard)

self.contest_id = contest_id
if hasattr(config, "proxy_service_contest_id"):
self.contest_id = config.proxy_service_contest_id[shard]
else:
self.contest_id = contest_id

# Store what data we already sent to rankings, to avoid
# sending it twice.
Expand All @@ -272,8 +275,11 @@ def __init__(self, shard, contest_id):

# Create one executor for each ranking.
self.rankings = list()
for ranking in config.rankings:
self.add_executor(ProxyExecutor(ranking))
if hasattr(config, "proxy_service_contest_id"):
self.add_executor(ProxyExecutor(config.rankings[shard]))
else:
for ranking in config.rankings:
self.add_executor(ProxyExecutor(ranking))

# Enqueue the dispatch of some initial data to rankings. Needs
# to be done before the sweeper is started, as otherwise RWS
Expand Down
2 changes: 1 addition & 1 deletion docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ done

cd "$CONTEXT"

components=(base core cws worker rws)
components=(base core cws worker rws ps)

for comp in "${components[@]}"; do
image="ghcr.io/$ghcr_user/cms-$comp"
Expand Down
14 changes: 0 additions & 14 deletions docker/core/root/etc/services.d/cmsProxyService/run

This file was deleted.

11 changes: 10 additions & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,21 @@ services:
PUID: 1000
PGID: 1000
TZ: Europe/Rome
CMS_PROXY_SERVICE_DISABLED: "false"
volumes:
- ./volumes/config:/config
ports:
- 8889:8889

ps:
image: ghcr.io/edomora97/cms-ps
environment:
PUID: 1000
PGID: 1000
TZ: Europe/Rome
CMS_SHARD:
volumes:
- ./volumes/config:/config

cws:
image: ghcr.io/edomora97/cms-cws
environment:
Expand Down
9 changes: 9 additions & 0 deletions docker/ps/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM ghcr.io/edomora97/cms-base

LABEL org.opencontainers.image.source=https://github.com/edomora97/cms
LABEL maintainer="Edoardo Morassutto <edoardo.morassutto@gmail.com>"

ENV CMS_CONTEST_ID=
ENV CMS_SHARD=

COPY docker/ps/root /
9 changes: 9 additions & 0 deletions docker/ps/root/etc/services.d/cmsProxyService/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/with-contenv bash

shard=${CMS_SHARD:-0}

if [ -n "$CMS_CONTEST_ID" ]; then
exec cmsProxyService -c "$CMS_CONTEST_ID" "$shard"
else
echo | exec cmsProxyService "$shard"
fi

0 comments on commit 785ebfa

Please sign in to comment.