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/is tool based cleanup #2222

Merged
merged 19 commits into from
Oct 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions refinery/analysis_manager/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ def refinery_import_state(self):
return get_task_group_state(self.refinery_import_task_group_id)

def galaxy_file_import_state(self):
return get_task_group_state(self.galaxy_import_task_group_id)

def tool_based_galaxy_file_import_state(self):
if self.galaxy_import_state and self.galaxy_import_progress != 0:
Copy link
Member

Choose a reason for hiding this comment

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

galaxy_import_state is a field of AnalysisStatus. Is it necessary to check whether it exists?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, you can still construct an AnalysisStatus like so w/o a galaxy_import_state: AnalysisStatus.objects.create(analysis=analysis)

Copy link
Member

Choose a reason for hiding this comment

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

Right but the field would actually exists with a default value, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

The default value for a blank=True is u'' which is still falsey

For example, this test case passes:

def test_analysis_status_galaxy_import_state_is_falsey_by_default(self):
        analysis_status = AnalysisStatus.objects.create(analysis=self.analysis)
        self.assertFalse(analysis_status.galaxy_import_state)

Copy link
Member

Choose a reason for hiding this comment

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

Yes but the field is there, so checking for its existence is not necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

Its necessary as far as I can tell.

One would need to assert that there has been a galaxy_import_state set and that some galaxy_import_progress has happened before going ahead and handing a response over to the front end to display.
Otherwise theres nothing meaningful for the UI to display yet.

I could imagine a scenario occurring where the galaxy_import_state is still equal to u'' and even though the galaxy_import_state field is present, passing that information along to the frontend without checking it first would yield odd results.

Copy link
Member

Choose a reason for hiding this comment

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

OK but you are already checking it by self.galaxy_import_progress != 0

Copy link
Member Author

Choose a reason for hiding this comment

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

Just because there is positive galaxy_import_progress doesn't mean that a valid galaxy_import_state has been set as well?

Something like AnalyisStatus.objects.create(analysis=<analysis>, galaxy_import_progress=2) Would break the UI with your proposed change

galaxy_file_import_state = [{
'state': self.galaxy_import_state,
Expand Down
46 changes: 28 additions & 18 deletions refinery/analysis_manager/schemas/AnalysisConfig.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"allOf": [{"$ref": "BaseAnalysisConfig.json#"}],
"oneOf":[
{
"required": ["nodeSetUuid"],
"properties": {
"nodeSetUuid": {"$ref": "BaseAnalysisConfig.json#patterns/uuid"}
}
"type": "object",
"required": [
"user_id",
"study_uuid",
"tool_uuid",
"workflow_uuid"

],
"patterns": {
"uuid": {
"type": "string",
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
}
},
"properties": {
"name": {
"type": "string"
},
"study_uuid": {
"$ref": "#/patterns/uuid"
},
"tool_uuid": {
"$ref": "#/patterns/uuid"
},
{
"required": ["nodeRelationshipUuid"],
"properties": {
"nodeRelationshipUuid": {"$ref": "BaseAnalysisConfig.json#patterns/uuid"}
}
"user_id": {
"type": "number"
},
{
"required": ["toolUuid"],
"properties": {
"toolUuid": {"$ref": "BaseAnalysisConfig.json#patterns/uuid"}
}
"workflow_uuid": {
"$ref": "#/patterns/uuid"
}
]
}
}
29 changes: 0 additions & 29 deletions refinery/analysis_manager/schemas/BaseAnalysisConfig.json

This file was deleted.