Enhance the Tool Shed and Galaxy APIs to support resetting metadata on repositories in the Tool Shed or installed into Galaxy respectively. When resetting repository metadata in the Tool Shed, if the API key is associated with an admin user, then setting the my_writable param value to True will restrict resetting metadata to only repositories that are writable by the user in addition to those repositories of type tool_dependency_definition. This param is ignored if the current user is not an admin user, in which case this same restriction is automatic. Also, when resetting metadata in the Tool Shed, repositories of type tool_dependency_definition are reset before repositories of type unrestricted. When setting metadata for installed repositories in Galaxy, neither repository types nor order are considered since these concepts are irrelevant in that environment.

This commit is contained in:
Greg Von Kuster
2013-10-16 14:19:26 -04:00
parent 683a561521
commit a610d0d458
10 changed files with 250 additions and 43 deletions
@@ -45,7 +45,7 @@ def main( options ):
data = {}
# NOTE: to import a single workflow, add an index to data (e.g.,
# data[ 'index' ] = 0
# and change the url to be ~/import_workflow (simgular). For example,
# and change the url to be ~/import_workflow (singular). For example,
# url = '%s%s' % ( base_galaxy_url, '/api/tool_shed_repositories/%s/import_workflow' % str( tool_shed_repository_id ) )
url = '%s%s' % ( base_galaxy_url, '/api/tool_shed_repositories/%s/import_workflows' % str( tool_shed_repository_id ) )
submit( options.api, url, data )
@@ -0,0 +1,29 @@
#!/usr/bin/env python
"""
Script to reset metadata on all Tool Shed repositories installed into a Galaxy instance. The received
API key must be associated with a Galaxy admin user.
usage: reset_metadata_on_installed_repositories.py key
Here is a working example of how to use this script.
python ./reset_metadata_on_installed_repositories.py -a 22be3b -u http://localhost:8763/
"""
import argparse
import os
import sys
sys.path.insert( 0, os.path.dirname( __file__ ) )
from common import submit
def main( options ):
api_key = options.api
base_galaxy_url = options.galaxy_url.rstrip( '/' )
url = '%s/api/tool_shed_repositories/reset_metadata_on_installed_repositories' % base_galaxy_url
submit( options.api, url, {} )
if __name__ == '__main__':
parser = argparse.ArgumentParser( description='Reset metadata on all Tool Shed repositories installed into Galaxy via the Galaxy API.' )
parser.add_argument( "-a", "--api", dest="api", required=True, help="API Key" )
parser.add_argument( "-u", "--url", dest="galaxy_url", required=True, help="Galaxy URL" )
options = parser.parse_args()
main( options )