Skip to content

Commit

Permalink
Hackdna/data set manager tasks cleanup (#3015)
Browse files Browse the repository at this point in the history
Remove unused delete_external_file() and redundant create_dir()
  • Loading branch information
hackdna committed Sep 24, 2018
1 parent cbf25b3 commit 43d0eb9
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions refinery/data_set_manager/tasks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from datetime import date
import errno
import glob
import logging
import os
Expand All @@ -25,6 +24,7 @@
from core.utils import add_data_set_to_neo4j
from file_store.models import FileExtension, generate_file_source_translator
from file_store.tasks import FileImportTask
from file_store.utils import make_dir

from .isa_tab_parser import IsaTabParser
from .models import Investigation, Node, initialize_attribute_order
Expand All @@ -34,29 +34,6 @@
logger = logging.getLogger(__name__)


def create_dir(file_path):
"""creates a directory if it needs to be created
Parameters:
file_path: directory to create if necessary
"""
try:
os.makedirs(file_path)
except OSError, e:
if e.errno != errno.EEXIST:
raise


def delete_external_file(file_path):
"""removes a file with the given path (that is outside the file_store)
Parameters:
file_path: location of the file to delete
"""
try:
os.remove(file_path)
except OSError:
raise


def zip_converted_files(accession, isatab_zip_loc, preisatab_zip_loc):
"""zips up the isatab and pre-isatab files from MAGE-Tab conversion
Parameters:
Expand Down Expand Up @@ -98,7 +75,7 @@ def zip_converted_files(accession, isatab_zip_loc, preisatab_zip_loc):
f.close()
last_line = lines[-1]
dir_to_zip = os.path.join(temp_dir, "magetab")
create_dir(dir_to_zip)
make_dir(dir_to_zip)
# isolate the links by splitting on '<a href="'
a_hrefs = string.split(last_line, '<a href="')
# get the links we want
Expand Down

0 comments on commit 43d0eb9

Please sign in to comment.