commit/galaxy-central: greg: Fixes and code cleanup for the tool shed's "Latest revision" queries.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/ab61a1b51a60/ Changeset: ab61a1b51a60 User: greg Date: 2014-01-13 21:49:40 Summary: Fixes and code cleanup for the tool shed's "Latest revision" queries. Affected #: 5 files diff -r 757ede99b3dee051a9d41b61bbef6a1afaaae35c -r ab61a1b51a608183922301aa8bdb48a1d98c0f9b lib/galaxy/webapps/tool_shed/controllers/repository.py --- a/lib/galaxy/webapps/tool_shed/controllers/repository.py +++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py @@ -311,9 +311,9 @@ message = 'This list contains repositories that match the following criteria:<br>' message += '<ul>' message += '<li>you are authorized to update them</li>' - message += '<li>the latest installable revision contains at least 1 tool</li>' message += '<li>the latest installable revision is not missing any tool test components</li>' - message += '<li>the latest installable revision has installation errors (the repository itself, repository dependencies or tool dependencies)</li>' + message += '<li>the latest installable revision has installation errors (the repository itself, ' + message += 'repository dependencies or tool dependencies)</li>' message += '</ul>' kwd[ 'message' ] = message kwd[ 'status' ] = 'warning' @@ -340,8 +340,10 @@ message = 'This list contains repositories that match the following criteria:<br>' message += '<ul>' message += '<li>you are authorized to update them</li>' - message += '<li>the latest installable revision contains at least 1 tool</li>' - message += '<li>the latest installable revision has <b>Skip automated testing of tools in this revision</b> checked</li>' + message += '<li>the latest installable revision has <b>Skip automated testing of tools in this ' + message += 'revision</b> checked if the repository type is <b>Unrestricted</b> or <b>Skip ' + message += 'automated testing of this tool dependency recipe</b> checked if the repository ' + message += 'type is <b>Tool dependency definition</b></li>' message += '</ul>' kwd[ 'message' ] = message kwd[ 'status' ] = 'warning' @@ -566,9 +568,9 @@ if 'message' not in kwd: message = 'This list contains repositories that match the following criteria:<br>' message += '<ul>' - message += '<li>the latest installable revision contains at least 1 tool</li>' message += '<li>the latest installable revision is not missing any tool test components</li>' - message += '<li>the latest installable revision has installation errors (the repository itself, repository dependencies or tool dependencies)</li>' + message += '<li>the latest installable revision has installation errors (the repository itself, ' + message += 'repository dependencies or tool dependencies)</li>' message += '</ul>' kwd[ 'message' ] = message kwd[ 'status' ] = 'warning' @@ -649,8 +651,10 @@ if 'message' not in kwd: message = 'This list contains repositories that match the following criteria:<br>' message += '<ul>' - message += '<li>the latest installable revision contains at least 1 tool</li>' - message += '<li>the latest installable revision has <b>Skip automated testing of tools in this revision</b> checked</li>' + message += '<li>the latest installable revision has <b>Skip automated testing of tools in this ' + message += 'revision</b> checked if the repository type is <b>Unrestricted</b> or <b>Skip ' + message += 'automated testing of this tool dependency recipe</b> checked if the repository ' + message += 'type is <b>Tool dependency definition</b></li>' message += '</ul>' kwd[ 'message' ] = message kwd[ 'status' ] = 'warning' diff -r 757ede99b3dee051a9d41b61bbef6a1afaaae35c -r ab61a1b51a608183922301aa8bdb48a1d98c0f9b lib/galaxy/webapps/tool_shed/model/__init__.py --- a/lib/galaxy/webapps/tool_shed/model/__init__.py +++ b/lib/galaxy/webapps/tool_shed/model/__init__.py @@ -238,10 +238,10 @@ 'has_repository_dependencies', 'includes_datatypes', 'includes_tools', 'includes_tool_dependencies', 'includes_tools_for_display_in_tool_panel', 'includes_workflows' ) - def __init__( self, id=None, repository_id=None, changeset_revision=None, metadata=None, tool_versions=None, malicious=False, downloadable=False, - missing_test_components=None, tools_functionally_correct=False, do_not_test=False, test_install_error=False, time_last_tested=None, - tool_test_results=None, has_repository_dependencies=False, includes_datatypes=False, includes_tools=False, includes_tool_dependencies=False, - includes_workflows=False ): + def __init__( self, id=None, repository_id=None, changeset_revision=None, metadata=None, tool_versions=None, malicious=False, + downloadable=False, missing_test_components=None, tools_functionally_correct=False, do_not_test=False, + test_install_error=False, time_last_tested=None, tool_test_results=None, has_repository_dependencies=False, + includes_datatypes=False, includes_tools=False, includes_tool_dependencies=False, includes_workflows=False ): self.id = id self.repository_id = repository_id self.changeset_revision = changeset_revision diff -r 757ede99b3dee051a9d41b61bbef6a1afaaae35c -r ab61a1b51a608183922301aa8bdb48a1d98c0f9b lib/tool_shed/grids/repository_grids.py --- a/lib/tool_shed/grids/repository_grids.py +++ b/lib/tool_shed/grids/repository_grids.py @@ -1693,12 +1693,11 @@ def filter_by_latest_downloadable_changeset_revision_that_has_failing_tool_tests( trans, repository ): """ - Inspect the latest installable changeset revision for the received repository to see if it includes at least 1 tool that has at least 1 failing test. + Inspect the latest downloadable changeset revision for the received repository to see if it + includes at least 1 tool that has at least 1 failing test. This will filter out repositories + of type tool_dependency_definition. """ - encoded_repository_id = trans.security.encode_id( repository.id ) - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) - tip_ctx = str( repo.changectx( repo.changelog.tip() ) ) - repository_metadata = get_latest_installable_repository_metadata_if_it_includes_tools( trans, repository ) + repository_metadata = get_latest_downloadable_repository_metadata_if_it_includes_tools( trans, repository ) if repository_metadata \ and repository_metadata.tool_test_results is not None \ and not repository_metadata.missing_test_components \ @@ -1709,109 +1708,135 @@ def filter_by_latest_downloadable_changeset_revision_that_has_missing_tool_test_components( trans, repository ): """ - Inspect the latest installable changeset revision for the received repository to see if it includes tools that are either missing functional tests - or functional test data. If the changset revision includes tools, but is missing tool test components, return the changeset revision hash. + Inspect the latest downloadable changeset revision for the received repository to see if it + includes tools that are either missing functional tests or functional test data. If the + changset revision includes tools but is missing tool test components, return the changeset + revision hash. This will filter out repositories of type tool_dependency_definition. """ - encoded_repository_id = trans.security.encode_id( repository.id ) - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) - tip_ctx = str( repo.changectx( repo.changelog.tip() ) ) - repository_metadata = get_latest_installable_repository_metadata_if_it_includes_tools( trans, repository ) + repository_metadata = get_latest_downloadable_repository_metadata_if_it_includes_tools( trans, repository ) if repository_metadata and repository_metadata.missing_test_components: return repository_metadata.changeset_revision return None def filter_by_latest_downloadable_changeset_revision_that_has_no_failing_tool_tests( trans, repository ): """ - Inspect the latest installable changeset revision for the received repository to see if it includes tools with no failing tests. + Inspect the latest downloadable changeset revision for the received repository to see if it + includes tools with no failing tests. This will filter out repositories of type tool_dependency_definition. """ - encoded_repository_id = trans.security.encode_id( repository.id ) - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) - tip_ctx = str( repo.changectx( repo.changelog.tip() ) ) - repository_metadata = get_latest_installable_repository_metadata_if_it_includes_tools( trans, repository ) - if repository_metadata and not repository_metadata.missing_test_components and repository_metadata.tools_functionally_correct: + repository_metadata = get_latest_downloadable_repository_metadata_if_it_includes_tools( trans, repository ) + if repository_metadata is not None and \ + not repository_metadata.missing_test_components and \ + repository_metadata.tools_functionally_correct: return repository_metadata.changeset_revision return None def filter_by_latest_metadata_changeset_revision_that_has_invalid_tools( trans, repository ): """ - Inspect the latest changeset revision with associated metadata for the received repository to see if it has invalid tools. + Inspect the latest changeset revision with associated metadata for the received repository + to see if it has invalid tools. This will filter out repositories of type tool_dependency_definition. """ - encoded_repository_id = trans.security.encode_id( repository.id ) - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) - tip_ctx = str( repo.changectx( repo.changelog.tip() ) ) repository_metadata = get_latest_repository_metadata_if_it_includes_invalid_tools( trans, repository ) - if repository_metadata: + if repository_metadata is not None: return repository_metadata.changeset_revision return None def filter_by_latest_downloadable_changeset_revision_that_has_test_install_errors( trans, repository ): """ - Inspect the latest installable changeset revision for the received repository to see if it has tool test installation errors. + Inspect the latest downloadable changeset revision for the received repository to see if + it has tool test installation errors. This will return repositories of type unrestricted + as well as type tool_dependency_definition. """ - encoded_repository_id = trans.security.encode_id( repository.id ) - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) - tip_ctx = str( repo.changectx( repo.changelog.tip() ) ) - repository_metadata = get_latest_installable_repository_metadata_if_it_includes_tools( trans, repository ) - if repository_metadata \ - and repository_metadata.test_install_error \ - and not repository_metadata.missing_test_components: + repository_metadata = get_latest_downloadable_repository_metadata_if_it_has_test_install_errors( trans, repository ) + # Filter further by eliminating repositories that are missing test components. + if repository_metadata is not None and not repository_metadata.missing_test_components: return repository_metadata.changeset_revision return None def filter_by_latest_downloadable_changeset_revision_with_skip_tests_checked( trans, repository ): """ - Inspect the latest installable changeset revision for the received repository to see if skip tests is checked. + Inspect the latest downloadable changeset revision for the received repository to see if skip tests + is checked. This will return repositories of type unrestricted as well as type tool_dependency_definition. """ - encoded_repository_id = trans.security.encode_id( repository.id ) - repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) - tip_ctx = str( repo.changectx( repo.changelog.tip() ) ) - repository_metadata = get_latest_installable_repository_metadata_if_it_includes_tools( trans, repository ) - if repository_metadata and repository_metadata.skip_tool_tests: + repository_metadata = get_latest_downloadable_repository_metadata( trans, repository ) + # The skip_tool_tests attribute is a SkipToolTest table mapping backref to the RepositoryMetadata table. + if repository_metadata is not None and repository_metadata.skip_tool_tests: return repository_metadata.changeset_revision return None -def get_latest_repository_metadata_if_it_includes_invalid_tools( trans, repository ): - """Return the latest repository_metadata record for the received repository that contains invalid tools if one exists.""" +def get_latest_downloadable_repository_metadata( trans, repository ): + """ + Return the latest downloadable repository_metadata record for the received repository. This will + return repositories of type unrestricted as well as type tool_dependency_definition. + """ encoded_repository_id = trans.security.encode_id( repository.id ) repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) tip_ctx = str( repo.changectx( repo.changelog.tip() ) ) repository_metadata = None try: repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, encoded_repository_id, tip_ctx ) - if repository_metadata: - metadata = repository_metadata.metadata - if metadata and 'invalid_tools' in metadata: - return repository_metadata - return None + if repository_metadata is not None and repository_metadata.downloadable: + return repository_metadata return None except: - latest_installable_revision = suc.get_previous_metadata_changeset_revision( repository, repo, tip_ctx, downloadable=False ) - if latest_installable_revision == suc.INITIAL_CHANGELOG_HASH: + latest_downloadable_revision = suc.get_previous_metadata_changeset_revision( repository, repo, tip_ctx, downloadable=True ) + if latest_downloadable_revision == suc.INITIAL_CHANGELOG_HASH: return None - repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, encoded_repository_id, latest_installable_revision ) - if repository_metadata: - metadata = repository_metadata.metadata - if metadata and 'invalid_tools' in metadata: - return repository_metadata - return None + repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, + encoded_repository_id, + latest_downloadable_revision ) + if repository_metadata is not None and repository_metadata.downloadable: + return repository_metadata return None -def get_latest_installable_repository_metadata_if_it_includes_tools( trans, repository ): - """Return the latest installable repository_metadata record for the received repository that contains valid tools if one exists.""" +def get_latest_downloadable_repository_metadata_if_it_includes_tools( trans, repository ): + """ + Return the latest downloadable repository_metadata record for the received repository if its + includes_tools attribute is True. This will filter out repositories of type tool_dependency_definition. + """ + repository_metadata = get_latest_downloadable_repository_metadata( trans, repository ) + if repository_metadata is not None and repository_metadata.includes_tools: + return repository_metadata + return None + +def get_latest_downloadable_repository_metadata_if_it_has_test_install_errors( trans, repository ): + """ + Return the latest downloadable repository_metadata record for the received repository if its + test_install_error attribute is True. This will return repositories of type unrestricted as + well as type tool_dependency_definition. + """ + repository_metadata = get_latest_downloadable_repository_metadata( trans, repository ) + if repository_metadata is not None and repository_metadata.test_install_error: + return repository_metadata + return None + +def get_latest_repository_metadata( trans, repository ): + """ + Return the latest repository_metadata record for the received repository if it exists. This will + return repositories of type unrestricted as well as type tool_dependency_definition. + """ encoded_repository_id = trans.security.encode_id( repository.id ) repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) tip_ctx = str( repo.changectx( repo.changelog.tip() ) ) - repository_metadata = None try: repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, encoded_repository_id, tip_ctx ) - if repository_metadata and repository_metadata.includes_tools and repository_metadata.downloadable: + return repository_metadata + except: + latest_downloadable_revision = suc.get_previous_metadata_changeset_revision( repository, repo, tip_ctx, downloadable=False ) + if latest_downloadable_revision == suc.INITIAL_CHANGELOG_HASH: + return None + repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, + encoded_repository_id, + latest_downloadable_revision ) + return repository_metadata + +def get_latest_repository_metadata_if_it_includes_invalid_tools( trans, repository ): + """ + Return the latest repository_metadata record for the received repository that contains invalid + tools if one exists. This will filter out repositories of type tool_dependency_definition. + """ + repository_metadata = get_latest_repository_metadata( trans, repository ) + if repository_metadata is not None: + metadata = repository_metadata.metadata + if metadata is not None and 'invalid_tools' in metadata: return repository_metadata - return None - except: - latest_installable_revision = suc.get_previous_metadata_changeset_revision( repository, repo, tip_ctx, downloadable=True ) - if latest_installable_revision == suc.INITIAL_CHANGELOG_HASH: - return None - repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, encoded_repository_id, latest_installable_revision ) - if repository_metadata and repository_metadata.includes_tools and repository_metadata.downloadable: - return repository_metadata - return None + return None diff -r 757ede99b3dee051a9d41b61bbef6a1afaaae35c -r ab61a1b51a608183922301aa8bdb48a1d98c0f9b test/install_and_test_tool_shed_repositories/base/util.py --- a/test/install_and_test_tool_shed_repositories/base/util.py +++ b/test/install_and_test_tool_shed_repositories/base/util.py @@ -852,7 +852,7 @@ owner = repository_dependencies_dict.get( 'owner', None ) changeset_revision = repository_dependencies_dict.get( 'changeset_revision', None ) if name is None or owner is None or changeset_revision is None: - log.debug( 'Skipping invalid repository_dependencies_dict due to missing name,owner or changeset_revision: %s' % \ + log.debug( 'Skipping invalid repository_dependencies_dict due to missing name, owner or changeset_revision: %s' % \ str( repository_dependencies_dict ) ) continue name = str( name ) diff -r 757ede99b3dee051a9d41b61bbef6a1afaaae35c -r ab61a1b51a608183922301aa8bdb48a1d98c0f9b test/install_and_test_tool_shed_repositories/repositories_with_tools/functional_tests.py --- a/test/install_and_test_tool_shed_repositories/repositories_with_tools/functional_tests.py +++ b/test/install_and_test_tool_shed_repositories/repositories_with_tools/functional_tests.py @@ -697,7 +697,7 @@ set_do_not_test = not is_latest_downloadable_revision params = dict( tools_functionally_correct=False, test_install_error=False, - do_not_test=str( set_do_not_test ) ) + do_not_test=set_do_not_test ) response_dict = \ install_and_test_base_util.save_test_results_for_changeset_revision( install_and_test_base_util.galaxy_tool_shed_url, tool_test_results_dicts, Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org