commit/galaxy-central: greg: Slight enhancements for managing simple repository dependencies.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/a3915a264f6c/ changeset: a3915a264f6c user: greg date: 2012-12-22 21:12:41 summary: Slight enhancements for managing simple repository dependencies. affected #: 3 files diff -r 32ea53484cec638021a38c0c252d5dc1d4bf5da4 -r a3915a264f6c3ae7cec12778b3c3e7794ca5a8e8 lib/galaxy/model/__init__.py --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -3014,6 +3014,7 @@ installation_status = Bunch( NEW='New', CLONING='Cloning', SETTING_TOOL_VERSIONS='Setting tool versions', + INSTALLING_REPOSITORY_DEPENDENCIES='Installing repository dependencies', INSTALLING_TOOL_DEPENDENCIES='Installing tool dependencies', LOADING_PROPRIETARY_DATATYPES='Loading proprietary datatypes', INSTALLED='Installed', @@ -3166,6 +3167,62 @@ def has_readme_files( self ): return self.metadata and 'readme_files' in self.metadata @property + def required_repositories( self ): + required_repositories = [] + for rrda in self.repository_dependencies: + repository_dependency = rrda.repository_dependency + required_repository = repository_dependency.repository + required_repositories.append( required_repository ) + return required_repositories + @property + def installed_required_repositories( self ): + """Return the repository's repository dependencies that are currently installed.""" + installed_required_repositories = [] + for required_repository in self.required_repositories: + if required_repository.status == self.installation_status.INSTALLED: + installed_required_repositories.append( required_repository ) + return installed_required_repositories + @property + def missing_required_repositories( self ): + """Return the repository's repository dependencies that are not currently installed, and may not ever have been installed.""" + missing_required_repositories = [] + for required_repository in self.required_repositories: + if required_repository.status not in [ self.installation_status.INSTALLED ]: + missing_required_repositories.append( required_repository ) + return missing_required_repositories + @property + def required_repositories_being_installed( self ): + required_repositories_being_installed = [] + for required_repository in self.required_repositories: + if tool_dependency.status == ToolDependency.installation_status.INSTALLING: + required_repositories_being_installed.append( required_repository ) + return required_repositories_being_installed + @property + def required_repositories_missing_or_being_installed( self ): + required_repositories_missing_or_being_installed = [] + for required_repository in self.required_repositories: + if required_repository.status in [ self.installation_status.ERROR, + self.installation_status.INSTALLING, + self.installation_status.NEVER_INSTALLED, + self.installation_status.UNINSTALLED ]: + required_repositories_missing_or_being_installed.append( required_repository ) + return required_repositories_missing_or_being_installed + @property + def required_repositories_with_installation_errors( self ): + required_repositories_with_installation_errors = [] + for required_repository in self.required_repositories: + if required_repository.status == self.installation_status.ERROR: + required_repositories_with_installation_errors.append( required_repository ) + return required_repositories_with_installation_errors + @property + def uninstalled_required_repositories( self ): + """Return the repository's repository dependencies that have been uninstalled.""" + uninstalled_required_repositories = [] + for required_repository in self.required_repositories: + if required_repository.status == self.installation_status.UNINSTALLED: + uninstalled_required_repositories.append( required_repository ) + return uninstalled_required_repositories + @property def installed_tool_dependencies( self ): """Return the repository's tool dependencies that are currently installed.""" installed_dependencies = [] diff -r 32ea53484cec638021a38c0c252d5dc1d4bf5da4 -r a3915a264f6c3ae7cec12778b3c3e7794ca5a8e8 lib/galaxy/util/shed_util.py --- a/lib/galaxy/util/shed_util.py +++ b/lib/galaxy/util/shed_util.py @@ -856,7 +856,8 @@ def populate_containers_dict_from_repository_metadata( trans, tool_shed_url, tool_path, repository, reinstalling=False ): """ Retrieve necessary information from the received repository's metadata to populate the containers_dict for display. This methos is called only - from Galaxy and not the tool shed. + from Galaxy (not the tool shed) when displaying repository dependencies for installed repositories and when displaying them for uninstalled + repositories that are being reinstalled. """ metadata = repository.metadata if metadata: @@ -876,43 +877,24 @@ readme_files_dict = suc.build_readme_files_dict( repository.metadata, tool_path ) else: readme_files_dict = None - repository_dependencies = metadata.get( 'repository_dependencies', None ) repository_dependencies_dict_for_display = {} - if repository_dependencies: - # We need to add a root_key entry to the repository_dependencies dictionary since it will not be included in the installed tool shed repository metadata. + if repository.has_repository_dependencies: + rd_tups = [] + # We need to add a root_key entry to the repository_dependencies dictionary for proper display parsing. root_key = container_util.generate_repository_dependencies_key_for_repository( repository.tool_shed, repository.name, repository.owner, - repository.installed_changeset_revision ) - rd_tups_for_display = [] - rd_tups = repository_dependencies[ 'repository_dependencies' ] - for index, rd_tup in enumerate( rd_tups ): - # Get the id and the installation status of the required repository. - tool_shed, name, owner, changeset_revision = rd_tup - required_repository = suc.get_repository_for_dependency_relationship( trans.app, tool_shed, name, owner, changeset_revision ) - # TODO: Since the changeset revision defined in the tool shed repository's repository_dependencies.xml file may have a changeset_revision - # value that is outdated, we ened to make a call to the tool shed get the update dchangeset revision if repository is still None here. - if required_repository: - rd_tup.append( required_repository.id ) - rd_tup.append( str( required_repository.status ) ) - else: - # See above TODO. For now, we'll take a short cut and attempt to find the repository by name and owner only. This will not work long - # term because multiple revisions of a reposiory with the same name and owner could be installed into a Galaxy instance. The long term - # fix is to call get_update_to_changeset_revision_and_ctx_rev( trans, repository ) for each required repository. - required_repository = trans.sa_session.query( trans.model.ToolShedRepository ) \ - .filter( and_( trans.model.ToolShedRepository.table.c.name == name, - trans.model.ToolShedRepository.table.c.owner == owner ) ) \ - .first() - if required_repository: - rd_tup.append( required_repository.id ) - rd_tup.append( str( required_repository.status ) ) - else: - rd_tup.append( None ) - rd_tup.append( None ) - rd_tups[ index ] = rd_tup + repository.installed_changeset_revision ) + # The repository dependencies container will include only the immediate repository dependencies of this repository, so + # the container will be only a single level in depth. + for rr in repository.required_repositories: + rd_tup = [ rr.tool_shed, rr.name, rr.owner, rr.changeset_revision, rr.id, rr.status ] + rd_tups.append( rd_tup ) repository_dependencies_dict_for_display[ 'root_key' ] = root_key repository_dependencies_dict_for_display[ root_key ] = rd_tups - repository_dependencies_dict_for_display[ 'description' ] = repository_dependencies[ 'description' ] + # Get the description from the metadata in case it has a value. + repository_dependencies = metadata.get( 'repository_dependencies', {} ) + repository_dependencies_dict_for_display[ 'description' ] = repository_dependencies.get( 'description', None ) all_tool_dependencies = metadata.get( 'tool_dependencies', None ) tool_dependencies, missing_tool_dependencies = get_installed_and_missing_tool_dependencies( trans, repository, all_tool_dependencies ) if reinstalling: diff -r 32ea53484cec638021a38c0c252d5dc1d4bf5da4 -r a3915a264f6c3ae7cec12778b3c3e7794ca5a8e8 lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py --- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py @@ -32,6 +32,7 @@ status_label = tool_shed_repository.status if tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.CLONING, trans.model.ToolShedRepository.installation_status.SETTING_TOOL_VERSIONS, + trans.model.ToolShedRepository.installation_status.INSTALLING_REPOSITORY_DEPENDENCIES, trans.model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES, trans.model.ToolShedRepository.installation_status.LOADING_PROPRIETARY_DATATYPES ]: bgcolor = trans.model.ToolShedRepository.states.INSTALLING @@ -43,9 +44,12 @@ elif tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.DEACTIVATED ]: bgcolor = trans.model.ToolShedRepository.states.WARNING elif tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.INSTALLED ]: - if tool_shed_repository.missing_tool_dependencies: + if tool_shed_repository.missing_required_repositories: bgcolor = trans.model.ToolShedRepository.states.WARNING - status_label = '%s, missing dependencies' % status_label + status_label = '%s, missing repository dependencies' % status_label + elif tool_shed_repository.missing_tool_dependencies: + bgcolor = trans.model.ToolShedRepository.states.WARNING + status_label = '%s, missing tool dependencies' % status_label else: bgcolor = trans.model.ToolShedRepository.states.OK else: @@ -182,6 +186,7 @@ [ model.ToolShedRepository.installation_status.NEW, model.ToolShedRepository.installation_status.CLONING, model.ToolShedRepository.installation_status.SETTING_TOOL_VERSIONS, + model.ToolShedRepository.installation_status.INSTALLING_REPOSITORY_DEPENDENCIES, model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES, model.ToolShedRepository.installation_status.LOADING_PROPRIETARY_DATATYPES, model.ToolShedRepository.installation_status.UNINSTALLED ], \ @@ -500,7 +505,7 @@ removed = False if removed: tool_shed_repository.uninstalled = True - # Remove all installed tool dependencies. + # Remove all installed tool dependencies, but don't touch any repository dependencies.. for tool_dependency in tool_shed_repository.installed_tool_dependencies: uninstalled, error_message = shed_util.remove_tool_dependency( trans, tool_dependency ) if error_message: 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)
-
Bitbucket