Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional inputs #3842

Draft
wants to merge 31 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
40156db
Add AlgorithmInterface model (#3720)
amickan Dec 6, 2024
b2060b9
Merge main
amickan Dec 6, 2024
2f9a6b1
Add create and list views for algorithm interfaces (#3735)
amickan Dec 12, 2024
0c65cf2
Merge branch 'main' into feat_optional_inputs
amickan Dec 12, 2024
5990745
Merge branch 'feat_optional_inputs' of github.com:comic/grand-challen…
amickan Dec 12, 2024
6e2da3d
Require default interface for algorithm (#3759)
amickan Dec 18, 2024
275bad5
Merge branch 'main' into feat_optional_inputs
amickan Dec 18, 2024
f9e5d5a
Enable interface selection for algorithm job (#3753)
amickan Jan 16, 2025
35c6803
Merge main
amickan Jan 16, 2025
86b0396
Redo migrations
amickan Jan 17, 2025
50793e6
Fix new tests after merging main
amickan Jan 17, 2025
0d54ba1
Merge branch 'main' into feat_optional_inputs
amickan Jan 22, 2025
a7ff28f
Algorithm interface delete view (#3789)
amickan Jan 23, 2025
159cf77
Merge branch 'feat_optional_inputs' of github.com:comic/grand-challen…
amickan Jan 23, 2025
a8cfa59
Unique input sets per algorithm (#3797)
amickan Jan 27, 2025
f73ddf2
Merge main
amickan Jan 27, 2025
5de9ea1
Create job with interface through API (#3799)
amickan Jan 27, 2025
9a1bd62
Move input/output annotation from manager to separate method (#3804)
amickan Jan 30, 2025
d50c000
Merge branch 'main' into feat_optional_inputs
amickan Jan 30, 2025
66a21cb
Remove is_default field for algorithm interfaces (#3811)
amickan Jan 31, 2025
c75cd76
Add algorithm interfaces to phases and migrate (#3803)
amickan Jan 31, 2025
d840750
Managements views for algorithm interfaces for phases (#3812)
amickan Feb 5, 2025
eadde3f
Merge branch 'main' into feat_optional_inputs
amickan Feb 5, 2025
399bf48
Unify algorithm interface list views (#3818)
amickan Feb 5, 2025
028a605
Enable submission with optional inputs (#3820)
amickan Feb 13, 2025
43e7bdf
Merge branch 'main' into feat_optional_inputs
amickan Feb 13, 2025
eaa667b
Remove inputs and outputs fields from Phase and Algorithm models (#3832)
amickan Feb 19, 2025
a2aa9ca
Merge main
amickan Feb 20, 2025
3d9941a
Fix gc-forge test
amickan Feb 20, 2025
74a1672
Merge main
amickan Feb 21, 2025
22ff747
Rename interface to socket on user-facing views (#3846)
amickan Feb 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/config/urls/challenge_subdomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
path(
"", include("grandchallenge.well_known.urls", namespace="well-known")
),
path(
"components/",
include("grandchallenge.components.urls", namespace="components"),
),
path(
"evaluation/",
include("grandchallenge.evaluation.urls", namespace="evaluation"),
Expand Down
58 changes: 56 additions & 2 deletions app/grandchallenge/algorithms/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
from django.utils.html import format_html
from guardian.admin import GuardedModelAdmin

from grandchallenge.algorithms.forms import AlgorithmIOValidationMixin
from grandchallenge.algorithms.models import (
Algorithm,
AlgorithmAlgorithmInterface,
AlgorithmGroupObjectPermission,
AlgorithmImage,
AlgorithmImageGroupObjectPermission,
AlgorithmImageUserObjectPermission,
AlgorithmInterface,
AlgorithmModel,
AlgorithmModelGroupObjectPermission,
AlgorithmModelUserObjectPermission,
Expand All @@ -36,12 +37,13 @@
UserObjectPermissionAdmin,
)
from grandchallenge.core.templatetags.costs import millicents_to_euro
from grandchallenge.core.templatetags.remove_whitespace import oxford_comma
from grandchallenge.core.utils.grand_challenge_forge import (
get_forge_algorithm_template_context,
)


class AlgorithmAdminForm(AlgorithmIOValidationMixin, ModelForm):
class AlgorithmAdminForm(ModelForm):
class Meta:
model = Algorithm
fields = "__all__"
Expand Down Expand Up @@ -208,6 +210,7 @@ class JobAdmin(GuardedModelAdmin):
"task_on_success",
"task_on_failure",
"runtime_metrics",
"algorithm_interface",
)
search_fields = (
"creator__username",
Expand Down Expand Up @@ -235,6 +238,57 @@ class AlgorithmModelAdmin(GuardedModelAdmin):
readonly_fields = ("creator", "algorithm", "sha256", "size_in_storage")


@admin.register(AlgorithmInterface)
class AlgorithmInterfaceAdmin(GuardedModelAdmin):
readonly_fields = ("algorithm_inputs", "algorithm_outputs")
list_display = (
"pk",
"algorithm_inputs",
"algorithm_outputs",
)
search_fields = (
"pk",
"inputs__slug",
"outputs__slug",
)

def algorithm_inputs(self, obj):
return oxford_comma(obj.inputs.all())

def algorithm_outputs(self, obj):
return oxford_comma(obj.outputs.all())

def has_change_permission(self, request, obj=None):
# interfaces cannot be modified
return False

def has_delete_permission(self, request, obj=None):
# interfaces cannot be deleted
return False

def has_add_permission(self, request, obj=None):
# interfaces should only be created through the UI
return False


@admin.register(AlgorithmAlgorithmInterface)
class AlgorithmAlgorithmInterfaceAdmin(GuardedModelAdmin):
list_display = (
"pk",
"interface",
"algorithm",
)
list_filter = ("algorithm",)

def has_add_permission(self, request, obj=None):
# through table entries should only be created through the UI
return False

def has_change_permission(self, request, obj=None):
# through table entries should only be updated through the UI
return False


admin.site.register(AlgorithmUserObjectPermission, UserObjectPermissionAdmin)
admin.site.register(AlgorithmGroupObjectPermission, GroupObjectPermissionAdmin)
admin.site.register(AlgorithmImage, ComponentImageAdmin)
Expand Down
Loading