Skip to content

Commit 7712185

Browse files
authored
Merge branch 'master' into notifications-python
2 parents 39252e2 + 5cce632 commit 7712185

File tree

206 files changed

+7483
-1729
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

206 files changed

+7483
-1729
lines changed

.github/workflows/cypress.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
timeout-minutes: 60
1414

1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1717
- name: Install `easy_toolbox.py` requirements
1818
run: |
1919
python -m pip install --upgrade pip

.github/workflows/doc.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@v3
13-
- name: Set up Python 3.10
14-
uses: actions/setup-python@v4
12+
- uses: actions/checkout@v4
13+
- name: Set up Python 3.11
14+
uses: actions/setup-python@v5
1515
with:
16-
python-version: '3.10'
16+
python-version: '3.11'
1717

1818
- name: Install apt dependencies
1919
run: |

.github/workflows/nightly.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v3
15-
- name: Set up Python 3.10
16-
uses: actions/setup-python@v4
14+
- uses: actions/checkout@v4
15+
- name: Set up Python 3.11
16+
uses: actions/setup-python@v5
1717
with:
18-
python-version: '3.10'
18+
python-version: '3.11'
1919

2020
- name: Install apt dependencies
2121
run: |

.github/workflows/pytest.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v3
17-
- name: Set up Python 3.10
18-
uses: actions/setup-python@v4
16+
- uses: actions/checkout@v4
17+
- name: Set up Python 3.11
18+
uses: actions/setup-python@v5
1919
with:
20-
python-version: '3.10'
20+
python-version: '3.11'
2121

2222
- name: Install apt dependencies
2323
run: |

.github/workflows/translations-download.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ jobs:
1616
runs-on: ubuntu-latest
1717

1818
steps:
19-
- uses: actions/checkout@v3
20-
- name: Set up Python 3.10
21-
uses: actions/setup-python@v4
19+
- uses: actions/checkout@v4
20+
- name: Set up Python 3.11
21+
uses: actions/setup-python@v5
2222
with:
23-
python-version: '3.10'
23+
python-version: '3.11'
2424

2525
- name: Install apt dependencies
2626
run: |

.github/workflows/translations-upload.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ jobs:
1616
runs-on: ubuntu-latest
1717

1818
steps:
19-
- uses: actions/checkout@v3
20-
- name: Set up Python 3.10
21-
uses: actions/setup-python@v4
19+
- uses: actions/checkout@v4
20+
- name: Set up Python 3.11
21+
uses: actions/setup-python@v5
2222
with:
23-
python-version: '3.10'
23+
python-version: '3.11'
2424

2525
- name: Install apt dependencies
2626
run: |

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.10 AS base
1+
FROM python:3.11 AS base
22

33
ENV PYTHONUNBUFFERED 1
44

@@ -56,7 +56,7 @@ USER oioioi
5656
ENV PATH $PATH:/home/oioioi/.local/bin/
5757

5858
ENV BERKELEYDB_DIR /usr
59-
RUN pip3 install --user psycopg2-binary==2.8.6 twisted uwsgi
59+
RUN pip3 install --user psycopg2-binary==2.9.5 twisted uwsgi
6060
RUN pip3 install --user bsddb3==6.2.7
6161

6262
WORKDIR /sio2/oioioi
@@ -75,7 +75,7 @@ WORKDIR /sio2/deployment
7575
RUN mkdir -p /sio2/deployment/logs/{supervisor,runserver}
7676

7777
# The stage below is independent of base and can be built in parallel to optimize build time.
78-
FROM python:3.10 AS development-sandboxes
78+
FROM python:3.11 AS development-sandboxes
7979

8080
ENV DOWNLOAD_DIR=/sio2/sandboxes
8181
ENV MANIFEST_URL=https://downloads.sio2project.mimuw.edu.pl/sandboxes/Manifest

UPGRADING.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,35 @@ Then run::
1212

1313
and restart the judging machines.
1414

