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

Scottx611x/expose extra directories #2447

Merged
merged 8 commits into from
Dec 19, 2017
16 changes: 11 additions & 5 deletions refinery/tool_manager/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class ToolDefinition(models.Model):
Visualizations, Other) will need to know about their expected inputs,
outputs, and input file structuring.
"""

EXTRA_DIRECTORIES = "extra_directories"
PARAMETERS = "parameters"
WORKFLOW = 'WORKFLOW'
VISUALIZATION = 'VISUALIZATION'
Expand Down Expand Up @@ -204,14 +204,16 @@ def get_extra_directories(self):
"""
if self.tool_type == ToolDefinition.VISUALIZATION:
try:
return self.get_annotation()["extra_directories"]
return self.get_annotation()[self.EXTRA_DIRECTORIES]
except KeyError:
logger.error("ToolDefinition: %s's annotation is missing its "
"`extra_directories` key.", self.name)
"`%s` key.", self.name, self.EXTRA_DIRECTORIES)
raise
else:
raise NotImplementedError(
"Workflow-based tools don't utilize `extra_directories`"
"Workflow-based tools don't utilize `{}`".format(
self.EXTRA_DIRECTORIES
)
)

def get_parameters(self):
Expand Down Expand Up @@ -428,7 +430,11 @@ def _create_container_input_dict(self):
return {
self.FILE_RELATIONSHIPS: self.get_file_relationships_urls(),
ToolDefinition.PARAMETERS: self._get_visualization_parameters(),
self.NODE_INFORMATION: self._get_detailed_input_nodes_dict()
self.NODE_INFORMATION: self._get_detailed_input_nodes_dict(),
ToolDefinition.EXTRA_DIRECTORIES: (
self.tool_definition.get_extra_directories()
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need the surrounding paren here: There's no syntactic ambiguity without it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should block, but the mix of self and ToolDefinition, or public and underscored confuses me, a little. Are those distinctions useful, and meaningful?


}

def _get_detailed_input_nodes_dict(self):
Expand Down
6 changes: 4 additions & 2 deletions refinery/tool_manager/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ def test_get_detailed_input_nodes_dict(self):
)
self.assertTrue(self.search_solr_mock.called)

def test__create_input_dict(self):
def test__create_container_input_dict(self):
tool_input_dict = self.tool._create_container_input_dict()
file_relationships = self.tool.get_file_relationships_urls()

Expand All @@ -1533,7 +1533,9 @@ def test__create_input_dict(self):
VisualizationTool.NODE_INFORMATION:
self.tool._get_detailed_input_nodes_dict(),
ToolDefinition.PARAMETERS:
self.tool._get_visualization_parameters()
self.tool._get_visualization_parameters(),
ToolDefinition.EXTRA_DIRECTORIES:
self.tool.tool_definition.get_extra_directories()
}
)

Expand Down