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

Handle no downloader work gracefully. #747

Merged
merged 6 commits into from
Oct 26, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
15 changes: 15 additions & 0 deletions workers/data_refinery_workers/downloaders/test_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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):
def test_no_jobs_to_create(self):
"""Make sure this function doesn't raise an exception with no files."""
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