Skip to content

Commit

Permalink
Merge pull request #747 from AlexsLemonade/kurtwheeler/graceful-non-d…
Browse files Browse the repository at this point in the history
…ownloads

Handle no downloader work gracefully.
  • Loading branch information
kurtwheeler authored Oct 26, 2018
2 parents 6036138 + 6b4e73a commit 8eaf729
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
16 changes: 16 additions & 0 deletions workers/data_refinery_workers/downloaders/test_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os

from django.test import TestCase, tag
from typing import List
from unittest.mock import patch, call
from urllib.error import URLError

from data_refinery_workers.downloaders import utils

class UtilsTestCase(TestCase):
@tag('downloaders')
def test_no_jobs_to_create(self):
"""Make sure this function doesn't raise an exception with no files."""
utils.create_processor_job_for_original_files([])

self.assertTrue(True)
4 changes: 4 additions & 0 deletions workers/data_refinery_workers/downloaders/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ def create_processor_job_for_original_files(original_files: List[OriginalFile],
"""

# If there's no original files then we've created all the jobs we need to!
if len(original_files) == 0:
return

# For anything that has raw data there should only be one Sample per OriginalFile
sample_object = original_files[0].samples.first()
pipeline_to_apply = determine_processor_pipeline(sample_object, original_files[0])
Expand Down

0 comments on commit 8eaf729

Please sign in to comment.