1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/880281e5f422/ Changeset: 880281e5f422 User: greg Date: 2014-03-07 16:36:03 Summary: A few enhancements to the very basic tool shed statistics manager. Affected #: 3 files diff -r 9850950581c7792409ceb0fbfea06bac8fcda6f7 -r 880281e5f42210852a87724b01b4b2411e15a405 lib/galaxy/webapps/tool_shed/util/shed_statistics.py --- a/lib/galaxy/webapps/tool_shed/util/shed_statistics.py +++ b/lib/galaxy/webapps/tool_shed/util/shed_statistics.py @@ -1,51 +1,60 @@ -from time import strftime, gmtime +from time import gmtime +from time import strftime + class ShedCounter( object ): def __init__( self, model ): # TODO: Enhance the ShedCounter to retrieve information from the db instead of displaying what's currently in memory. self.model = model + self.custom_datatypes = 0 self.generation_time = strftime( "%b %d, %Y", gmtime() ) + self.deleted_repositories = 0 + self.deprecated_repositories = 0 + self.invalid_versions_of_tools = 0 self.repositories = 0 - #self.new_repositories = 0 - self.deleted_repositories = 0 - self.invalid_tools = 0 - self.valid_tools = 0 + self.total_clones = 0 + self.valid_versions_of_tools = 0 + self.unique_owners = 0 + self.unique_valid_tools = 0 self.workflows = 0 - self.proprietary_datatypes = 0 - self.total_clones = 0 self.generate_statistics() + @property def sa_session( self ): """Returns a SQLAlchemy session""" return self.model.context + def generate_statistics( self ): + self.custom_datatypes = 0 + self.deleted_repositories = 0 + self.deprecated_repositories = 0 + self.invalid_versions_of_tools = 0 self.repositories = 0 - #self.new_repositories = 0 - self.deleted_repositories = 0 - self.invalid_tools = 0 - self.valid_tools = 0 + self.total_clones = 0 + self.unique_owners = 0 + self.valid_versions_of_tools = 0 + self.unique_valid_tools = 0 self.workflows = 0 - self.proprietary_datatypes = 0 - self.total_clones = 0 + unique_user_ids = [] for repository in self.sa_session.query( self.model.Repository ): self.repositories += 1 self.total_clones += repository.times_downloaded is_deleted = repository.deleted - #is_new = repository.is_new - #if is_deleted and is_new: if is_deleted: self.deleted_repositories += 1 - # self.new_repositories += 1 - #elif is_deleted: - # self.deleted_repositories += 1 - #elif is_new: - # self.new_repositories += 1 else: + if repository.deprecated: + self.deprecated_repositories += 1 + if repository.user_id not in unique_user_ids: + self.unique_owners += 1 + unique_user_ids.append( repository.user_id ) + processed_datatypes = [] processed_guids = [] processed_invalid_tool_configs = [] processed_relative_workflow_paths = [] - processed_datatypes = [] - # A repository's metadata_revisions are those that ignore the value of the repository_metadata.downloadable column. + processed_tool_ids = [] + # A repository's metadata_revisions are those that ignore the value of the + # repository_metadata.downloadable column. for metadata_revision in repository.metadata_revisions: metadata = metadata_revision.metadata if 'tools' in metadata: @@ -54,13 +63,18 @@ if 'guid' in tool_dict: guid = tool_dict[ 'guid' ] if guid not in processed_guids: - self.valid_tools += 1 + self.valid_versions_of_tools += 1 processed_guids.append( guid ) + if 'id' in tool_dict: + tool_id = tool_dict[ 'id' ] + if tool_id not in processed_tool_ids: + self.unique_valid_tools += 1 + processed_tool_ids.append( tool_id ) if 'invalid_tools' in metadata: invalid_tool_configs = metadata[ 'invalid_tools' ] for invalid_tool_config in invalid_tool_configs: if invalid_tool_config not in processed_invalid_tool_configs: - self.invalid_tools += 1 + self.invalid_versions_of_tools += 1 processed_invalid_tool_configs.append( invalid_tool_config ) if 'datatypes' in metadata: datatypes = metadata[ 'datatypes' ] @@ -68,7 +82,7 @@ if 'extension' in datatypes_dict: extension = datatypes_dict[ 'extension' ] if extension not in processed_datatypes: - self.proprietary_datatypes += 1 + self.custom_datatypes += 1 processed_datatypes.append( extension ) if 'workflows' in metadata: workflows = metadata[ 'workflows' ] diff -r 9850950581c7792409ceb0fbfea06bac8fcda6f7 -r 880281e5f42210852a87724b01b4b2411e15a405 templates/webapps/tool_shed/admin/statistics.mako --- a/templates/webapps/tool_shed/admin/statistics.mako +++ b/templates/webapps/tool_shed/admin/statistics.mako @@ -18,29 +18,37 @@ <td>Total repositories</td><td>${trans.app.shed_counter.repositories | h}</td></tr> - ##<tr> - ## <td>Empty repositories</td> - ## <td>${trans.app.shed_counter.new_repositories | h}</td> - ##</tr> + <tr> + <td>Unique owners</td> + <td>${trans.app.shed_counter.unique_owners | h}</td> + </tr> + <tr> + <td>Deprecated repositories</td> + <td>${trans.app.shed_counter.deprecated_repositories | h}</td> + </tr><tr><td>Deleted repositories</td><td>${trans.app.shed_counter.deleted_repositories | h}</td></tr><tr><td>Valid tools</td> - <td>${trans.app.shed_counter.valid_tools | h}</td> + <td>${trans.app.shed_counter.unique_valid_tools | h}</td></tr><tr> - <td>Invalid tools</td> - <td>${trans.app.shed_counter.invalid_tools | h}</td> + <td>Valid versions of tools</td> + <td>${trans.app.shed_counter.valid_versions_of_tools | h}</td></tr><tr> - <td>Workflows</td> + <td>Invalid versions of tools</td> + <td>${trans.app.shed_counter.invalid_versions_of_tools | h}</td> + </tr> + <tr> + <td>Exported Galaxy workflows</td><td>${trans.app.shed_counter.workflows | h}</td></tr><tr> - <td>Proprietary datatypes</td> - <td>${trans.app.shed_counter.proprietary_datatypes | h}</td> + <td>Custom datatypes</td> + <td>${trans.app.shed_counter.custom_datatypes | h}</td></tr><tr><td>Total clones</td> diff -r 9850950581c7792409ceb0fbfea06bac8fcda6f7 -r 880281e5f42210852a87724b01b4b2411e15a405 templates/webapps/tool_shed/index.mako --- a/templates/webapps/tool_shed/index.mako +++ b/templates/webapps/tool_shed/index.mako @@ -44,7 +44,7 @@ <%def name="left_panel()"><% can_review_repositories = trans.app.security_agent.user_can_review_repositories( trans.user ) %><div class="unified-panel-header" unselectable="on"> - <div class='unified-panel-header-inner'>${trans.app.shed_counter.valid_tools | h} valid tools on ${trans.app.shed_counter.generation_time | h}</div> + <div class='unified-panel-header-inner'>${trans.app.shed_counter.unique_valid_tools | h} valid tools on ${trans.app.shed_counter.generation_time | h}</div></div><div class="unified-panel-body"><div class="toolMenu"> 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.