Skip to content

Commit

Permalink
Fixed #545. A third parameter is returned, specifying whether a file …
Browse files Browse the repository at this point in the history
…as been skipped or not.
  • Loading branch information
flekschas committed Jun 29, 2015
1 parent 951f9cc commit 345a341
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ def handle(self, username, base_isa_dir, **options):

task_num = 1
total = len(isatab_dict)
for (i, filename) in result.iterate():
for (i, filename, skipped) in result.iterate():
try:
if i:
if !skipped:
print (
"{num} / {total}: Successfully parsed {file} into "
"DataSet with UUID {uuid}".format(
Expand All @@ -142,10 +142,11 @@ def handle(self, username, base_isa_dir, **options):
else:
print (
"{num} / {total}: Skipped {file} as it has been "
"successfully parsed already".format(
"successfully parsed already. UUID {uuid}".format(
num=task_num,
total=total,
file=filename
file=filename,
uuid=i
)
)
task_num += 1
Expand Down
6 changes: 3 additions & 3 deletions refinery/data_set_manager/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,15 +578,15 @@ def parse_isatab(
'The checksum of both files is the same: %s',
checksum
)
return (None, os.path.basename(path))
return (investigation.isarchive_file, os.path.basename(path), True)

try:
investigation = p.run(
path,
isa_archive=isa_archive,
preisa_archive=pre_isa_archive)
data_uuid = create_dataset(investigation.uuid, username, public=public)
return (data_uuid, os.path.basename(path))
return (data_uuid, os.path.basename(path), False)
except: # prints the error message without breaking things
logger.error("*** print_tb:")
exc_type, exc_value, exc_traceback = sys.exc_info()
Expand All @@ -600,4 +600,4 @@ def parse_isatab(
file=sys.stdout
)
)
return (None, os.path.basename(path))
return (None, os.path.basename(path), False)
4 changes: 2 additions & 2 deletions refinery/data_set_manager/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def get(self, request, *args, **kwargs):
response.delete_cookie(self.isa_tab_cookie_name)
return response
logger.debug("Temp file name: '%s'", temp_file_path)
dataset_uuid, _ = parse_isatab.delay(request.user.username,
dataset_uuid, _, _ = parse_isatab.delay(request.user.username,
False,
temp_file_path).get()
#TODO: exception handling
Expand Down Expand Up @@ -247,7 +247,7 @@ def post(self, request, *args, **kwargs):
return render_to_response(self.template_name,
context_instance=context)
logger.debug("Temp file name: '%s'", temp_file_path)
dataset_uuid, _ = parse_isatab.delay(request.user.username,
dataset_uuid, _, _ = parse_isatab.delay(request.user.username,
False, temp_file_path).get()
#TODO: exception handling (OSError)
os.unlink(temp_file_path)
Expand Down

0 comments on commit 345a341

Please sign in to comment.