From 25ccb68eea12fe66a9a2db629f4b52010423d9f1 Mon Sep 17 00:00:00 2001 From: Dan LaManna Date: Mon, 30 Nov 2026 10:47:32 -0500 Subject: [PATCH] Import isic_challenge_scoring lazily in the scoring task --- stade/core/tasks.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/stade/core/tasks.py b/stade/core/tasks.py index 93162e6..5a783fc 100644 --- a/stade/core/tasks.py +++ b/stade/core/tasks.py @@ -20,12 +20,6 @@ from django.template.loader import render_to_string from girder_utils.files import field_file_to_local_path from girder_utils.storages import expiring_url -from isic_challenge_scoring import ( - ClassificationMetric, - ClassificationScore, - ScoreError, - SegmentationScore, -) from stade.core.models import Approach, Submission, Task, TeamInvitation @@ -141,6 +135,15 @@ def generate_submission_bundle(task_id, notify_user_id): def _score_submission(submission): + # isic_challenge_scoring pulls in numpy, pandas, scipy and scikit-learn, which is far more + # memory than the web processes (which import this module for the task signatures) need. + from isic_challenge_scoring import ( + ClassificationMetric, + ClassificationScore, + ScoreError, + SegmentationScore, + ) + try: truth_file: FieldFile = submission.approach.task.test_ground_truth_file prediction_file: FieldFile = submission.test_prediction_file