diff --git a/analysis/tasks/analysis_grid_export_tasks.py b/analysis/tasks/analysis_grid_export_tasks.py index f380f2bf1..f1c573eba 100644 --- a/analysis/tasks/analysis_grid_export_tasks.py +++ b/analysis/tasks/analysis_grid_export_tasks.py @@ -1,7 +1,6 @@ import gzip import logging import os -import uuid import zipfile from typing import Optional @@ -13,6 +12,7 @@ from analysis.analysis_templates import get_cohort_analysis, get_sample_analysis from analysis.grid_export import node_grid_get_export_iterator from analysis.models import AnalysisTemplate, SampleNode +from analysis.tasks.node_update_tasks import wait_for_node from library.django_utils import FakeRequest from library.guardian_utils import admin_bot from library.utils import name_from_filename, sha256sum_str, mk_path_for_file @@ -106,6 +106,9 @@ def export_cohort_to_downloadable_file(cohort_id, export_type): analysis_template = AnalysisTemplate.get_template_from_setting("ANALYSIS_TEMPLATES_AUTO_COHORT_EXPORT") analysis = get_cohort_analysis(cohort, analysis_template) node = analysis.analysisnode_set.get_subclass(output_node=True) # Should only be 1 + if not node.ready: + wait_for_node(node.pk) # Needs to be ready + node = node.get_subclass() # Easy way to reload _write_node_to_cached_generated_file(cgf, analysis, node, cohort.name, export_type) diff --git a/analysis/views/views_grid.py b/analysis/views/views_grid.py index ba1561138..67a77d551 100644 --- a/analysis/views/views_grid.py +++ b/analysis/views/views_grid.py @@ -4,7 +4,6 @@ from django.contrib.postgres.aggregates.general import StringAgg from django.core.cache import cache -from django.http import JsonResponse from django.http.response import StreamingHttpResponse, HttpResponseRedirect from django.shortcuts import redirect from django.urls import reverse diff --git a/snpdb/views/views.py b/snpdb/views/views.py index 7ffb59bd9..24dce6129 100644 --- a/snpdb/views/views.py +++ b/snpdb/views/views.py @@ -28,8 +28,7 @@ from analysis.analysis_templates import get_sample_analysis from analysis.forms import AnalysisOutputNodeChoiceForm from analysis.models import AnalysisTemplate -from analysis.tasks.analysis_grid_export_tasks import get_grid_downloadable_file_params_hash, \ - get_annotated_download_files_cgf +from analysis.tasks.analysis_grid_export_tasks import get_annotated_download_files_cgf from annotation.forms import GeneCountTypeChoiceForm from annotation.manual_variant_entry import create_manual_variants, can_create_variants from annotation.models import AnnotationVersion, SampleVariantAnnotationStats, SampleGeneAnnotationStats, \