Skip to content

Commit

Permalink
Update the version endpoint (#196)
Browse files Browse the repository at this point in the history
* Update the key name.

* Loosen the restrictions for versions for eaiser testing.

* Update the tests.
  • Loading branch information
rexwangcc authored Nov 26, 2019
1 parent 082ff75 commit 018eb04
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
15 changes: 6 additions & 9 deletions lira/api/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,34 @@
from lira import lira_utils


def get_version():
"""Collect and return Lira's and all its dependencies' versions.
TODO: make this endpoint more granular and comply with the API definition
"""
def get_version() -> dict:
"""Collect and return Lira's and all its dependencies' versions."""
logger = logging.getLogger('{module_path}'.format(module_path=__name__))
logger.debug('Version request received')

lira_config = current_app.config

try:
submit_wdl_version = (
adapter_pipelines_version = (
lira_utils.parse_github_resource_url(lira_config.get('submit_wdl')).version
or 'Unknown'
)
except ValueError:
submit_wdl_version = 'Unknown'
adapter_pipelines_version = 'Unknown'

workflow_info = {
wdl.workflow_name: {
'version': wdl.workflow_version,
'subscription_id': wdl.subscription_id,
'query': f'https://github.com/HumanCellAtlas/lira/tree/{lira_config.version}/subscription/elasticsearch_queries',
}
for wdl in lira_config.wdls
}

version_info = {
'cromwell_tools_version': cromwell_tools.__version__ or 'Unknown',
'lira_version': lira_config.version,
'submit_wdl_version': submit_wdl_version,
'adapter_pipelines_version': adapter_pipelines_version,
}

settings_info = {
Expand Down
5 changes: 1 addition & 4 deletions lira/lira_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,12 @@ definitions:
properties:
cromwell_tools_version:
type: string
pattern: '(v)?([0-9]+)\.([0-9]+)\.([0-9]+)'
example: "v1.0.0"
lira_version:
type: string
pattern: '(v)?([0-9]+)\.([0-9]+)\.([0-9]+)'
example: "v1.0.0"
submit_wdl_version:
adapter_pipelines_version:
type: string
pattern: '(v)?([0-9]+)\.([0-9]+)\.([0-9]+)'
example: "v1.0.0"
workflow_info:
type: object
Expand Down
2 changes: 1 addition & 1 deletion lira/test/test_bundle_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ def test_get_hash_id(self):
encoding='utf-8',
)
)
self.assertEquals(workflow_inputs_hash, expected_hash.hexdigest())
self.assertEqual(workflow_inputs_hash, expected_hash.hexdigest())
2 changes: 1 addition & 1 deletion lira/test/test_get_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@ def test_get_version_can_fetch_correct_version_info(self):
cromwell_tools.__version__,
)
self.assertEqual(
json_response.get('version_info').get('submit_wdl_version'), 'v0.1.5'
json_response.get('version_info').get('adapter_pipelines_version'), 'v0.1.5'
)

0 comments on commit 018eb04

Please sign in to comment.