15+
Fast Django Migration to 5.2 (Important for Large OIOIOI Instances)
16+
-----------------------------------
17+
18+
The following migrations require removing an index (created by the deprecated ``index_together``) and creating a new one:
19+
20+
* ``oi/migrations/0008_sync_indexes_state.py``
21+
* ``forum/migrations/0013_sync_indexes_state.py``
22+
* ``contests/migrations/0021_sync_indexes_state.py``
23+
24+
Since dropping and then creating an index takes a long time for instances with a very large number of submissions, you can speed this up as follows:
25+
26+
Because these indexes are in the database schema, you should mark these migrations (``0008_sync_indexes_state.py``, ``0021_sync_indexes_state.py``, ``0013_sync_indexes_state.py``) as fake.
27+
See the `django docs <https://docs.djangoproject.com/en/5.2/ref/django-admin/#cmdoption-migrate-fake>`_ for details.
28+
Then, rename the existing indexes created by ``IndexTogether`` to the corresponding names specified in these migrations.
29+
You can manually identify the indexes by checking which two fields they cover.
30+
31+
For example, an index named ``forum_post_thread_id_add_date_6d8ec21d_idx`` should be renamed to ``forum_post_thread__54acb8_idx``.
32+
Similarly, rename the other indexes so that the database state is correct, i.e., the database contains indexes with the names specified in the migrations.
33+
34+
After these steps, you will achieve a consistent database state without waiting a long time for the migrations to complete.
35+
36+
::
37+
38+
python manage.py migrate oi 0008 --fake
39+
40+
python manage.py migrate forum 0021 --fake
41+
42+
python manage.py migrate contests 0013 --fake
43+
1544
Changes in the deployment directory
1645
-----------------------------------
1746

conftest.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44

55
from oioioi.base.tests import pytest_plugin as base_plugin
66
from oioioi.contests.tests import pytest_plugin as contests_plugin
7+
from django.conf import settings
78

89

910
def pytest_addoption(parser):
1011
parser.addoption(
1112
'--runslow', action='store_true', default=False, help="run slow tests"
1213
)
14+
parser.addoption(
15+
'--strict-template-vars', action='store_true', help="Raise errors for undefined template variables")
1316

1417

1518
# called for running each test
@@ -18,6 +21,12 @@ def pytest_runtest_setup(item):
1821
base_plugin.pytest_runtest_setup(item)
1922

2023

24+
def pytest_configure(config):
25+
if config.getoption("--strict-template-vars"):
26+
# this will raise an error if a template variable is not defined
27+
settings.TEMPLATES[0]['OPTIONS']['string_if_invalid'] = '{% templatetag openvariable %} INVALID_VAR: %s {% templatetag closevariable %}'
28+
29+
2130
def pytest_collection_modifyitems(config, items):
2231
# --runslow flag: do not skip slow tests
2332
if config.getoption('--runslow', False):
@@ -29,12 +38,12 @@ def pytest_collection_modifyitems(config, items):
2938

3039

3140
# Removing links column from html report
32-
@pytest.mark.optionalhook
41+
@pytest.hookimpl(optionalhook=True)
3342
def pytest_html_results_table_header(cells):
3443
cells.pop()
3544

3645

3746
# Removing links column from html report
38-
@pytest.mark.optionalhook
47+
@pytest.hookimpl(optionalhook=True)
3948
def pytest_html_results_table_row(report, cells):
4049
cells.pop()

docker-compose-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ x-common-envs: &common-envs
55

66
services:
77
db:
8-
image: library/postgres:12.2
8+
image: library/postgres:14.17
99
environment:
1010
POSTGRES_USER: "oioioi"
1111
POSTGRES_PASSWORD: "password"

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ x-common-envs: &common-envs
55

66
services:
77
db:
8-
image: library/postgres:12.2
8+
image: library/postgres:14.17
99
environment:
1010
POSTGRES_USER: "oioioi"
1111
POSTGRES_PASSWORD: "password"

0 commit comments

Comments
 (0)