Skip to content

Commit

Permalink
Merge pull request #334 from uc-cdis/fix/allow-more-data-file-categories
Browse files Browse the repository at this point in the history
(PXP-7094): fix mapping file for any node category ending in "_file" (e.g. "genomic_data_file")
  • Loading branch information
johnfrancismccann authored Nov 6, 2020
2 parents 3b05a7f + 2cb6e3e commit 6289f43
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
7 changes: 7 additions & 0 deletions sheepdog/api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import sys
import logging

from flask import Flask, jsonify
from psqlgraph import PsqlGraphDriver
Expand Down Expand Up @@ -162,6 +163,12 @@ def app_init(app):


# Setup logger
app.logger.setLevel(
logging.DEBUG if (os.environ.get("GEN3_DEBUG") == "True") else logging.WARNING
)
app.logger.propagate = False
while app.logger.handlers:
app.logger.removeHandler(app.logger.handlers[0])
app.logger.addHandler(get_handler())

setup_default_handlers(app)
Expand Down
2 changes: 0 additions & 2 deletions sheepdog/transactions/upload/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ class UploadEntity(EntityBase):
session.
"""

DATA_FILE_CATEGORIES = ["data_file", "metadata_file", "index_file"]

def __init__(self, transaction, config=None):
"""
Args:
Expand Down
8 changes: 7 additions & 1 deletion sheepdog/transactions/upload/entity_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ def create(transaction, doc, config=None):
node_type = doc.get("type")
node_category = get_node_category(node_type)

if node_category in UploadEntity.DATA_FILE_CATEGORIES:
if node_category.endswith("_file"):
transaction.logger.debug(
"Identified %s node as a data file node", node_type
)
return FileUploadEntity(transaction, config)
else:
transaction.logger.debug(
"Identified %s node as a non-data file node", node_type
)
return NonFileUploadEntity(transaction, config)

0 comments on commit 6289f43

Please sign in to comment.