Skip to content

Commit

Permalink
Merge pull request #538 from tira-io/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
mam10eks authored Nov 8, 2023
2 parents ec66fd4 + 5711a91 commit 8639aee
Show file tree
Hide file tree
Showing 30 changed files with 601 additions and 200 deletions.
4 changes: 2 additions & 2 deletions application/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

VENV_NAME?=venv
PYTHON=${PWD}/${VENV_NAME}/bin/python3
VERSION_APPLICATION=0.0.89
VERSION_GRPC=0.0.89
VERSION_APPLICATION=0.0.90
VERSION_GRPC=0.0.90

.DEFAULT: help
help:
Expand Down
25 changes: 22 additions & 3 deletions application/src/tira/data/HybridDatabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,17 +655,21 @@ def runs(self, task_id, dataset_id, vm_id, software_id):
tira_dockersoftware ON tira_run.docker_software_id = tira_dockersoftware.docker_software_id
LEFT JOIN
tira_review as tira_run_review ON tira_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 = software_clone.upload_id
WHERE
tira_run_review.published = TRUE AND tira_run_review.blinded = FALSE
AND tira_run.input_dataset_id = %s
AND (tira_dockersoftware.task_id = %s OR tira_upload.task_id = %s OR tira_software.task_id = %s)
AND (tira_dockersoftware.task_id = %s OR tira_upload.task_id = %s OR tira_software.task_id = %s or software_clone.task_id = %s or upload_clone.task_id = %s)
AND (tira_dockersoftware.vm_id = %s OR tira_upload.vm_id = %s OR tira_software.vm_id = %s)
AND (tira_dockersoftware.display_name = %s OR tira_upload.display_name = %s OR tira_software.id = %s)
ORDER BY
tira_run.run_id ASC;
"""
params = [dataset_id, task_id, task_id, task_id, vm_id, vm_id, vm_id, software_id, software_id, software_id]
params = [dataset_id, task_id, task_id, task_id, task_id, task_id, vm_id, vm_id, vm_id, software_id, software_id, software_id]
return [i[0] for i in self.execute_raw_sql_statement(prepared_statement, params)]

def get_runs_for_vm(self, vm_id, docker_software_id, upload_id, include_unpublished=True, round_floats=True, show_only_unreviewed=False):
Expand Down Expand Up @@ -765,6 +769,21 @@ def get_docker_softwares(task_id, vm_id, return_only_names=True):
else:
return ret

def get_public_docker_softwares(self, task_id, return_only_names=True, return_details=True):
ret = modeldb.DockerSoftware.objects.filter(task__task_id=task_id, deleted=False,
public_image_name__isnull=False)

ret = [i for i in ret if i.public_image_name and i.public_image_size]

if return_only_names:
return [{'docker_software_id': i.docker_software_id, 'display_name': i.display_name, 'vm_id': i.vm_id
}
for i in ret]
elif return_details:
return [self._docker_software_to_dict(i) for i in ret]
else:
return ret

def delete_docker_software(self, task_id, vm_id, docker_software_id):
software_qs = modeldb.DockerSoftware.objects.filter(vm_id=vm_id, task_id=task_id,
docker_software_id=docker_software_id)
Expand Down Expand Up @@ -1551,7 +1570,7 @@ def add_uploaded_run(self, task_id, vm_id, dataset_id, upload_id, uploaded_file)
try:
upload = modeldb.Upload.objects.get(vm__vm_id=vm_id, task__task_id=task_id, id=upload_id)
except:
upload = modeldb.Upload.objects.get(vm__vm_id=vm_id, task__task_id=task_id, id=upload_id)
upload = modeldb.Upload.objects.get(vm__vm_id=vm_id, id=upload_id)

upload.last_edit_date = now()
upload.save()
Expand Down
17 changes: 17 additions & 0 deletions application/src/tira/endpoints/data_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,23 @@ def get_running_software(request, context, task_id, user_id, force_cache_refresh
return JsonResponse({'status': 0, "context": context})


@add_context
def public_submissions(request, context, task_id):
context['public_submissions'] = model.model.get_public_docker_softwares(task_id)

return JsonResponse({'status': 0, "context": context})


@add_context
def public_submission(request, context, task_id, user_id, display_name):
for i in model.model.get_public_docker_softwares(task_id, return_only_names=False, return_details=True):
if i['display_name'] == display_name and i['vm_id'] == user_id:
context['submission'] = i
return JsonResponse({'status': 0, "context": context})

return JsonResponse({'status': 1, "messge": "Software '{task_id}/{user_id}/{display_name}' does not exist."})


@check_permissions
@check_resources_exist("json")
@add_context
Expand Down
8 changes: 8 additions & 0 deletions application/src/tira/frontend-vuetify/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
</template>

<style>
#app main{
overflow-y: hidden;
}
#app input {
margin: 0px !important;
padding: 0px !important;
Expand All @@ -18,6 +21,11 @@
padding: 0px !important;
left: auto !important;
}
#app #docker-submission-readonly-input input {
padding: 10px 0 0 10px !important;
color: #BDBDBD;
}
#app #task-search input {
border: none !important;
outline: none !important;
Expand Down
48 changes: 31 additions & 17 deletions application/src/tira/frontend-vuetify/src/IrComponents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</v-row>


<div class="d-none d-md-block">
<div>
<v-row class="justify-center mx-2" v-for="(row, _) of vectorizedComponents">
<v-col v-for="(cell, i) in row" cols="cell.cols">
<v-menu>
Expand All @@ -65,21 +65,12 @@
</v-col>
</v-row>
</div>
<div class="d-md-none">
<v-row class="justify-center mx-2" v-for="display_name in colors">
<v-col cols="12">
<v-card class="mx-auto" :max-width="max_width" variant="tonal" style="cursor: pointer;">
<v-card-item><span class="text-h6 mb-1">{{ display_name }}</span><span style="font-size: .7em;" >TODO...</span></v-card-item>
</v-card>
</v-col>
</v-row>
</div>
</div>
</template>


<script lang="ts">
import { Loading } from './components'
import { Loading, is_mobile } from './components'
import { get, reportError, inject_response } from './utils';
export default {
name: "ir-components",
Expand All @@ -96,7 +87,7 @@ export default {
'Query Processing': 'yellow-darken-4', 'Retrieval': 'cyan-lighten-1',
'Re-Ranking': 'cyan-darken-3', 'Evaluation': 'blue-grey-lighten-1'
} as {[key: string]: string},
expanded_entries: ['Dataset', 'Document Processing', 'Query Processing', 'Retrieval', 'Re-Ranking', 'Evaluation'],
expanded_entries: ['does-not-exist'],
component_filter: null,
component_types: ['TIREx Submission', 'Tutorial'],
available_component_types: ['Code', 'TIREx Submission', 'Tutorial'],
Expand All @@ -108,6 +99,7 @@ export default {
colorOfComponent(c:string) {
return this.colors[c] ?? "grey"
},
is_mobile() {return is_mobile()},
collapseItem(c:string) {
this.expanded_entries = this.expanded_entries.filter(e => e != c)
},
Expand All @@ -126,7 +118,7 @@ export default {
return ret
},
is_collapsed(component:any) {
return !this.expanded_entries.includes(component.display_name)
return !this.computed_expanded_entries.includes(component.display_name)
},
filtered_sub_components(component:any) : {display_name: string, subItems: number, pos: number, links: any[]}[] {
let ret: {display_name: string, subItems: number, pos: number, links: any[]}[] = []
Expand Down Expand Up @@ -166,15 +158,23 @@ export default {
.catch(reportError("Problem While Loading the overview of the components.", "This might be a short-term hiccup, please try again. We got the following error: "))
},
computed: {
computed_expanded_entries() {
let ret = [...this.expanded_entries];
if(!is_mobile()) {
ret = ret.concat(['Dataset', 'Document Processing', 'Query Processing', 'Retrieval',
'Re-Ranking', 'Evaluation'])
}
return ret
},
vectorizedComponents() {
let ret: [any[]] = [[{}, {}, {}, {}, {}, {}]]
let cols = 2;//this.mobileLayout() ? 12 : 2;
let cols = is_mobile() ? 12 : 2;
for (let i in this.tirex_components) {
let c = this.tirex_components[i]
ret[0][i] = {'display_name': c.display_name, 'cols': cols, 'links': c.links, 'collapsed': this.is_collapsed(c),
'subItems':this.countSubItems(c)}
ret[0][i] = {'display_name': c.display_name, 'cols': cols, 'links': c.links, 'collapsed': this.is_collapsed(c), 'subItems':this.countSubItems(c)}
for (let subcomponent of this.filtered_sub_components(c)) {
if (subcomponent['pos'] >= ret.length) {
Expand All @@ -190,7 +190,21 @@ export default {
}
}
}
if (is_mobile()) {
let new_ret = []
for(let i=0; i< 100; i++) {
for (let j=0; j< ret.length && i < ret[j].length ; j++) {
const cell = ret[j][i]
if(cell && cell.hasOwnProperty('display_name')) {
new_ret.push([cell])
}
}
}
return new_ret
}
return ret
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,11 @@ import SubissionIcon from "./SubmissionIcon.vue"
import ConfirmDelete from "./ConfirmDelete.vue"
import CodeSnippet from "./CodeSnippet.vue"

export {Loading, RunActions, RunList, SoftwareDetails, SubmitButton, TiraBreadcrumb, TiraTaskAdmin, TaskDocumentation, RegisterForm, LoginToSubmit, ExistingDockerSubmission, NewDockerSubmission, EditTask, SubissionIcon, ConfirmDelete, CodeSnippet}
import { useDisplay } from 'vuetify'

function is_mobile() {
const { mobile } = useDisplay()
return mobile.value
}

export {Loading, RunActions, RunList, SoftwareDetails, SubmitButton, TiraBreadcrumb, TiraTaskAdmin, TaskDocumentation, RegisterForm, LoginToSubmit, ExistingDockerSubmission, NewDockerSubmission, EditTask, SubissionIcon, ConfirmDelete, CodeSnippet, is_mobile}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@
<loading :loading="loading"/>
<login-to-submit v-if="!loading && role === 'guest'"/>
<v-row v-if="!loading && role !== 'guest'">
<v-col :cols="$vuetify.display.mdAndUp ? '9' : '11'">
<v-col :cols="$vuetify.display.mdAndUp ? '9' : '12'">
<v-autocomplete clearable auto-select-first label="Choose software &hellip;" prepend-inner-icon="mdi-magnify" :items="allSoftwareSubmissions" item-title="display_name" item-value="docker_software_id"
variant="underlined" v-model="tab"/>
</v-col>
<v-col :cols="$vuetify.display.mdAndUp ? '3' : '1'">
<v-col v-if="!$vuetify.display.smAndDown" :cols="$vuetify.display.mdAndUp ? '3' : '0'">
<v-btn color="primary" v-if="!$vuetify.display.mdAndUp" icon="mdi-plus" @click="this.tab = 'newDockerImage'"/>
<v-btn color="primary" v-if="$vuetify.display.mdAndUp" prepend-icon="mdi-plus" size="large" @click="this.tab = 'newDockerImage'" block>New Submission</v-btn>
</v-col>
</v-row>
<v-row v-if="$vuetify.display.smAndDown">
<v-col :cols="12">
<v-btn color="primary" prepend-icon="mdi-plus" size="large" @click="this.tab = 'newDockerImage'" block rounded>New Submission</v-btn>
</v-col>
</v-row>
<v-row v-if="!loading && role !== 'guest'">
<v-col cols="10">
<v-tabs v-model="tab" fixed-tabs class="mb-10 d-none">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<v-textarea v-model="description" label="Description"/>
<v-text-field v-model="paper_link" label="Link your Paper"/>
<v-checkbox v-model="ir_re_ranker" label="Is this software an re-ranker?" v-if="is_ir_task && type == 'docker'"/>
<v-checkbox v-model="ir_re_ranking_input" label="Is the output of this component a rin file to be re-ranked by others?" v-if="is_ir_task"/>
<v-checkbox v-model="ir_re_ranking_input" label="Is the output of this component a run file to be re-ranked by others?" v-if="is_ir_task"/>
</v-form>
</v-card-text>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
<loading :loading="loading"/>
<v-container v-if="!loading">
<v-card class="px-5">
<div class="w-100 d-flex justify-space-between">
<v-card-title></v-card-title>
<div class="mt-4">
<div :class="$vuetify.display.mdAndUp ? 'w-100 d-flex justify-end mt-4' : 'w-100 d-flex justify-space-evenly mt-4'">
<edit-submission-details
type='docker'
:id="docker_software_id"
Expand All @@ -21,14 +19,13 @@
<v-icon>mdi-delete-alert-outline</v-icon>
Delete
</v-btn>
</div>
</div>

<v-card-subtitle>{{ docker_software_details.description }}</v-card-subtitle>
<v-form>
<v-text-field label="Previous Stages (Disabled for Reproducibility)" v-if="docker_software_details.previous_stages" v-model="docker_software_details.previous_stages" disabled/>
<v-text-field label="Docker Image (Disabled for Reproducibility)" v-model="docker_software_details.user_image_name" disabled/>
<v-text-field label="Command (Disabled for Reproducibility)" v-model="docker_software_details.command" disabled/>
<v-card-subtitle class="my-4">{{ docker_software_details.description }}</v-card-subtitle>
<v-form id="docker-submission-readonly-input">
<v-text-field label="Previous Stages (Immutable for Reproducibility)" v-if="docker_software_details.previous_stages" v-model="docker_software_details.previous_stages" readonly/>
<v-text-field label="Docker Image (Immutable for Reproducibility)" v-model="docker_software_details.user_image_name" readonly/>
<v-text-field label="Command (Immutable for Reproducibility)" v-model="docker_software_details.command" readonly/>
</v-form>

<v-divider></v-divider>
Expand Down Expand Up @@ -127,4 +124,4 @@ export default {
}
}
}
</script>
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ cat tira-evaluation/evaluation.prototext" expand_message="(3) Verify the evaluat
<h3 class="text-h6 font-weight-light my-6">
Please specify your docker software
</h3>
<p class="mb-4">A software submission consists of a docker image and the command that is executed in the docker image. Please specify both below.</p>
<p>A software submission consists of a docker image and the command that is executed in the docker image. Please specify both below.</p>

<p class="my-4 d-flex align-start"> Choose either an existing docker image... </p>
<v-autocomplete
label="Docker Image"
:items="docker_images"
Expand All @@ -87,6 +88,15 @@ cat tira-evaluation/evaluation.prototext" expand_message="(3) Verify the evaluat
:disabled="loading"
clearable
:rules="[v => !!(v && v.length) || 'Please select the docker image for the execution.']"/>
<v-btn
class="mr-4"
color="primary"
:loading="refreshingInProgress"
@click="refreshImages()"
>
refresh images
</v-btn>
<span><br v-if="$vuetify.display.mdAndDown">last refreshed: {{docker_images_last_refresh}}</span>
</div>
<div class="text-center mb-4">
<v-dialog
Expand All @@ -96,21 +106,15 @@ cat tira-evaluation/evaluation.prototext" expand_message="(3) Verify the evaluat
<template v-slot:activator="{ props }" class="d-flex flex-column align-center" >
<div>
<v-btn
class="mr-2"
class="d-flex mr-2 mb-4 mt-6 align-start"
color="primary"
variant="plain"
v-bind="props"
>
Push New Docker Image
</v-btn>
<v-btn
color="primary"
:loading="refreshingInProgress"
@click="refreshImages()"
>
refresh images
<span v-if="!$vuetify.display.mdAndDown">...or see instructions on how to add a new docker image to tira</span>
<span v-if="$vuetify.display.mdAndDown">...or add new image</span>
</v-btn>
</div>
<span>last refreshed: {{docker_images_last_refresh}}</span>
</template>

<v-card>
Expand Down Expand Up @@ -207,6 +211,7 @@ export default {
step: this.step_prop,
all_uploadgroups: [{"id": null, "display_name": 'loading...'}],
docker_images: [{ "image": "loading...", "architecture": "loading...", "created": "loading...", "size": "loading...", "digest": "loading...", 'title': 'loading...'}],
public_docker_softwares: [{"docker_software_id": 'loading...', "display_name": 'loading...', 'vm_id': 'loading...'}],
user_id_for_task: extractUserFromCurrentUrl(),
}
},
Expand All @@ -222,7 +227,9 @@ export default {
}
},
all_previous_stages() {
return this.docker_softwares.concat(this.all_uploadgroups.map((i) => ({"display_name": i.display_name, "docker_software_id": ('upload-' + i.id)})))
return this.docker_softwares
.concat(this.all_uploadgroups.map((i) => ({"display_name": i.display_name, "docker_software_id": ('upload-' + i.id)})))
.concat(this.public_docker_softwares.filter((i) => i.vm_id !== this.user_id_for_task).map((i) => ({"display_name": i.vm_id + '/' + i.display_name, "docker_software_id": i.docker_software_id})))
},
double_check_tira_run_command() {
return this.tira_final_run_example.replace('YOUR-IMAGE', this.selectedDockerImage).replace('YOUR-COMMAND', this.runCommand)
Expand Down Expand Up @@ -282,8 +289,6 @@ export default {
.then(this.refreshTitles)
.catch(reportError("Problem While Loading the Docker Images.", "This might be a short-term hiccup, please try again. We got the following error: "))
})
},
watch: {
step(old_value, new_value) {
Expand Down
Loading

0 comments on commit 8639aee

Please sign in to comment.