Skip to content

Commit

Permalink
cleaned the settings.py and settings-test.py up a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMrSheldon committed Sep 6, 2024
1 parent c6e92ec commit c8f81e5
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 30 deletions.
6 changes: 2 additions & 4 deletions application/config/tira-application-config.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ allowed_hosts:
django_secret: "not-so-secret"
# ---
tira_root: !ENV ${TIRA_ROOT:/tira}
# deployment = {disraptor}
# TODO: remove deployment configuration key
deployment: disraptor
disraptor_secret_file: /etc/discourse/client-api-key
# The directory where logs are written to. Defaults to TIRA_ROOT/log/tira-application
# logging_dir: /mnt/ceph/tira/log/tira-application
Expand All @@ -23,4 +20,5 @@ database:
password: TODO-ENTER-PASSWORD # ignored when using sqlite3
host: tira-mariadb # ignored when using sqlite3
port: 3306 # ignored when using sqlite3
github_token: TODO-ENTER-TOKEN
github_token: !ENV ${TIRA_GITHUB_TOKEN}
discourse_api_url: !ENV ${DISCOURSE_API_URL:https://www.tira.io}
5 changes: 2 additions & 3 deletions application/config/tira-application-config.docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ allowed_hosts:
django_secret: "not-so-secret"
# ---
tira_root: !ENV ${TIRA_ROOT:/tira}
# deployment = {disraptor}
deployment: disraptor
# disraptor_secret_file: /etc/discourse/client-api-key
# The directory where logs are written to. Defaults to TIRA_ROOT/log/tira-application
# logging_dir: /mnt/ceph/tira/log/tira-application
Expand All @@ -22,4 +20,5 @@ database:
password: TODO-ENTER-PASSWORD # ignored when using sqlite3
host: tira-mariadb # ignored when using sqlite3
port: 3306 # ignored when using sqlite3

github_token: !ENV ${TIRA_GITHUB_TOKEN}
discourse_api_url: !ENV ${DISCOURSE_API_URL:https://www.tira.io}
6 changes: 3 additions & 3 deletions application/src/django_admin/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import os
from pathlib import Path

import yaml
from pyaml_env import parse_config

# Build paths inside the project like this: BASE_DIR / 'subdir'.
Expand Down Expand Up @@ -49,7 +50,6 @@

(TIRA_ROOT / "state").mkdir(parents=True, exist_ok=True)

DEPLOYMENT = custom_settings.get("deployment", "disraptor")
DISRAPTOR_SECRET_FILE = Path(custom_settings.get("disraptor_secret_file", "/etc/discourse/client-api-key"))
HOST_GRPC_PORT = custom_settings.get("host_grpc_port", "50051")
APPLICATION_GRPC_PORT = custom_settings.get("application_grpc_port", "50052")
Expand Down Expand Up @@ -328,7 +328,7 @@ def logger_config(log_dir: Path):
' ${inputDataset}/qrels.txt --output ${outputDir} --measures "P@10" "nDCG@10" "MRR"',
)

GITHUB_TOKEN = custom_settings.get("github_token", "<TOKEN>")
GITHUB_TOKEN = custom_settings["github_token"]

# Caching
CACHES = {
Expand Down Expand Up @@ -392,7 +392,7 @@ def logger_config(log_dir: Path):

USE_TZ = True

DISCOURSE_API_URL = "https://www.tira.io"
DISCOURSE_API_URL = custom_settings["discourse_api_url"]
PUBLIC_TRAINING_DATA = set(["jena-topics-20231026-test", "leipzig-topics-20231025-test"])

CODE_SUBMISSION_REFERENCE_REPOSITORIES = {
Expand Down
2 changes: 1 addition & 1 deletion application/src/tira_app/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ def user_is_organizer_for_endpoint(
)


auth = Authentication(authentication_source=settings.DEPLOYMENT)
auth = Authentication(authentication_source="disraptor")


"""
Expand Down
48 changes: 29 additions & 19 deletions application/test/settings_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@

(TIRA_ROOT / "state").mkdir(parents=True, exist_ok=True)

DEPLOYMENT = "disraptor"
DISRAPTOR_SECRET_FILE = Path(custom_settings.get("disraptor_secret_file", "/etc/discourse/client-api-key"))
HOST_GRPC_PORT = custom_settings.get("host_grpc_port", "50051")
APPLICATION_GRPC_PORT = custom_settings.get("application_grpc_port", "50052")
Expand Down Expand Up @@ -246,13 +245,29 @@ def logger_config(log_dir: Path):
}


# Git Integration
GIT_CI_AVAILABLE_RESOURCES = {
"small-resources": {
"cores": 1,
"ram": 10,
"gpu": 0,
"data": "no",
"description": "Small (1 CPU Cores, 10GB of RAM)",
"key": "small-resources",
},
}

DEFAULT_GIT_INTEGRATION_URL = "https://git.webis.de/code-research/tira"

IR_MEASURES_IMAGE = custom_settings.get("IR_MEASURES_IMAGE", "webis/tira-ir-measures-evaluator:0.0.1")
IR_MEASURES_COMMAND = custom_settings.get(
"IR_MEASURES_COMMAND",
"/ir_measures_evaluator.py --run ${inputRun}/run.txt --topics ${inputDataset}/queries.jsonl --qrels"
' ${inputDataset}/qrels.txt --output ${outputDir} --measures "P@10" "nDCG@10" "MRR"',
)

GITHUB_TOKEN = custom_settings["github_token"]

# Caching
CACHES = {
"default": {
Expand All @@ -263,6 +278,10 @@ def logger_config(log_dir: Path):
}
}

TIREX_COMPONENTS = yaml.load(
(resources.files("tira_app.res") / "tirex-components.yml").read_bytes(), Loader=yaml.FullLoader
)

# Logging
ld = Path(custom_settings.get("logging_dir", TIRA_ROOT / "log" / "tira-application"))
try:
Expand Down Expand Up @@ -311,27 +330,18 @@ def logger_config(log_dir: Path):

USE_TZ = True

TIREX_COMPONENTS = yaml.load(
(resources.files("tira_app.res") / "tirex-components.yml").read_bytes(), Loader=yaml.FullLoader
)

GIT_CI_AVAILABLE_RESOURCES = {
"small-resources": {
"cores": 1,
"ram": 10,
"gpu": 0,
"data": "no",
"description": "Small (1 CPU Cores, 10GB of RAM)",
"key": "small-resources",
}
}
DISCOURSE_API_URL = custom_settings["discourse_api_url"]
PUBLIC_TRAINING_DATA = set(["jena-topics-20231026-test", "leipzig-topics-20231025-test"])

CODE_SUBMISSION_REFERENCE_REPOSITORIES = {
"ir-lab-jena-leipzig-wise-2023": "mam10eks/tira-software-submission-template",
"webpage-classification": "OpenWebSearch/irixys23-tira-submission-template",
}
CODE_SUBMISSION_REPOSITORY_NAMESPACE = "tira-io"
DISRAPTOR_API_KEY = ""
DISCOURSE_API_URL = ""
PUBLIC_TRAINING_DATA = set(["jena-topics-20231026-test", "leipzig-topics-20231025-test"])

REFERENCE_DATASETS: dict[str, str] = {}

CODE_SUBMISSION_REPOSITORY_NAMESPACE = "tira-io"
try:
DISRAPTOR_API_KEY = open(DISRAPTOR_SECRET_FILE, "r").read().strip()
except Exception:
pass

0 comments on commit c8f81e5

Please sign in to comment.