Skip to content

Commit

Permalink
Merge pull request #601 from tira-io/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
mam10eks authored Jan 16, 2024
2 parents 48e4903 + 69fa9bc commit ff0eabe
Show file tree
Hide file tree
Showing 20 changed files with 1,162 additions and 920 deletions.
2 changes: 1 addition & 1 deletion .devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"image": "webis/tira-application:basis-0.0.95",
"image": "webis/tira-application:basis-0.0.96",
"customizations": {
"vscode": {
"extensions": ["ms-python.python", "ms-python.vscode-pylance", "ms-toolsai.jupyter"]
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@ Run `make` to get an overview of all commands that will setup a self-contained t
~$ make run-develop
```

3. Optionally: To work on real data, initialize your development database from a database dump
3. Optionally: To work on real data, initialize your development database from a database dump via
```bash
~$ make import-data-from-dump
```
or to work with mock data run:
```bash
~$ cd application
~$ make import-mock-data
```


## Paper
Expand Down
2 changes: 1 addition & 1 deletion application/.devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"image": "webis/tira-application:basis-0.0.95",
"image": "webis/tira-application:basis-0.0.96",
"customizations": {
"vscode": {
"extensions": ["ms-python.python", "ms-python.vscode-pylance", "ms-toolsai.jupyter"]
Expand Down
4 changes: 2 additions & 2 deletions application/Dockerfile.application
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Build Vuetify in first stage: Only change in case of new / updated dependencies
FROM webis/tira:vuetify-dev-0.0.1
FROM webis/tira-application:basis-0.0.97

COPY application/src/tira/frontend-vuetify /src/tira/frontend-vuetify

Expand All @@ -9,7 +9,7 @@ RUN cd /src/tira/frontend-vuetify \


# Only change in case of new / updated dependencies
FROM webis/tira-application:basis-0.0.95
FROM webis/tira-application:basis-0.0.96

# This Dockerfile ensures that all dependencies do rarely change by starting from a basis image
# that contains already all dependencies (so that the minor versions do rarely change, but we
Expand Down
4 changes: 3 additions & 1 deletion application/Dockerfile.application-dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# docker build -t webis/tira-application:basis-0.0.95 -f Dockerfile.application-dev .
# docker build -t webis/tira-application:basis-0.0.97 -f Dockerfile.application-dev .
FROM ubuntu:22.04

RUN apt-get update \
Expand Down Expand Up @@ -76,3 +76,5 @@ RUN cd /tmp-del \
&& apt-get install -y vim htop bash-completion \
&& echo "\n. /usr/share/bash-completion/bash_completion" >> ~/.bashrc

ENV PATH=${PATH}:./usr/local/lib/node_modules/.bin

7 changes: 5 additions & 2 deletions application/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: help setup run-develop build-docker clean

VERSION_APPLICATION=0.0.97
VERSION_GRPC=0.0.97
VERSION_APPLICATION=0.0.99
VERSION_GRPC=0.0.99

.DEFAULT: help
help:
Expand Down Expand Up @@ -73,6 +73,9 @@ import-data-from-dump: .data-dumps/django-db-dump.zip
${PYTHON} src/manage.py migrate tira && \
${PYTHON} src/manage.py loaddata .data-dumps/django-db-dump.json

import-mock-data:
${PYTHON} src/manage.py loaddata mock-data/mock-data.json

vite-build-docker:
docker run -v ${PWD}:/app --platform linux/amd64 --rm -ti -w /app/src/tira/frontend-vuetify --entrypoint yarn webis/tira-application:basis-0.0.95 build

Expand Down
204 changes: 204 additions & 0 deletions application/mock-data/mock-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
[
{
"model": "tira.organizer",
"pk": "org_1",
"fields": {
"name": "org_1",
"years": "2022",
"web": "https://www.organizer1.com",
"git_integrations": []
}

},
{
"model": "tira.organizer",
"pk": "org_2",
"fields": {
"name": "org_2",
"years": "2023",
"web": "https://www.organizer2.com",
"git_integrations": []
}

},
{
"model": "tira.virtualmachine",
"pk": "vm_1",
"fields": {
"user_password": "vm_password_1",
"roles": "guest",
"host": "host1.example.com",
"admin_name": "admin_1",
"admin_pw": "admin_pw_1",
"ip": "192.168.0.1",
"ssh": 22,
"rdp": null,
"archived": false
}

},
{
"model": "tira.virtualmachine",
"pk": "vm_2",
"fields": {
"user_password": "vm_password_2",
"roles": "admin",
"host": "host2.example.com",
"admin_name": "admin_2",
"admin_pw": "admin_pw_2",
"ip": "192.168.0.2",
"ssh": 22,
"rdp": 3389,
"archived": false
}

}
,
{
"model": "tira.task",
"pk": "task_1",
"fields": {
"task_name": "task_1",
"task_description": "Description for Task 1",
"vm": "vm_1",
"organizer": "org_1",
"web": "https://www.task1.com",
"featured": true,
"require_registration": false,
"require_groups": false,
"restrict_groups": false,
"max_std_out_chars_on_test_data": 1000,
"max_std_err_chars_on_test_data": 500,
"max_file_list_chars_on_test_data": 2000
}

},
{
"model": "tira.task",
"pk": "task_2",
"fields": {
"task_name": "Task 2",
"task_description": "Description for Task 2",
"vm": "vm_2",
"organizer": "org_2",
"web": "https://www.task2.com",
"featured": false,
"require_registration": false,
"require_groups": false,
"restrict_groups": true,
"max_std_out_chars_on_test_data": 1500,
"max_std_err_chars_on_test_data": 600,
"max_file_list_chars_on_test_data": 2500
}

},
{
"model": "tira.dataset",
"pk": "",
"fields": {
"default_task": null,
"display_name": "",
"evaluator": null,
"is_confidential": false,
"is_deprecated": false,
"data_server": null,
"released": "",
"default_upload_name": "predictions",
"created": "2022-08-11",
"last_modified": "2022-08-11",
"irds_docker_image": null,
"irds_import_command": null,
"irds_import_truth_command": null
}
},
{
"model": "tira.dataset",
"pk": "dataset_1",
"fields": {
"default_task": "task_1",
"display_name": "dataset_1",
"evaluator": null,
"is_confidential": false,
"is_deprecated": false,
"data_server": null,
"released": "",
"default_upload_name": "predictions",
"created": "2022-08-11",
"last_modified": "2022-08-11",
"irds_docker_image": null,
"irds_import_command": null,
"irds_import_truth_command": null
}
},
{
"model": "tira.software",
"pk": 1,
"fields": {
"software_id": "software1",
"vm": "vm_1",
"task": "task_1",
"count": "1",
"command": "./test.exe $inputDataset $outputDir",
"working_directory": "/cygdrive/c/Users/vm_1/test/t30_new",
"dataset": "dataset_1",
"creation_date": "Sat Jan 23 12:42:39 CET 2023",
"last_edit_date": "Sat Jan 23 12:42:39 CET 2023",
"deleted": false
}
},
{
"model": "tira.dockersoftware",
"pk": 1,
"fields": {
"vm": "vm_1",
"task": "task_1",
"input_docker_software": null,
"input_upload": null,
"command": "echo \"Hallo Welt, this is my first command\"",
"display_name": "inverse-eaves",
"user_image_name": "registry.webis.de/code-research/tira/tira-user-vm-1/my-software:0.0.1",
"tira_image_name": "code-research/tira/tira-user-vm-1/my-software:0.0.1-tira-docker-software-id-quadratic-sortie",
"deleted": false,
"description": "",
"paper_link": "",
"ir_re_ranker": false,
"ir_re_ranking_input": false
}
},
{
"model": "tira.registration",
"pk": "test_registration",
"fields": {
"initial_owner": "vm_1",
"team_members": null,
"registered_on_task": "task_1",
"name": "registration_1",
"email": "[email protected]",
"affiliation": null,
"country": null,
"employment": null,
"participates_for": null,
"instructor_name": null,
"instructor_email": null,
"questions": null,
"created": "2022-11-20",
"last_modified": "2022-11-20"
}
},
{
"model": "tira.run",
"pk": "run_1",
"fields": {
"software": 1,
"evaluator": null,
"upload": null,
"docker_software": 1,
"input_dataset": "dataset_1",
"input_run": null,
"task": "task_1",
"downloadable": true,
"deleted": false,
"access_token": ""
}
}
]
4 changes: 4 additions & 0 deletions application/src/django_admin/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ def logger_config(log_dir: Path):
'medium-resources': {'cores': 2, 'ram': 20, 'gpu': 0, 'data': 'no', 'description': 'Medium (2 CPU Cores, 20GB of RAM)', 'key': 'medium-resources'},
'large-resources': {'cores': 4, 'ram': 40, 'gpu': 0, 'data': 'no', 'description': 'Large (4 CPU Cores, 40GB of RAM)', 'key': 'large-resources'},
'small-resources-gpu': {'cores': 1, 'ram': 10, 'gpu': '1-nvidia-1080', 'data': 'no', 'description': 'Small w. GPU (1 CPU Cores, 10GB of RAM, 1 Nvidia GTX 1080 with 8GB)', 'key': 'small-resources-gpu'},
'medium-resources-gpu': {'cores': 2, 'ram': 20, 'gpu': '1-nvidia-1080', 'data': 'no', 'description': 'Medium w. GPU (2 CPU Cores, 20GB of RAM, 1 Nvidia GTX 1080 with 8GB)', 'key': 'medium-resources-gpu'},
'large-resources-gpu': {'cores': 4, 'ram': 40, 'gpu': '1-nvidia-1080', 'data': 'no', 'description': 'Large w. GPU (4 CPU Cores, 40GB of RAM, 1 Nvidia GTX 1080 with 8GB)', 'key': 'large-resources-gpu'},
'xl-resources-gpu': {'cores': 8, 'ram': 80, 'gpu': '1-nvidia-1080', 'data': 'no', 'description': 'XL w. GPU (8 CPU Cores, 80GB of RAM, 1 Nvidia GTX 1080 with 8GB)', 'key': 'xl-resources-gpu'}
}

DEFAULT_GIT_INTEGRATION_URL = 'https://git.webis.de/code-research/tira'
Expand Down Expand Up @@ -341,6 +344,7 @@ def logger_config(log_dir: Path):

CODE_SUBMISSION_REFERENCE_REPOSITORIES = {
'ir-lab-jena-leipzig-wise-2023': 'tira-io/tira-ir-lab-wise-submission-template',
'ir-benchmarks': 'tira-io/tira-ir-lab-wise-submission-template',
'webpage-classification': 'OpenWebSearch/irixys23-tira-submission-template',
'valueeval-2024-human-value-detection': 'touche-webis-de/valueeval24-tira-software-submission-template',
}
Expand Down
32 changes: 30 additions & 2 deletions application/src/tira/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,34 @@ def user_is_organizer_for_endpoint(self, request, path, task_id, organizer_id_fr
dataset_id_from_params, run_id_from_params, vm_id_from_params, role):
return False

def is_admin_for_task(self, request):
"""
Returns true if the user is an admin for the task specified in the request (false if the request url does not point to a task or if the user is only admin for some other task).
"""
organizer_ids = auth.get_organizer_ids(request)

if not organizer_ids or type(organizer_ids) != list or len(organizer_ids) < 1:
return False

task_id = None
if request.path_info.startswith('submit/') or request.path_info.startswith('/submit/'):
task_id = (request.path_info + '/').split('submit/')[1].split('/')[0]
elif request.path_info.startswith('task-overview/') or request.path_info.startswith('/task-overview/'):
task_id = (request.path_info + '/').split('task-overview/')[1].split('/')[0]

if not task_id:
return False

try:
task = model.get_task(task_id)
except:
return False

if not task:
return False

return task is not None and 'organizer_id' in task and task['organizer_id'] in organizer_ids


class LegacyAuthentication(Authentication):
_AUTH_SOURCE = "legacy"
Expand Down Expand Up @@ -141,7 +169,7 @@ def get_role(self, request, user_id: str = None, vm_id: str = None, task_id: str
if not user:
return self.ROLE_GUEST

if 'reviewer' in user['roles']:
if 'reviewer' in user['roles'] or self.is_admin_for_task(request):
return self.ROLE_ADMIN

# NOTE: in the old user management vm_id == user_id
Expand Down Expand Up @@ -261,7 +289,7 @@ def get_role(self, request, user_id: str = None, vm_id: str = None, task_id: str
Currently only checks: (1) is user admin, (2) otherwise, is user owner of the vm (ROLE_PARTICIPANT)
"""

if self._is_in_group(request, "admins") or self._is_in_group(request, "tira_reviewer"):
if self._is_in_group(request, "admins") or self._is_in_group(request, "tira_reviewer") or self.is_admin_for_task(request):
return self.ROLE_ADMIN

user_groups = self._get_user_groups(request, group_type='vm')
Expand Down
Loading

0 comments on commit ff0eabe

Please sign in to comment.