-
Notifications
You must be signed in to change notification settings - Fork 58
Account for per-job output storage for budget estimations #4682
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
Open
chrisvanrun
wants to merge
8
commits into
main
Choose a base branch
from
job_output_for_budget
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+223
−24
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b45cf74
Add average_size_job_output_mb_for_tasks to budget calculations
chrisvanrun 0c2f1fa
Add migration step
chrisvanrun 226a61a
Add a test for the migration
chrisvanrun 087888c
Set migration default for job output to zero
chrisvanrun 0b363e9
Update help_text
chrisvanrun bbdafe8
Base calculate in MB before converting to GB
chrisvanrun 6bf28fa
Minor missed migration edits
chrisvanrun 752cfdd
Clear up calc with brackets
chrisvanrun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...challenge/challenges/migrations/0072_challengerequest_average_size_output_mb_for_tasks.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # Generated by Django 5.2.13 on 2026-04-21 11:04 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
| import grandchallenge.core.validators | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ("challenges", "0071_alter_challengerequest_status_and_more"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="challengerequest", | ||
| name="average_size_job_output_mb_for_tasks", | ||
| field=models.JSONField( | ||
| default=list, | ||
| help_text="Average size of the output per job in MB, for each task.", | ||
| validators=[ | ||
| grandchallenge.core.validators.JSONValidator( | ||
| schema={ | ||
| "$schema": "http://json-schema.org/draft-07/schema", | ||
| "items": { | ||
| "maximum": 10000, | ||
| "minimum": 0, | ||
| "type": "integer", | ||
| }, | ||
| "type": "array", | ||
| } | ||
| ) | ||
| ], | ||
| ), | ||
| ), | ||
| ] |
29 changes: 29 additions & 0 deletions
29
app/grandchallenge/challenges/migrations/0073_set_average_size_job_output_for_tasks.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| from django.db import migrations | ||
|
|
||
|
|
||
| def set_average_size_job_output_mb_for_tasks(apps, schema_editor): | ||
| ChallengeRequest = apps.get_model( # noqa: N806 | ||
| "challenges", "ChallengeRequest" | ||
| ) | ||
|
|
||
| for challenge_request in ChallengeRequest.objects.all(): | ||
| challenge_request.average_size_job_output_mb_for_tasks = [ | ||
| 0 for _ in challenge_request.task_ids | ||
| ] | ||
| challenge_request.save() | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ( | ||
| "challenges", | ||
| "0072_challengerequest_average_size_output_mb_for_tasks", | ||
| ), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.RunPython( | ||
| set_average_size_job_output_mb_for_tasks, elidable=True | ||
| ), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it was better to split this into input/output. Opted to keep this in a single property for now.