Skip to content

Commit

Permalink
Move former logic because Derived Node's FileStoreItem's datafile poi…
Browse files Browse the repository at this point in the history
…nt to nothing until `rename_results()` is run
  • Loading branch information
scottx611x committed Oct 19, 2016
1 parent 266cb8c commit f98014a
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions refinery/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,22 @@ def rename_results(self):
else:
if item.get_filetype() == zipfile:
new_file_name = ''.join([root, '.zip'])
rename(result.file_store_uuid, new_file_name)
renamed_file_store_item = rename(
result.file_store_uuid, new_file_name)

# Try to generate an auxiliary node for visualization purposes
# NOTE: We have to do this after renaming happens because before
# renaming, said FileStoreItems's datafile field does not point
# to an actual file
if renamed_file_store_item:
try:
node = Node.objects.get(
file_uuid=renamed_file_store_item.uuid)
except (Node.DoesNotExist, Node.MultipleObjectsReturned) as e:
logger.error("Error Fetching Node: %s", e)
else:
if node.is_derived():
node.run_generate_auxiliary_node_task()

def get_config(self):
# TEST RECREATING RET_LIST DICTIONARY FROM ANALYSIS MODEL
Expand Down Expand Up @@ -1659,9 +1674,6 @@ def attach_outputs_dataset(self):
analysis_results[0].file_store_uuid,
derived_data_file_node.name,
derived_data_file_node.uuid)
derived_data_file_node.save()
# Try to generate an auxiliary node for visualization purposes
derived_data_file_node.run_generate_auxiliary_node_task()

if analysis_results.count() > 1:
logger.warning("Multiple output files returned for '%s.%s'." +
Expand Down

0 comments on commit f98014a

Please sign in to comment.