diff --git a/application/src/tira_app/data/HybridDatabase.py b/application/src/tira_app/data/HybridDatabase.py index 0ee0d8df..a275c569 100644 --- a/application/src/tira_app/data/HybridDatabase.py +++ b/application/src/tira_app/data/HybridDatabase.py @@ -869,6 +869,91 @@ def get_count_of_team_submissions(self, task_id): ret += [{"team": team, "reviewed": 0, "to_review": 0, "total": 0, "link": link_to_discourse_team(team)}] return ret + def all_runs(self): + prepared_statement = """SELECT + tira_run.run_id, tira_run.task_id, tira_run.input_dataset_id, + tira_software.software_id, tira_software.vm_id, tira_dockersoftware.docker_software_id, + tira_dockersoftware.vm_id, tira_dockersoftware.display_name, + tira_upload.id, tira_upload.vm_id, tira_upload.display_name, + tira_run_review.published, tira_run_review.blinded + FROM + tira_run as evaluation_run + INNER JOIN + tira_run as tira_run ON evaluation_run.input_run_id = tira_run.run_id + LEFT JOIN + tira_upload ON tira_run.upload_id = tira_upload.id + LEFT JOIN + tira_software ON tira_run.software_id = tira_software.id + LEFT JOIN + tira_dockersoftware ON tira_run.docker_software_id = tira_dockersoftware.docker_software_id + LEFT JOIN + tira_review as tira_run_review ON evaluation_run.run_id = tira_run_review.run_id + LEFT JOIN + tira_softwareclone AS software_clone ON + tira_dockersoftware.docker_software_id = software_clone.docker_software_id + LEFT JOIN + tira_softwareclone AS upload_clone ON tira_run.upload_id = upload_clone.upload_id + + ORDER BY + tira_run.run_id ASC; + """ + ret = {} + for ( + run_id, + task_id, + dataset_id, + software_id, + software_vm, + docker_id, + docker_vm, + docker_title, + upload_id, + upload_vm, + upload_title, + published, + blinded, + ) in self.execute_raw_sql_statement(prepared_statement, []): + vm = None + title = None + if software_vm is not None: + assert docker_vm is None and upload_vm is None + vm = software_vm + title = software_id + t = "VM" + if docker_vm is not None: + assert software_vm is None and upload_vm is None + vm = docker_vm + title = docker_title + t = "Docker" + if upload_vm is not None: + assert software_vm is None and docker_id is None + vm = upload_vm + title = upload_title + t = "Upload" + + if vm is None: + continue + assert vm is not None and title is not None + + if vm not in ret: + ret[vm] = {} + if title not in ret[vm]: + ret[vm][title] = {} + + if run_id in ret[vm][title]: + blinded = ret[vm][title][run_id]["blinded"] and blinded + published = ret[vm][title][run_id]["published"] or published + + ret[vm][title][run_id] = { + "type": t, + "published": published, + "blinded": blinded, + "task": task_id, + "dataset": dataset_id, + } + + return ret + def runs(self, task_id, dataset_id, vm_id, software_id): prepared_statement = """ SELECT diff --git a/application/src/tira_app/endpoints/v1/_systems.py b/application/src/tira_app/endpoints/v1/_systems.py index 00c66ef3..88782fc1 100644 --- a/application/src/tira_app/endpoints/v1/_systems.py +++ b/application/src/tira_app/endpoints/v1/_systems.py @@ -1,16 +1,40 @@ from django.http import HttpRequest, JsonResponse from django.urls import path +from ...model import DockerSoftware +from ...tira_model import model + def public_submissions(request: HttpRequest) -> JsonResponse: - ret = [ - {"team": "team-1", "name": "foo1", "type": "Docker", "tasks": ["ir-benchmarks", "reneuir"]}, - {"team": "team-1", "name": "foo2", "type": "Docker", "tasks": ["ir-benchmarks", "reneuir"]}, - {"team": "team-1", "name": "foo3", "type": "Docker", "tasks": ["ir-benchmarks", "reneuir"]}, - {"team": "team-2", "name": "foo2", "type": "Run", "tasks": ["ir-benchmarks", "reneuir"]}, - {"team": "team-3", "name": "foo2", "type": "VM", "tasks": ["ir-benchmarks", "reneuir"]}, - ] + all_runs = model.all_runs() + ret = [] + + for vm in all_runs: + for title in all_runs[vm]: + blinded = True + public = False + run_type = [] + tasks = set() + for run in all_runs[vm][title].values(): + run_type += [run["type"]] + blinded = run["blinded"] and blinded + public = run["published"] or public + tasks.add(str(run["task"])) + + if public: + ret += [{"team": vm, "name": title, "type": run_type[0], "tasks": sorted([i for i in tasks])}] + return JsonResponse(ret, safe=False) -endpoints = [path("", public_submissions)] +def software_details(request: HttpRequest, user_id: str, software: str) -> JsonResponse: + ret = [] + for i in DockerSoftware.objects.filter(vm_id=user_id, display_name=software): + if not i.public_image_name: + continue + ret += [{"PublicDockerImage": i.public_image_name, "Command": i.command}] + + return JsonResponse({"DockerImage": "dasda", "tbd": ret}, safe=False) + + +endpoints = [path("", public_submissions), path("/", software_details)] diff --git a/frontend/src/SystemDetails.vue b/frontend/src/SystemDetails.vue new file mode 100644 index 00000000..b97c3d60 --- /dev/null +++ b/frontend/src/SystemDetails.vue @@ -0,0 +1,41 @@ + + + + \ No newline at end of file diff --git a/frontend/src/Systems.vue b/frontend/src/Systems.vue index f358c928..28e7cde8 100644 --- a/frontend/src/Systems.vue +++ b/frontend/src/Systems.vue @@ -1,7 +1,8 @@ @@ -32,11 +47,12 @@ data() { return { userinfo: { role: 'guest', organizer_teams: [] } as UserInfo, + team: undefined as undefined | string, query: undefined, systems: undefined, headers: [ - { title: 'System', key: 'name' }, { title: 'Team', value: 'team' }, + { title: 'System', key: 'name' }, { title: 'Type', value: 'type' }, { title: 'Tasks', key: 'tasks' }, ], @@ -49,9 +65,19 @@ }, beforeMount() { this.query = this.$route.query.query + if (this.$route.params.team) { + this.team = this.$route.params.team + } + get(inject("REST base URL") + '/v1/systems/') .then( - (result) => { this.logData(result); this.$data.systems = result} + (result) => { + if (this.team) { + result = result.filter(i => i.team.toLowerCase() == this.team?.toLowerCase()) + } + + this.$data.systems = result + } ) .catch(reportError("Problem While Loading the Overview of the Systems.", "This might be a short-term hiccup, please try again. We got the following error: ")) fetchUserInfo().then((result) => { this.$data.userinfo = result }) diff --git a/frontend/src/components/TiraBreadcrumb.vue b/frontend/src/components/TiraBreadcrumb.vue index 4b4c7f06..dfdb56c4 100644 --- a/frontend/src/components/TiraBreadcrumb.vue +++ b/frontend/src/components/TiraBreadcrumb.vue @@ -12,11 +12,26 @@ export default { name: "tira-breadcrumb", computed: { items() { - var ret = [{title: 'TIRA', disabled: false, href: '/'}, {title: 'Tasks', disabled: false, href: '/tasks'}] - let task = extractTaskFromCurrentUrl() + var ret = [{title: 'TIRA', disabled: false, href: '/'}] - if (task) { - ret.push({title: task, disabled: false, href: '/task-overview/' + task}) + if (this.$route.path.startsWith('/datasets')) { + ret.push({title: 'Datasets', disabled: false, href: '/datasets'}) + } else if (this.$route.path.startsWith('/systems')) { + ret.push({title: 'Systems', disabled: false, href: '/systems'}) + if (this.$route.params.team) { + ret.push({title: this.$route.params.team, disabled: false, href: '/systems/' + this.$route.params.team}) + + if (this.$route.params.system) { + ret.push({title: this.$route.params.system, disabled: false, href: '/systems/' + this.$route.params.team + '/' + this.$route.params.system}) + } + } + } else { + ret.push({title: 'Tasks', disabled: false, href: '/tasks'}) + let task = extractTaskFromCurrentUrl() + + if (task) { + ret.push({title: task, disabled: false, href: '/task-overview/' + task}) + } } return ret; diff --git a/frontend/src/main.ts b/frontend/src/main.ts index 12f65b2a..9a3f915e 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -12,6 +12,7 @@ import Tasks from './Tasks.vue' import Tirex from './Tirex.vue' import Datasets from './Datasets.vue' import Systems from './Systems.vue' +import SystemDetails from './SystemDetails.vue' import TaskOverview from './TaskOverview.vue' import RunUpload from './RunUpload.vue' import tiraConf from './tira.conf' @@ -36,6 +37,8 @@ export default function register_app() { { path: '/tasks', component: Tasks }, { path: '/datasets', component: Datasets }, { path: '/systems', component: Systems }, + { path: '/systems/:team?', component: Systems }, + { path: '/systems/:team/:system', component: SystemDetails }, { path: '/task-overview/:task_id?/:dataset_id?', component: TaskOverview }, { path: '/task/:task_id?/:dataset_id?', component: TaskOverview }, { path: '/submit/:task/user/:user/:submission_type?/:selected_step?', name: 'submission', component: RunUpload },