galaxy-commits
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
August 2011
- 1 participants
- 106 discussions
commit/galaxy-central: natefoo: Monkeypatch BigInt(eger) into SQLAlchemy 0.5 and make the bytes column in the quota table a bigint.
by Bitbucket 18 Aug '11
by Bitbucket 18 Aug '11
18 Aug '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/d6fa346d5460/
changeset: d6fa346d5460
user: natefoo
date: 2011-08-18 17:08:47
summary: Monkeypatch BigInt(eger) into SQLAlchemy 0.5 and make the bytes column in the quota table a bigint.
affected #: 3 files (1.8 KB)
--- a/lib/galaxy/model/custom_types.py Wed Aug 17 16:32:09 2011 -0400
+++ b/lib/galaxy/model/custom_types.py Thu Aug 18 11:08:47 2011 -0400
@@ -8,6 +8,11 @@
from galaxy.util.bunch import Bunch
from galaxy.util.aliaspickler import AliasPickleModule
+# For monkeypatching BIGINT
+import sqlalchemy.databases.sqlite
+import sqlalchemy.databases.postgres
+import sqlalchemy.databases.mysql
+
import logging
log = logging.getLogger( __name__ )
@@ -87,3 +92,53 @@
value = value[0:self.impl.length]
return value
+
+class BigInteger( Integer ):
+ """
+ A type for bigger ``int`` integers.
+
+ Typically generates a ``BIGINT`` in DDL, and otherwise acts like
+ a normal :class:`Integer` on the Python side.
+
+ """
+
+class BIGINT( BigInteger ):
+ """The SQL BIGINT type."""
+
+class DBBigInteger( BigInteger ):
+ def get_col_spec( self ):
+ return "BIGINT"
+
+sqlalchemy.databases.postgres.PGBigInteger = DBBigInteger
+sqlalchemy.databases.postgres.colspecs[BigInteger] = DBBigInteger
+sqlalchemy.databases.sqlite.SLBigInteger = DBBigInteger
+sqlalchemy.databases.sqlite.colspecs[BigInteger] = DBBigInteger
+
+class MSBigInteger( BigInteger, sqlalchemy.databases.mysql.MSInteger ):
+ """MySQL BIGINTEGER type."""
+
+ def __init__(self, display_width=None, **kw):
+ """Construct a BIGINTEGER.
+
+ :param display_width: Optional, maximum display width for this number.
+
+ :param unsigned: a boolean, optional.
+
+ :param zerofill: Optional. If true, values will be stored as strings
+ left-padded with zeros. Note that this does not effect the values
+ returned by the underlying database API, which continue to be
+ numeric.
+
+ """
+ self.display_width = display_width
+ sqlalchemy.databases.mysql._NumericType.__init__(self, kw)
+ BigInteger.__init__(self, **kw)
+
+ def get_col_spec(self):
+ if self.display_width is not None:
+ return self._extend("BIGINT(%(display_width)s)" % {'display_width': self.display_width})
+ else:
+ return self._extend("BIGINT")
+
+sqlalchemy.databases.mysql.MSBigInteger = MSBigInteger
+sqlalchemy.databases.mysql.colspecs[BigInteger] = MSBigInteger
--- a/lib/galaxy/model/mapping.py Wed Aug 17 16:32:09 2011 -0400
+++ b/lib/galaxy/model/mapping.py Thu Aug 18 11:08:47 2011 -0400
@@ -217,7 +217,7 @@
Column( "update_time", DateTime, default=now, onupdate=now ),
Column( "name", String( 255 ), index=True, unique=True ),
Column( "description", TEXT ),
- Column( "bytes", Integer ),
+ Column( "bytes", BigInteger ),
Column( "operation", String( 8 ) ),
Column( "deleted", Boolean, index=True, default=False ) )
--- a/lib/galaxy/model/migrate/versions/0080_quota_tables.py Wed Aug 17 16:32:09 2011 -0400
+++ b/lib/galaxy/model/migrate/versions/0080_quota_tables.py Thu Aug 18 11:08:47 2011 -0400
@@ -7,6 +7,7 @@
from migrate import *
from migrate.changeset import *
from galaxy.model.orm.ext.assignmapper import *
+from galaxy.model.custom_types import *
import datetime
now = datetime.datetime.utcnow
@@ -25,7 +26,7 @@
Column( "update_time", DateTime, default=now, onupdate=now ),
Column( "name", String( 255 ), index=True, unique=True ),
Column( "description", TEXT ),
- Column( "bytes", Integer ),
+ Column( "bytes", BigInteger ),
Column( "operation", String( 8 ) ),
Column( "deleted", Boolean, index=True, default=False ) )
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.
1
0
commit/galaxy-central: natefoo: Backed out changeset 6ca0a743296b, Alchemy 0.5 has no BigInteger...
by Bitbucket 17 Aug '11
by Bitbucket 17 Aug '11
17 Aug '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/a6bfc06dbc20/
changeset: a6bfc06dbc20
user: natefoo
date: 2011-08-17 22:32:09
summary: Backed out changeset 6ca0a743296b, Alchemy 0.5 has no BigInteger...
affected #: 2 files (6 bytes)
--- a/lib/galaxy/model/mapping.py Wed Aug 17 16:25:34 2011 -0400
+++ b/lib/galaxy/model/mapping.py Wed Aug 17 16:32:09 2011 -0400
@@ -217,7 +217,7 @@
Column( "update_time", DateTime, default=now, onupdate=now ),
Column( "name", String( 255 ), index=True, unique=True ),
Column( "description", TEXT ),
- Column( "bytes", BigInteger ),
+ Column( "bytes", Integer ),
Column( "operation", String( 8 ) ),
Column( "deleted", Boolean, index=True, default=False ) )
--- a/lib/galaxy/model/migrate/versions/0080_quota_tables.py Wed Aug 17 16:25:34 2011 -0400
+++ b/lib/galaxy/model/migrate/versions/0080_quota_tables.py Wed Aug 17 16:32:09 2011 -0400
@@ -25,7 +25,7 @@
Column( "update_time", DateTime, default=now, onupdate=now ),
Column( "name", String( 255 ), index=True, unique=True ),
Column( "description", TEXT ),
- Column( "bytes", BigInteger ),
+ Column( "bytes", Integer ),
Column( "operation", String( 8 ) ),
Column( "deleted", Boolean, index=True, default=False ) )
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.
1
0
commit/galaxy-central: natefoo: Make the bytes column in the quota table a bigint
by Bitbucket 17 Aug '11
by Bitbucket 17 Aug '11
17 Aug '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/6ca0a743296b/
changeset: 6ca0a743296b
user: natefoo
date: 2011-08-17 22:25:34
summary: Make the bytes column in the quota table a bigint
affected #: 2 files (6 bytes)
--- a/lib/galaxy/model/mapping.py Wed Aug 17 11:15:05 2011 -0400
+++ b/lib/galaxy/model/mapping.py Wed Aug 17 16:25:34 2011 -0400
@@ -217,7 +217,7 @@
Column( "update_time", DateTime, default=now, onupdate=now ),
Column( "name", String( 255 ), index=True, unique=True ),
Column( "description", TEXT ),
- Column( "bytes", Integer ),
+ Column( "bytes", BigInteger ),
Column( "operation", String( 8 ) ),
Column( "deleted", Boolean, index=True, default=False ) )
--- a/lib/galaxy/model/migrate/versions/0080_quota_tables.py Wed Aug 17 11:15:05 2011 -0400
+++ b/lib/galaxy/model/migrate/versions/0080_quota_tables.py Wed Aug 17 16:25:34 2011 -0400
@@ -25,7 +25,7 @@
Column( "update_time", DateTime, default=now, onupdate=now ),
Column( "name", String( 255 ), index=True, unique=True ),
Column( "description", TEXT ),
- Column( "bytes", Integer ),
+ Column( "bytes", BigInteger ),
Column( "operation", String( 8 ) ),
Column( "deleted", Boolean, index=True, default=False ) )
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.
1
0
17 Aug '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/5ce088df9264/
changeset: 5ce088df9264
user: greg
date: 2011-08-17 17:15:05
summary: Add the ability for tool shed users to select repository revisions whose tools can all be successfully loaded into a Galaxy instance in order to view / preview / download various tool versions from a specified repository.
affected #: 6 files (9.5 KB)
--- a/lib/galaxy/webapps/community/controllers/admin.py Wed Aug 17 08:59:56 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/admin.py Wed Aug 17 11:15:05 2011 -0400
@@ -3,9 +3,11 @@
from galaxy.model.orm import *
from galaxy.web.framework.helpers import time_ago, iff, grids
from galaxy.util import inflector
-from common import get_category, get_repository, get_repository_metadata_by_id
+from common import *
from repository import RepositoryListGrid, CategoryListGrid
+from mercurial import hg
import logging
+
log = logging.getLogger( __name__ )
class UserListGrid( grids.Grid ):
@@ -299,11 +301,11 @@
class AdminRepositoryListGrid( RepositoryListGrid ):
operations = [ operation for operation in RepositoryListGrid.operations ]
operations.append( grids.GridOperation( "Delete",
- allow_multiple=True,
+ allow_multiple=False,
condition=( lambda item: not item.deleted ),
async_compatible=False ) )
operations.append( grids.GridOperation( "Undelete",
- allow_multiple=True,
+ allow_multiple=False,
condition=( lambda item: item.deleted ),
async_compatible=False ) )
standard_filters = []
@@ -312,12 +314,15 @@
class IdColumn( grids.IntegerColumn ):
def get_value( self, trans, grid, repository_metadata ):
return repository_metadata.id
- class RepositoryIdColumn( grids.IntegerColumn ):
+ class NameColumn( grids.TextColumn ):
def get_value( self, trans, grid, repository_metadata ):
- return repository_metadata.repository_id
- class ChangesetRevisionColumn( grids.TextColumn ):
+ return repository_metadata.repository.name
+ class RevisionColumn( grids.TextColumn ):
def get_value( self, trans, grid, repository_metadata ):
- return repository_metadata.changeset_revision
+ repository = repository_metadata.repository
+ repo = hg.repository( get_configured_ui(), repository.repo_path )
+ ctx = get_changectx_for_changeset( trans, repo, repository_metadata.changeset_revision )
+ return "%s:%s" % ( str( ctx.rev() ), repository_metadata.changeset_revision )
class MetadataColumn( grids.TextColumn ):
def get_value( self, trans, grid, repository_metadata ):
metadata_str = ''
@@ -347,25 +352,33 @@
IdColumn( "Id",
visible=False,
attach_popup=False ),
- RepositoryIdColumn( "Repository Id",
- key="repository_id",
- attach_popup=False ),
- ChangesetRevisionColumn( "Revision",
- attach_popup=False ),
+ NameColumn( "Name",
+ key="name",
+ model_class=model.Repository,
+ link=( lambda item: dict( operation="view_or_manage_repository",
+ id=item.repository.id,
+ webapp="community" ) ),
+ attach_popup=True ),
+ RevisionColumn( "Revision",
+ attach_popup=False ),
MetadataColumn( "Metadata",
attach_popup=False ),
MaliciousColumn( "Malicious",
attach_popup=False )
]
operations = [ grids.GridOperation( "Delete",
- allow_multiple=True ) ]
+ allow_multiple=False,
+ allow_popup=True,
+ async_compatible=False,
+ confirm="Repository metadata records cannot be recovered after they are deleted. Click OK to delete the selected items." ) ]
standard_filters = []
default_filter = {}
num_rows_per_page = 50
preserve_state = False
use_paging = True
def build_initial_query( self, trans, **kwd ):
- return trans.sa_session.query( self.model_class )
+ return trans.sa_session.query( self.model_class ) \
+ .join( model.Repository.table )
class AdminController( BaseController, Admin ):
@@ -383,12 +396,15 @@
operation = kwd[ 'operation' ].lower()
if operation == "delete":
return self.delete_repository_metadata( trans, **kwd )
+ if operation == "view_or_manage_repository":
+ return trans.response.send_redirect( web.url_for( controller='repository',
+ action='browse_repositories',
+ **kwd ) )
# Render the list view
return self.repository_metadata_list_grid( trans, **kwd )
@web.expose
@web.require_admin
def delete_repository_metadata( self, trans, **kwd ):
- # TODO: Add a javascript confirm before this method executes....
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
@@ -460,6 +476,23 @@
return self.mark_repository_deleted( trans, **kwd )
elif operation == "undelete":
return self.undelete_repository( trans, **kwd )
+ # The changeset_revision_select_field in the RepositoryListGrid performs a refresh_on_change
+ # which sends in request parameters like changeset_revison_1, changeset_revision_2, etc. One
+ # of the many select fields on the grid performed the refresh_on_change, so we loop through
+ # all of the received values to see which value is not the repository tip. If we find it, we
+ # know the refresh_on_change occurred, and we have the necessary repository id and change set
+ # revision to pass on.
+ for k, v in kwd.items():
+ changset_revision_str = 'changeset_revision_'
+ if k.startswith( changset_revision_str ):
+ repository_id = trans.security.encode_id( int( k.lstrip( changset_revision_str ) ) )
+ repository = get_repository( trans, repository_id )
+ if repository.tip != v:
+ return trans.response.send_redirect( web.url_for( controller='repository',
+ action='browse_repositories',
+ operation='view_or_manage_repository',
+ id=trans.security.encode_id( repository.id ),
+ changeset_revision=v ) )
# Render the list view
return self.repository_list_grid( trans, **kwd )
@web.expose
--- a/lib/galaxy/webapps/community/controllers/common.py Wed Aug 17 08:59:56 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/common.py Wed Aug 17 11:15:05 2011 -0400
@@ -190,9 +190,9 @@
repository = get_repository( trans, id )
repo_dir = repository.repo_path
repo = hg.repository( get_configured_ui(), repo_dir )
- change_set = get_change_set( trans, repo, change_set_revision )
invalid_files = []
- if change_set is not None:
+ ctx = get_changectx_for_changeset( trans, repo, change_set_revision )
+ if ctx is not None:
metadata_dict = {}
for root, dirs, files in os.walk( repo_dir ):
if not root.find( '.hg' ) >= 0 and not root.find( 'hgrc' ) >= 0:
@@ -284,8 +284,8 @@
def get_repository_by_name( trans, name ):
"""Get a repository from the database via name"""
return trans.sa_session.query( app.model.Repository ).filter_by( name=name ).one()
-def get_change_set( trans, repo, change_set_revision, **kwd ):
- """Retrieve a specified change set from a repository"""
+def get_changectx_for_changeset( trans, repo, change_set_revision, **kwd ):
+ """Retrieve a specified changectx from a repository"""
for changeset in repo.changelog:
ctx = repo.changectx( changeset )
if str( ctx ) == change_set_revision:
@@ -430,3 +430,28 @@
ToolClass = Tool
return ToolClass( config_file, root, trans.app )
return None
+def build_changeset_revision_select_field( trans, repository, selected_value=None, add_id_to_name=True ):
+ """
+ Build a SelectField whose options are the changeset_revision
+ strings of all downloadable_revisions of the received repository.
+ """
+ repo = hg.repository( get_configured_ui(), repository.repo_path )
+ options = []
+ refresh_on_change_values = []
+ for repository_metadata in repository.downloadable_revisions:
+ changeset_revision = repository_metadata.changeset_revision
+ ctx = get_changectx_for_changeset( trans, repo, changeset_revision )
+ revision_label = "%s:%s" % ( str( ctx.rev() ), changeset_revision )
+ options.append( ( revision_label, changeset_revision ) )
+ refresh_on_change_values.append( changeset_revision )
+ if add_id_to_name:
+ name = 'changeset_revision_%d' % repository.id
+ else:
+ name = 'changeset_revision'
+ select_field = SelectField( name=name,
+ refresh_on_change=True,
+ refresh_on_change_values=refresh_on_change_values )
+ for option_tup in options:
+ selected = selected_value and option_tup[1] == selected_value
+ select_field.add_option( option_tup[0], option_tup[1], selected=selected )
+ return select_field
--- a/lib/galaxy/webapps/community/controllers/repository.py Wed Aug 17 08:59:56 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/repository.py Wed Aug 17 11:15:05 2011 -0400
@@ -74,9 +74,16 @@
class NameColumn( grids.TextColumn ):
def get_value( self, trans, grid, repository ):
return repository.name
- class RevisionColumn( grids.TextColumn ):
+ class RevisionColumn( grids.GridColumn ):
+ def __init__( self, col_name ):
+ grids.GridColumn.__init__( self, col_name )
def get_value( self, trans, grid, repository ):
- return repository.revision
+ """
+ Display a SelectField whose options are the changeset_revision
+ strings of all downloadable_revisions of this repository.
+ """
+ select_field = build_changeset_revision_select_field( trans, repository )
+ return select_field.get_html()
class DescriptionColumn( grids.TextColumn ):
def get_value( self, trans, grid, repository ):
return repository.description
@@ -121,13 +128,14 @@
columns = [
NameColumn( "Name",
key="name",
- link=( lambda item: dict( operation="view_or_manage_repository", id=item.id, webapp="community" ) ),
- attach_popup=False ),
+ link=( lambda item: dict( operation="view_or_manage_repository",
+ id=item.id,
+ webapp="community" ) ),
+ attach_popup=True ),
DescriptionColumn( "Synopsis",
key="description",
attach_popup=False ),
- RevisionColumn( "Revision",
- attach_popup=False ),
+ RevisionColumn( "Revision" ),
CategoryColumn( "Category",
model_class=model.Category,
key="Category.name",
@@ -159,7 +167,7 @@
visible=False,
filterable="standard" ) )
operations = [ grids.GridOperation( "Receive email alerts",
- allow_multiple=True,
+ allow_multiple=False,
condition=( lambda item: not item.deleted ),
async_compatible=False ) ]
standard_filters = []
@@ -257,12 +265,32 @@
category = get_category( trans, category_id )
kwd[ 'f-Category.name' ] = category.name
elif operation == "receive email alerts":
- if kwd[ 'id' ]:
+ if trans.user:
+ if kwd[ 'id' ]:
+ return trans.response.send_redirect( web.url_for( controller='repository',
+ action='set_email_alerts',
+ **kwd ) )
+ else:
+ kwd[ 'message' ] = 'You must be logged in to set email alerts.'
+ kwd[ 'status' ] = 'error'
+ del kwd[ 'operation' ]
+ # The changeset_revision_select_field in the RepositoryListGrid performs a refresh_on_change
+ # which sends in request parameters like changeset_revison_1, changeset_revision_2, etc. One
+ # of the many select fields on the grid performed the refresh_on_change, so we loop through
+ # all of the received values to see which value is not the repository tip. If we find it, we
+ # know the refresh_on_change occurred, and we have the necessary repository id and change set
+ # revision to pass on.
+ for k, v in kwd.items():
+ changset_revision_str = 'changeset_revision_'
+ if k.startswith( changset_revision_str ):
+ repository_id = trans.security.encode_id( int( k.lstrip( changset_revision_str ) ) )
+ repository = get_repository( trans, repository_id )
+ if repository.tip != v:
return trans.response.send_redirect( web.url_for( controller='repository',
- action='set_email_alerts',
- **kwd ) )
- else:
- del kwd[ 'operation' ]
+ action='browse_repositories',
+ operation='view_or_manage_repository',
+ id=trans.security.encode_id( repository.id ),
+ changeset_revision=v ) )
# Render the list view
return self.repository_list_grid( trans, **kwd )
@web.expose
@@ -524,6 +552,7 @@
repository = get_repository( trans, id )
repo = hg.repository( get_configured_ui(), repository.repo_path )
avg_rating, num_ratings = self.get_ave_item_rating_data( trans.sa_session, repository, webapp_model=trans.model )
+ changeset_revision = util.restore_text( params.get( 'changeset_revision', repository.tip ) )
display_reviews = util.string_as_bool( params.get( 'display_reviews', False ) )
alerts = params.get( 'alerts', '' )
alerts_checked = CheckboxField.is_checked( alerts )
@@ -549,7 +578,13 @@
trans.sa_session.flush()
checked = alerts_checked or ( user and user.email in email_alerts )
alerts_check_box = CheckboxField( 'alerts', checked=checked )
- repository_metadata = get_repository_metadata_by_changeset_revision( trans, id, repository.tip )
+ changeset_revision_select_field = build_changeset_revision_select_field( trans,
+ repository,
+ selected_value=changeset_revision,
+ add_id_to_name=False )
+ ctx = get_changectx_for_changeset( trans, repo, changeset_revision )
+ revision_label = "%s:%s" % ( str( ctx.rev() ), changeset_revision )
+ repository_metadata = get_repository_metadata_by_changeset_revision( trans, id, changeset_revision )
if repository_metadata:
metadata = repository_metadata.metadata
else:
@@ -569,6 +604,9 @@
display_reviews=display_reviews,
num_ratings=num_ratings,
alerts_check_box=alerts_check_box,
+ changeset_revision=changeset_revision,
+ changeset_revision_select_field=changeset_revision_select_field,
+ revision_label=revision_label,
is_malicious=is_malicious,
message=message,
status=status )
@@ -582,6 +620,7 @@
repo_dir = repository.repo_path
repo = hg.repository( get_configured_ui(), repo_dir )
repo_name = util.restore_text( params.get( 'repo_name', repository.name ) )
+ changeset_revision = util.restore_text( params.get( 'changeset_revision', repository.tip ) )
description = util.restore_text( params.get( 'description', repository.description ) )
long_description = util.restore_text( params.get( 'long_description', repository.long_description ) )
avg_rating, num_ratings = self.get_ave_item_rating_data( trans.sa_session, repository, webapp_model=trans.model )
@@ -678,7 +717,13 @@
allow_push_select_field = self.__build_allow_push_select_field( trans, current_allow_push_list )
checked = alerts_checked or user.email in email_alerts
alerts_check_box = CheckboxField( 'alerts', checked=checked )
- repository_metadata = get_repository_metadata_by_changeset_revision( trans, id, repository.tip )
+ changeset_revision_select_field = build_changeset_revision_select_field( trans,
+ repository,
+ selected_value=changeset_revision,
+ add_id_to_name=False )
+ ctx = get_changectx_for_changeset( trans, repo, changeset_revision )
+ revision_label = "%s:%s" % ( str( ctx.rev() ), changeset_revision )
+ repository_metadata = get_repository_metadata_by_changeset_revision( trans, id, changeset_revision )
if repository_metadata:
metadata = repository_metadata.metadata
is_malicious = repository_metadata.malicious
@@ -702,6 +747,9 @@
allow_push_select_field=allow_push_select_field,
repo=repo,
repository=repository,
+ changeset_revision=changeset_revision,
+ changeset_revision_select_field=changeset_revision_select_field,
+ revision_label=revision_label,
selected_categories=selected_categories,
categories=categories,
metadata=metadata,
@@ -750,7 +798,7 @@
status = params.get( 'status', 'done' )
repository = get_repository( trans, id )
repo = hg.repository( get_configured_ui(), repository.repo_path )
- ctx = get_change_set( trans, repo, ctx_str )
+ ctx = get_changectx_for_changeset( trans, repo, ctx_str )
if ctx is None:
message = "Repository does not include changeset revision '%s'." % str( ctx_str )
status = 'error'
@@ -878,6 +926,7 @@
return trans.response.send_redirect( web.url_for( controller='repository',
action='manage_repository',
id=id,
+ changeset_revision=ctx_str,
malicious=malicious,
message=message,
status=status ) )
@@ -1034,7 +1083,7 @@
message=message,
status=status )
@web.expose
- def download( self, trans, repository_id, file_type, **kwd ):
+ def download( self, trans, repository_id, changeset_revision, file_type, **kwd ):
# Download an archive of the repository files compressed as zip, gz or bz2.
params = util.Params( kwd )
repository = get_repository( trans, repository_id )
@@ -1043,11 +1092,11 @@
# [web]
# allow_archive = bz2, gz, zip
if file_type == 'zip':
- file_type_str = 'tip.zip'
+ file_type_str = '%s.zip' % changeset_revision
elif file_type == 'bz2':
- file_type_str = 'tip.tar.bz2'
+ file_type_str = '%s.tar.bz2' % changeset_revision
elif file_type == 'gz':
- file_type_str = 'tip.tar.gz'
+ file_type_str = '%s.tar.gz' % changeset_revision
repository.times_downloaded += 1
trans.sa_session.add( repository )
trans.sa_session.flush()
@@ -1081,7 +1130,6 @@
def print_ticks( d ):
pass
cmd = "ls -p '%s'" % folder_path
- # Handle the authentication message if keys are not set - the message is
output = pexpect.run( cmd,
events={ pexpect.TIMEOUT : print_ticks },
timeout=10 )
--- a/lib/galaxy/webapps/community/model/mapping.py Wed Aug 17 08:59:56 2011 -0400
+++ b/lib/galaxy/webapps/community/model/mapping.py Wed Aug 17 11:15:05 2011 -0400
@@ -193,7 +193,8 @@
properties = dict(
categories=relation( RepositoryCategoryAssociation ),
ratings=relation( RepositoryRatingAssociation, order_by=desc( RepositoryRatingAssociation.table.c.update_time ), backref="repositories" ),
- user=relation( User.mapper ) ) )
+ user=relation( User.mapper ),
+ downloadable_revisions=relation( RepositoryMetadata, order_by=desc( RepositoryMetadata.table.c.update_time ) ) ) )
assign_mapper( context, RepositoryMetadata, RepositoryMetadata.table,
properties=dict( repository=relation( Repository ) ) )
--- a/templates/webapps/community/repository/manage_repository.mako Wed Aug 17 08:59:56 2011 -0400
+++ b/templates/webapps/community/repository/manage_repository.mako Wed Aug 17 11:15:05 2011 -0400
@@ -85,9 +85,9 @@
<a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
%if can_download:
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='gz' )}">Download as a .tar.gz file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='bz2' )}">Download as a .tar.bz2 file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='zip' )}">Download as a zip file</a>
%endif
</div>
%endif
@@ -98,6 +98,26 @@
%endif
<div class="toolForm">
+ <div class="toolFormTitle">Revision</div>
+ <div class="toolFormBody">
+ <form name="change_revision" id="change_revision" action="${h.url_for( controller='repository', action='manage_repository', id=trans.security.encode_id( repository.id ) )}" method="post" >
+ <div class="form-row">
+ <%
+ if changeset_revision == repository.tip:
+ tip_str = 'repository tip'
+ else:
+ tip_str = ''
+ %>
+ ${changeset_revision_select_field.get_html()} <i>${tip_str}</i>
+ <div class="toolParamHelp" style="clear: both;">
+ Select a revision to preview download-able versions of tools from this repository.
+ </div>
+ </div>
+ </form>
+ </div>
+</div>
+<p/>
+<div class="toolForm"><div class="toolFormTitle">${repository.name}</div><div class="toolFormBody"><form name="edit_repository" id="edit_repository" action="${h.url_for( controller='repository', action='manage_repository', id=trans.security.encode_id( repository.id ) )}" method="post" >
@@ -129,9 +149,9 @@
<div class="form-row"><label>Revision:</label>
%if can_view_change_log:
- <a href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">${repository.revision}</a>
+ <a href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">${revision_label}</a>
%else:
- ${repository.revision}
+ ${revision_label}
%endif
</div><div class="form-row">
@@ -190,7 +210,7 @@
</a></div><div popupmenu="tool-${tool_dict[ 'id' ].replace( ' ', '_' )}-popup">
- <a class="action-button" href="${h.url_for( controller='repository', action='view_tool_metadata', repository_id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip, tool_id=tool_dict[ 'id' ] )}">View all metadata for this tool</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_tool_metadata', repository_id=trans.security.encode_id( repository.id ), changeset_revision=changeset_revision, tool_id=tool_dict[ 'id' ] )}">View all metadata for this tool</a></div></td><td>${tool_dict[ 'description' ]}</td>
@@ -249,7 +269,7 @@
<div style="clear: both"></div>
%endif
%endif
- <form name="set_metadata" action="${h.url_for( controller='repository', action='set_metadata', id=trans.security.encode_id( repository.id ), ctx_str=repository.tip )}" method="post">
+ <form name="set_metadata" action="${h.url_for( controller='repository', action='set_metadata', id=trans.security.encode_id( repository.id ), ctx_str=changeset_revision )}" method="post"><div class="form-row"><div style="float: left; width: 250px; margin-right: 10px;"><input type="submit" name="set_metadata_button" value="Reset metadata"/>
@@ -406,7 +426,7 @@
<div class="toolForm"><div class="toolFormTitle">Malicious repository tip</div><div class="toolFormBody">
- <form name="malicious" id="malicious" action="${h.url_for( controller='repository', action='set_metadata', id=trans.security.encode_id( repository.id ), ctx_str=repository.tip )}" method="post">
+ <form name="malicious" id="malicious" action="${h.url_for( controller='repository', action='set_metadata', id=trans.security.encode_id( repository.id ), ctx_str=changeset_revision )}" method="post"><div class="form-row"><label>Define repository tip as malicious:</label>
${malicious_check_box.get_html()}
--- a/templates/webapps/community/repository/view_repository.mako Wed Aug 17 08:59:56 2011 -0400
+++ b/templates/webapps/community/repository/view_repository.mako Wed Aug 17 11:15:05 2011 -0400
@@ -82,9 +82,9 @@
<a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
%if can_download:
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='gz' )}">Download as a .tar.gz file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='bz2' )}">Download as a .tar.bz2 file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), file_type='zip' )}">Download as a zip file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='gz' )}">Download as a .tar.gz file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='bz2' )}">Download as a .tar.bz2 file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='zip' )}">Download as a zip file</a>
%endif
</div>
%endif
@@ -95,6 +95,26 @@
%endif
<div class="toolForm">
+ <div class="toolFormTitle">Revision</div>
+ <div class="toolFormBody">
+ <form name="change_revision" id="change_revision" action="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ) )}" method="post" >
+ <div class="form-row">
+ <%
+ if changeset_revision == repository.tip:
+ tip_str = 'repository tip'
+ else:
+ tip_str = ''
+ %>
+ ${changeset_revision_select_field.get_html()} <i>${tip_str}</i>
+ <div class="toolParamHelp" style="clear: both;">
+ Select a revision to preview download-able versions of tools from this repository.
+ </div>
+ </div>
+ </form>
+ </div>
+</div>
+<p/>
+<div class="toolForm"><div class="toolFormTitle">${repository.name}</div><div class="toolFormBody">
%if can_download:
@@ -125,9 +145,9 @@
<div class="form-row"><label>Revision:</label>
%if can_view_change_log:
- <a href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">${repository.revision}</a>
+ <a href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">${revision_label}</a>
%else:
- ${repository.revision}
+ ${revision_label}
%endif
</div><div class="form-row">
@@ -181,7 +201,7 @@
</a></div><div popupmenu="tool-${tool_dict[ 'id' ].replace( ' ', '_' )}-popup">
- <a class="action-button" href="${h.url_for( controller='repository', action='view_tool_metadata', repository_id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip, tool_id=tool_dict[ 'id' ] )}">View all metadata for this tool</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_tool_metadata', repository_id=trans.security.encode_id( repository.id ), changeset_revision=changeset_revision, tool_id=tool_dict[ 'id' ] )}">View all metadata for this tool</a></div></td><td>${tool_dict[ 'description' ]}</td>
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.
1
0
commit/galaxy-central: greg: Added missing wiki link referred to for eample config settings per Dave & Jen.
by Bitbucket 17 Aug '11
by Bitbucket 17 Aug '11
17 Aug '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/0ea888b70d11/
changeset: 0ea888b70d11
user: greg
date: 2011-08-17 14:59:56
summary: Added missing wiki link referred to for eample config settings per Dave & Jen.
affected #: 1 file (43 bytes)
--- a/universe_wsgi.ini.sample Tue Aug 16 13:03:10 2011 -0400
+++ b/universe_wsgi.ini.sample Wed Aug 17 08:59:56 2011 -0400
@@ -9,7 +9,9 @@
# Throughout this sample configuration file, except where stated otherwise,
# uncommented values override the default if left unset, whereas commented
# values are set to the default value.
-# examples of many of these options are explained in more detail in the wiki:
+# Examples of many of these options are explained in more detail in the wiki:
+#
+# http://wiki.g2.bx.psu.edu/Admin/Config
#
# Config hackers are encouraged to check there before asking for help.
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.
1
0
commit/galaxy-central: natefoo: A missing flush caused the test for whether a dataset could be removed from disk on user purge to always return False.
by Bitbucket 16 Aug '11
by Bitbucket 16 Aug '11
16 Aug '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/1b78e2c9aff5/
changeset: 1b78e2c9aff5
user: natefoo
date: 2011-08-16 19:03:10
summary: A missing flush caused the test for whether a dataset could be removed from disk on user purge to always return False.
affected #: 1 file (37 bytes)
--- a/lib/galaxy/web/controllers/dataset.py Tue Aug 16 12:33:35 2011 -0400
+++ b/lib/galaxy/web/controllers/dataset.py Tue Aug 16 13:03:10 2011 -0400
@@ -950,6 +950,7 @@
hda.purged = True
trans.sa_session.add( hda )
trans.log_event( "HDA id %s has been purged" % hda.id )
+ trans.sa_session.flush()
# Don't delete anything if there are active HDAs or any LDDAs, even if
# the LDDAs are deleted. Let the cleanup scripts get it in the latter
# case.
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.
1
0
16 Aug '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/cd508c0ef8fa/
changeset: cd508c0ef8fa
user: dannon
date: 2011-08-16 18:33:35
summary: Histories API (jdlogicman) and cleanup.
affected #: 6 files (2.1 KB)
--- a/lib/galaxy/model/__init__.py Tue Aug 16 12:02:34 2011 -0400
+++ b/lib/galaxy/model/__init__.py Tue Aug 16 12:33:35 2011 -0400
@@ -58,7 +58,7 @@
# Relationships
self.histories = []
self.credentials = []
-
+
def set_password_cleartext( self, cleartext ):
"""Set 'self.password' to the digest of 'cleartext'."""
self.password = new_secure_hash( text_type=cleartext )
@@ -93,7 +93,7 @@
dataset_ids.append( hda.dataset.id )
total += hda.dataset.get_total_size()
return total
-
+
class Job( object ):
"""
A job represents a request to run a tool given input datasets, tool
@@ -126,7 +126,7 @@
self.job_runner_external_id = None
self.post_job_actions = []
self.imported = False
-
+
def add_parameter( self, name, value ):
self.parameters.append( JobParameter( name, value ) )
def add_input_dataset( self, name, dataset ):
@@ -230,12 +230,12 @@
def __init__( self, name, value ):
self.name = name
self.value = value
-
+
class JobToInputDatasetAssociation( object ):
def __init__( self, name, dataset ):
self.name = name
self.dataset = dataset
-
+
class JobToOutputDatasetAssociation( object ):
def __init__( self, name, dataset ):
self.name = name
@@ -257,7 +257,7 @@
self.output_name = output_name
self.action_arguments = action_arguments
self.workflow_step = workflow_step
-
+
class PostJobActionAssociation( object ):
def __init__(self, pja, job):
self.job = job
@@ -277,7 +277,7 @@
elif self.library_dataset_dataset_association:
return self.library_dataset_dataset_association
return None
-
+
class JobExportHistoryArchive( object ):
def __init__( self, job=None, history=None, dataset=None, compressed=False, \
history_attrs_filename=None, datasets_attrs_filename=None,
@@ -289,7 +289,7 @@
self.history_attrs_filename = history_attrs_filename
self.datasets_attrs_filename = datasets_attrs_filename
self.jobs_attrs_filename = jobs_attrs_filename
-
+
class JobImportHistoryArchive( object ):
def __init__( self, job=None, history=None, archive_dir=None ):
self.job = job
@@ -332,7 +332,7 @@
return True
else:
return False
-
+
class Group( object ):
def __init__( self, name = None ):
self.name = name
@@ -344,6 +344,8 @@
self.group = group
class History( object, UsesAnnotations ):
+ api_collection_visible_keys = ( 'id', 'name' )
+ api_element_visible_keys = ( 'id', 'name' )
def __init__( self, id=None, name=None, user=None ):
self.id = id
self.name = name or "Unnamed history"
@@ -410,7 +412,7 @@
db_session = object_session( self )
db_session.add( new_history )
db_session.flush()
-
+
# Copy annotation.
self.copy_item_annotation( db_session, self.user, self, target_user, new_history )
@@ -424,7 +426,7 @@
new_hda = hda.copy( copy_children=True )
new_history.add_dataset( new_hda, set_hid = False, quota=quota )
db_session.add( new_hda )
- db_session.flush()
+ db_session.flush()
# Copy annotation.
self.copy_item_annotation( db_session, self.user, hda, target_user, new_hda )
new_history.hid_counter = self.hid_counter
@@ -441,6 +443,23 @@
if isinstance(history_name, str):
history_name = unicode(history_name, 'utf-8')
return history_name
+
+ def get_api_value( self, view='collection', value_mapper = None ):
+ if value_mapper is None:
+ value_mapper = {}
+ rval = {}
+ try:
+ visible_keys = self.__getattribute__( 'api_' + view + '_visible_keys' )
+ except AttributeError:
+ raise Exception( 'Unknown API view: %s' % view )
+ for key in visible_keys:
+ try:
+ rval[key] = self.__getattribute__( key )
+ if key in value_mapper:
+ rval[key] = value_mapper.get( key )( rval[key] )
+ except AttributeError:
+ rval[key] = None
+ return rval
@property
def get_disk_size_bytes( self ):
return self.get_disk_size( nice_size=False )
@@ -633,7 +652,7 @@
file_name = property( get_file_name, set_file_name )
@property
def extra_files_path( self ):
- if self._extra_files_path:
+ if self._extra_files_path:
path = self._extra_files_path
else:
path = os.path.join( self.file_path, "dataset_%d_files" % self.id )
@@ -734,7 +753,7 @@
"""A base class for all 'dataset instances', HDAs, LDAs, etc"""
states = Dataset.states
permitted_actions = Dataset.permitted_actions
- def __init__( self, id=None, hid=None, name=None, info=None, blurb=None, peek=None, extension=None,
+ def __init__( self, id=None, hid=None, name=None, info=None, blurb=None, peek=None, extension=None,
dbkey=None, metadata=None, history=None, dataset=None, deleted=False, designation=None,
parent_id=None, validation_errors=None, visible=True, create_dataset=False, sa_session=None ):
self.name = name or "Unnamed dataset"
@@ -800,9 +819,9 @@
return dbkey[0]
def set_dbkey( self, value ):
if "dbkey" in self.datatype.metadata_spec:
- if not isinstance(value, list):
+ if not isinstance(value, list):
self.metadata.dbkey = [value]
- else:
+ else:
self.metadata.dbkey = value
dbkey = property( get_dbkey, set_dbkey )
def change_datatype( self, new_ext ):
@@ -879,22 +898,18 @@
# See if we can convert the dataset
if target_ext not in self.get_converter_types():
raise NoConverterException("Conversion from '%s' to '%s' not possible" % (self.extension, target_ext) )
-
deps = {}
# List of string of dependencies
try:
depends_list = trans.app.datatypes_registry.converter_deps[self.extension][target_ext]
except KeyError:
depends_list = []
-
# See if converted dataset already exists
converted_dataset = self.get_converted_files_by_type( target_ext )
if converted_dataset:
return converted_dataset
-
# Conversion is possible but hasn't been done yet, run converter.
# Check if we have dependencies
-
try:
for dependency in depends_list:
dep_dataset = self.get_converted_dataset(trans, dependency)
@@ -905,14 +920,12 @@
raise ConverterDependencyException("A dependency (%s) was in an error state." % dependency)
elif dep_dataset.state != trans.app.model.Job.states.OK:
# Pending
- return None
-
+ return None
deps[dependency] = dep_dataset
except NoConverterException:
raise NoConverterException("A dependency (%s) is missing a converter." % dependency)
except KeyError:
pass # No deps
-
assoc = ImplicitlyConvertedDatasetAssociation( parent=self, file_type=target_ext, metadata_safe=False )
new_dataset = self.datatype.convert_dataset( trans, self, target_ext, return_output=True, visible=False, deps=deps, set_output_history=False ).values()[0]
new_dataset.name = self.name
@@ -1115,6 +1128,28 @@
for child in self.children:
rval += child.get_disk_usage( user )
return rval
+ def get_api_value( self, view='collection' ):
+ # Since this class is a proxy to rather complex attributes we want to
+ # display in other objects, we can't use the simpler method used by
+ # other model classes.
+ hda = self
+ rval = dict( name = hda.name,
+ deleted = hda.deleted,
+ visible = hda.visible,
+ state = hda.state,
+ file_size = int( hda.get_size() ),
+ data_type = hda.ext,
+ genome_build = hda.dbkey,
+ misc_info = hda.info,
+ misc_blurb = hda.blurb )
+ for name, spec in hda.metadata.spec.items():
+ val = hda.metadata.get( name )
+ if isinstance( val, MetadataFile ):
+ val = val.file_name
+ elif isinstance( val, list ):
+ val = ', '.join( [str(v) for v in val] )
+ rval['metadata_' + name] = val
+ return rval
class HistoryDatasetAssociationDisplayAtAuthorization( object ):
def __init__( self, hda=None, user=None, site=None ):
@@ -1264,7 +1299,7 @@
name = unicode( name, 'utf-8' )
return name
def get_api_value( self, view='collection' ):
- rval = super( LibraryFolder, self ).get_api_value( vew=view )
+ rval = super( LibraryFolder, self ).get_api_value( view=view )
info_association, inherited = self.get_info_association()
if info_association:
if inherited:
@@ -1332,7 +1367,7 @@
for field in template.fields:
tmp_dict[field['label']] = content[field['name']]
template_data[template.name] = tmp_dict
-
+
rval = dict( name = ldda.name,
file_name = ldda.file_name,
uploaded_by = ldda.user.email,
@@ -1479,7 +1514,7 @@
return template_data
def templates_json( self ):
return simplejson.dumps( self.templates_dict() )
-
+
def get_display_name( self ):
"""
LibraryDatasetDatasetAssociation name can be either a string or a unicode object.
@@ -1588,7 +1623,7 @@
def set_disk_usage( self, bytes ):
self.disk_usage = bytes
total_disk_usage = property( get_disk_usage, set_disk_usage )
-
+
class GalaxySessionToHistoryAssociation( object ):
def __init__( self, galaxy_session, history ):
self.galaxy_session = galaxy_session
@@ -1599,7 +1634,7 @@
self.id = None
self.instance_id = None
self.state = None
-
+
class UCI( object ):
def __init__( self ):
self.id = None
@@ -1615,7 +1650,7 @@
self.state = None
self.public_dns = None
self.availability_zone = None
-
+
class CloudStore( object ):
def __init__( self ):
self.id = None
@@ -1623,14 +1658,14 @@
self.user = None
self.size = None
self.availability_zone = None
-
+
class CloudSnapshot( object ):
def __init__( self ):
self.id = None
self.user = None
self.store_id = None
self.snapshot_id = None
-
+
class CloudProvider( object ):
def __init__( self ):
self.id = None
@@ -1665,7 +1700,7 @@
self.has_cycles = None
self.has_errors = None
self.steps = []
-
+
class WorkflowStep( object ):
def __init__( self ):
self.id = None
@@ -1676,7 +1711,7 @@
self.position = None
self.input_connections = []
self.config = None
-
+
class WorkflowStepConnection( object ):
def __init__( self ):
self.output_step_id = None
@@ -1688,7 +1723,7 @@
def __init__( self, workflow_step, output_name):
self.workflow_step = workflow_step
self.output_name = output_name
-
+
class StoredWorkflowUserShareAssociation( object ):
def __init__( self ):
self.stored_workflow = None
@@ -1849,12 +1884,12 @@
class FormDefinitionCurrent( object ):
def __init__(self, form_definition=None):
self.latest_form = form_definition
-
+
class FormValues( object ):
def __init__(self, form_def=None, content=None):
self.form_definition = form_def
self.content = content
-
+
class Request( object, APIItem ):
states = Bunch( NEW = 'New',
SUBMITTED = 'In Progress',
@@ -1938,7 +1973,7 @@
for sample in self.samples:
if sample.bar_code:
samples.append( sample )
- return samples
+ return samples
def send_email_notification( self, trans, common_state, final_state=False ):
# Check if an email notification is configured to be sent when the samples
# are in this state
@@ -2001,13 +2036,13 @@
trans.sa_session.add( event )
trans.sa_session.flush()
return comments
-
+
class RequestEvent( object ):
def __init__(self, request=None, request_state=None, comment=''):
self.request = request
self.state = request_state
self.comment = comment
-
+
class ExternalService( object ):
data_transfer_protocol = Bunch( HTTP = 'http',
HTTPS = 'https',
@@ -2045,7 +2080,7 @@
self.data_transfer[ self.data_transfer_protocol.HTTP ] = http_configs
def populate_actions( self, trans, item, param_dict=None ):
return self.get_external_service_type( trans ).actions.populate( self, item, param_dict=param_dict )
-
+
class RequestType( object, APIItem ):
api_collection_visible_keys = ( 'id', 'name', 'desc' )
api_element_visible_keys = ( 'id', 'name', 'desc', 'request_form_id', 'sample_form_id' )
@@ -2120,18 +2155,18 @@
return template.get_widgets( trans.user, contents=info.content )
return template.get_widgets( trans.user )
return []
-
+
class RequestTypeExternalServiceAssociation( object ):
def __init__( self, request_type, external_service ):
self.request_type = request_type
self.external_service = external_service
-
+
class RequestTypePermissions( object ):
def __init__( self, action, request_type, role ):
self.action = action
self.request_type = request_type
self.role = role
-
+
class Sample( object, APIItem ):
# The following form_builder classes are supported by the Sample class.
supported_field_types = [ CheckboxField, SelectField, TextField, WorkflowField, WorkflowMappingField, HistoryField ]
@@ -2212,14 +2247,14 @@
def print_ticks( d ):
pass
error_msg = 'Error encountered in determining the file size of %s on the external_service.' % filepath
- if not scp_configs[ 'host' ] or not scp_configs[ 'user_name' ] or not scp_configs[ 'password' ]:
+ if not scp_configs['host'] or not scp_configs['user_name'] or not scp_configs['password']:
return error_msg
login_str = '%s@%s' % ( scp_configs['user_name'], scp_configs['host'] )
cmd = 'ssh %s "du -sh \'%s\'"' % ( login_str, filepath )
try:
output = pexpect.run( cmd,
- events={ '.ssword:*' : scp_configs['password'] + '\r\n',
- pexpect.TIMEOUT : print_ticks },
+ events={ '.ssword:*': scp_configs['password']+'\r\n',
+ pexpect.TIMEOUT:print_ticks},
timeout=10 )
except Exception, e:
return error_msg
@@ -2277,7 +2312,7 @@
self.sample = sample
self.state = sample_state
self.comment = comment
-
+
class SampleDataset( object ):
transfer_status = Bunch( NOT_STARTED = 'Not started',
IN_QUEUE = 'In queue',
@@ -2366,7 +2401,7 @@
self.user = None
self.title = None
self.content = None
-
+
class PageUserShareAssociation( object ):
def __init__( self ):
self.page = None
@@ -2383,7 +2418,7 @@
self.revisions = []
if self.latest_revision:
self.revisions.append( latest_revision )
-
+
def copy( self, user=None, title=None ):
"""
Provide copy of visualization with only its latest revision.
@@ -2394,12 +2429,12 @@
# user who owns the datasets may delete them, making them inaccessible
# for the current user.
# TODO: a deep copy option is needed.
-
+
if not user:
user = self.user
if not title:
title = self.title
-
+
copy_viz = Visualization( user=user, type=self.type, title=title, dbkey=self.dbkey )
copy_revision = self.latest_revision.copy( visualization=copy_viz )
copy_viz.latest_revision = copy_revision
@@ -2412,26 +2447,26 @@
self.title = title
self.dbkey = dbkey
self.config = config
-
+
def copy( self, visualization=None ):
"""
Returns a copy of this object.
"""
if not visualization:
visualization = self.visualization
-
+
return VisualizationRevision(
visualization=visualization,
title=self.title,
dbkey=self.dbkey,
config=self.config
)
-
+
class VisualizationUserShareAssociation( object ):
def __init__( self ):
self.visualization = None
self.user = None
-
+
class TransferJob( object ):
# These states are used both by the transfer manager's IPC and the object
# state in the database. Not all states are used by both.
@@ -2457,10 +2492,10 @@
self.type = type
self.parent_id = parent_id
self.name = name
-
+
def __str__ ( self ):
return "Tag(id=%s, type=%i, parent_id=%s, name=%s)" % ( self.id, self.type, self.parent_id, self.name )
-
+
class ItemTagAssociation ( object ):
def __init__( self, id=None, user=None, item_id=None, tag_id=None, user_tname=None, value=None ):
self.id = id
@@ -2470,13 +2505,13 @@
self.user_tname = user_tname
self.value = None
self.user_value = None
-
+
class HistoryTagAssociation ( ItemTagAssociation ):
pass
-
+
class DatasetTagAssociation ( ItemTagAssociation ):
pass
-
+
class HistoryDatasetAssociationTagAssociation ( ItemTagAssociation ):
pass
@@ -2485,13 +2520,13 @@
class WorkflowStepTagAssociation ( ItemTagAssociation ):
pass
-
+
class StoredWorkflowTagAssociation ( ItemTagAssociation ):
pass
-
+
class VisualizationTagAssociation ( ItemTagAssociation ):
pass
-
+
class ToolTagAssociation( ItemTagAssociation ):
def __init__( self, id=None, user=None, tool_id=None, tag_id=None, user_tname=None, value=None ):
self.id = id
@@ -2503,50 +2538,50 @@
self.user_value = None
# Item annotation classes.
-
+
class HistoryAnnotationAssociation( object ):
pass
-
+
class HistoryDatasetAssociationAnnotationAssociation( object ):
pass
-
+
class StoredWorkflowAnnotationAssociation( object ):
pass
-
+
class WorkflowStepAnnotationAssociation( object ):
pass
-
+
class PageAnnotationAssociation( object ):
pass
-
+
class VisualizationAnnotationAssociation( object ):
pass
-
+
# Item rating classes.
-
+
class ItemRatingAssociation( object ):
def __init__( self, id=None, user=None, item=None, rating=0 ):
self.id = id
self.user = user
self.item = item
self.rating = rating
-
+
def set_item( self, item ):
""" Set association's item. """
pass
-
+
class HistoryRatingAssociation( ItemRatingAssociation ):
def set_item( self, history ):
self.history = history
-
+
class HistoryDatasetAssociationRatingAssociation( ItemRatingAssociation ):
def set_item( self, history_dataset_association ):
self.history_dataset_association = history_dataset_association
-
+
class StoredWorkflowRatingAssociation( ItemRatingAssociation ):
def set_item( self, stored_workflow ):
self.stored_workflow = stored_workflow
-
+
class PageRatingAssociation( ItemRatingAssociation ):
def set_item( self, page ):
self.page = page
@@ -2554,12 +2589,12 @@
class VisualizationRatingAssociation( ItemRatingAssociation ):
def set_item( self, visualization ):
self.visualization = visualization
-
+
class UserPreference ( object ):
def __init__( self, name=None, value=None ):
self.name = name
self.value = value
-
+
class UserAction( object ):
def __init__( self, id=None, create_time=None, user_id=None, session_id=None, action=None, params=None, context=None):
self.id = id
--- a/lib/galaxy/web/api/contents.py Tue Aug 16 12:02:34 2011 -0400
+++ b/lib/galaxy/web/api/contents.py Tue Aug 16 12:33:35 2011 -0400
@@ -11,7 +11,7 @@
log = logging.getLogger( __name__ )
class ContentsController( BaseController ):
-
+
@web.expose_api
def index( self, trans, library_id, **kwd ):
"""
@@ -55,14 +55,14 @@
rval.append( dict( id = encoded_id,
type = 'folder',
name = '/',
- url = url_for( 'content', library_id=library_id, id=encoded_id ) ) )
+ url = url_for( 'library_content', library_id=library_id, id=encoded_id ) ) )
library.root_folder.api_path = ''
for content in traverse( library.root_folder ):
encoded_id = trans.security.encode_id( '%s.%s' % ( content.api_type, content.id ) )
rval.append( dict( id = encoded_id,
type = content.api_type,
name = content.api_path,
- url = url_for( 'content', library_id=library_id, id=encoded_id, ) ) )
+ url = url_for( 'library_content', library_id=library_id, id=encoded_id, ) ) )
return rval
@web.expose_api
@@ -150,5 +150,5 @@
encoded_id = trans.security.encode_id( create_type + '.' + str( v.id ) )
rval.append( dict( id = encoded_id,
name = v.name,
- url = url_for( 'content', library_id=library_id, id=encoded_id ) ) )
+ url = url_for( 'library_content', library_id=library_id, id=encoded_id ) ) )
return rval
--- a/lib/galaxy/web/api/libraries.py Tue Aug 16 12:02:34 2011 -0400
+++ b/lib/galaxy/web/api/libraries.py Tue Aug 16 12:33:35 2011 -0400
@@ -58,7 +58,8 @@
trans.response.status = 400
return "Invalid library id ( %s ) specified." % str( library_id )
item = library.get_api_value( view='element' )
- item['contents_url'] = url_for( 'contents', library_id=library_id )
+ #item['contents_url'] = url_for( 'contents', library_id=library_id )
+ item['contents_url'] = url_for( 'library_contents', library_id=library_id )
return item
@web.expose_api
--- a/lib/galaxy/web/buildapp.py Tue Aug 16 12:02:34 2011 -0400
+++ b/lib/galaxy/web/buildapp.py Tue Aug 16 12:33:35 2011 -0400
@@ -106,10 +106,18 @@
# If enabled, add the web API
if asbool( kwargs.get( 'enable_api', False ) ):
add_api_controllers( webapp, app )
- webapp.api_mapper.resource( 'content',
- 'contents',
+ webapp.api_mapper.resource( 'content',
+ 'contents',
+ controller='contents',
+ name_prefix='library_',
path_prefix='/api/libraries/:library_id',
parent_resources=dict( member_name='library', collection_name='libraries' ) )
+ webapp.api_mapper.resource( 'content',
+ 'contents',
+ controller='history_contents',
+ name_prefix='history_',
+ path_prefix='/api/histories/:history_id',
+ parent_resources=dict( member_name='history', collection_name='histories' ) )
webapp.api_mapper.resource( 'library', 'libraries', path_prefix='/api' )
webapp.api_mapper.resource( 'sample', 'samples', path_prefix='/api' )
webapp.api_mapper.resource( 'request', 'requests', path_prefix='/api' )
@@ -118,7 +126,9 @@
webapp.api_mapper.resource( 'role', 'roles', path_prefix='/api' )
webapp.api_mapper.resource( 'user', 'users', path_prefix='/api' )
webapp.api_mapper.resource( 'workflow', 'workflows', path_prefix='/api' )
-
+ webapp.api_mapper.resource( 'history', 'histories', path_prefix='/api' )
+ #webapp.api_mapper.connect( 'run_workflow', '/api/workflow/{workflow_id}/library/{library_id}', controller='workflows', action='run', workflow_id=None, library_id=None, conditions=dict(method=["GET"]) )
+
webapp.finalize_config()
# Wrap the webapp in some useful middleware
if kwargs.get( 'middleware', True ):
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.
1
0
commit/galaxy-central: natefoo: Make nice_size able to display terabytes, and set a default cutoff for users in the user disk usage reports.
by Bitbucket 16 Aug '11
by Bitbucket 16 Aug '11
16 Aug '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/1aaa9f0338fb/
changeset: 1aaa9f0338fb
user: natefoo
date: 2011-08-16 18:02:34
summary: Make nice_size able to display terabytes, and set a default cutoff for users in the user disk usage reports.
affected #: 2 files (7 bytes)
--- a/lib/galaxy/util/__init__.py Tue Aug 16 10:40:10 2011 -0400
+++ b/lib/galaxy/util/__init__.py Tue Aug 16 12:02:34 2011 -0400
@@ -528,7 +528,7 @@
>>> nice_size(100000000)
'95.4 Mb'
"""
- words = [ 'bytes', 'Kb', 'Mb', 'Gb' ]
+ words = [ 'bytes', 'Kb', 'Mb', 'Gb', 'Tb' ]
try:
size = float( size )
except:
--- a/lib/galaxy/webapps/reports/controllers/users.py Tue Aug 16 10:40:10 2011 -0400
+++ b/lib/galaxy/webapps/reports/controllers/users.py Tue Aug 16 12:02:34 2011 -0400
@@ -120,7 +120,7 @@
@web.expose
def user_disk_usage( self, trans, **kwd ):
message = util.restore_text( kwd.get( 'message', '' ) )
- user_cutoff = int( kwd.get( 'user_cutoff', 0 ) )
+ user_cutoff = int( kwd.get( 'user_cutoff', 60 ) )
# disk_usage isn't indexed
users = sorted( trans.sa_session.query( galaxy.model.User ).all(), key=operator.attrgetter( 'disk_usage' ), reverse=True )
if user_cutoff:
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.
1
0
16 Aug '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/0d6106a6941f/
changeset: 0d6106a6941f
user: natefoo
date: 2011-08-16 16:40:10
summary: Reports: Add a per-user disk usage report.
affected #: 3 files (827 bytes)
--- a/lib/galaxy/webapps/reports/controllers/users.py Mon Aug 15 16:12:12 2011 -0400
+++ b/lib/galaxy/webapps/reports/controllers/users.py Tue Aug 16 10:40:10 2011 -0400
@@ -116,3 +116,16 @@
users=users,
not_logged_in_for_days=not_logged_in_for_days,
message=message )
+
+ @web.expose
+ def user_disk_usage( self, trans, **kwd ):
+ message = util.restore_text( kwd.get( 'message', '' ) )
+ user_cutoff = int( kwd.get( 'user_cutoff', 0 ) )
+ # disk_usage isn't indexed
+ users = sorted( trans.sa_session.query( galaxy.model.User ).all(), key=operator.attrgetter( 'disk_usage' ), reverse=True )
+ if user_cutoff:
+ users = users[:user_cutoff]
+ return trans.fill_template( '/webapps/reports/users_user_disk_usage.mako',
+ users=users,
+ user_cutoff=user_cutoff,
+ message=message )
--- a/templates/webapps/reports/index.mako Mon Aug 15 16:12:12 2011 -0400
+++ b/templates/webapps/reports/index.mako Tue Aug 16 10:40:10 2011 -0400
@@ -87,6 +87,7 @@
<div class="toolSectionBg"><div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='users', action='registered_users' )}">Registered users</a></div><div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='users', action='last_access_date' )}">Date of last login</a></div>
+ <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='users', action='user_disk_usage' )}">User disk usage</a></div></div></div><div class="toolSectionPad"></div>
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.
1
0
commit/galaxy-central: greg: Add the ability for a tool shed admin to browse repository metadata, and implement fixes for setting repository metadata for repositories with multiple tools.
by Bitbucket 15 Aug '11
by Bitbucket 15 Aug '11
15 Aug '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/824c59db3c3a/
changeset: 824c59db3c3a
user: greg
date: 2011-08-15 22:12:12
summary: Add the ability for a tool shed admin to browse repository metadata, and implement fixes for setting repository metadata for repositories with multiple tools.
affected #: 4 files (5.8 KB)
--- a/lib/galaxy/webapps/community/controllers/admin.py Mon Aug 15 13:28:40 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/admin.py Mon Aug 15 16:12:12 2011 -0400
@@ -3,7 +3,7 @@
from galaxy.model.orm import *
from galaxy.web.framework.helpers import time_ago, iff, grids
from galaxy.util import inflector
-from common import get_category, get_repository
+from common import get_category, get_repository, get_repository_metadata_by_id
from repository import RepositoryListGrid, CategoryListGrid
import logging
log = logging.getLogger( __name__ )
@@ -308,6 +308,65 @@
async_compatible=False ) )
standard_filters = []
+class RepositoryMetadataListGrid( grids.Grid ):
+ class IdColumn( grids.IntegerColumn ):
+ def get_value( self, trans, grid, repository_metadata ):
+ return repository_metadata.id
+ class RepositoryIdColumn( grids.IntegerColumn ):
+ def get_value( self, trans, grid, repository_metadata ):
+ return repository_metadata.repository_id
+ class ChangesetRevisionColumn( grids.TextColumn ):
+ def get_value( self, trans, grid, repository_metadata ):
+ return repository_metadata.changeset_revision
+ class MetadataColumn( grids.TextColumn ):
+ def get_value( self, trans, grid, repository_metadata ):
+ metadata_str = ''
+ if repository_metadata:
+ metadata = repository_metadata.metadata
+ if metadata:
+ if 'tools' in metadata:
+ metadata_str += '<b>Tools:</b><br/>'
+ for tool_metadata_dict in metadata[ 'tools' ]:
+ metadata_str += '%s <b>%s</b><br/>' % \
+ ( tool_metadata_dict[ 'id' ], tool_metadata_dict[ 'version' ] )
+ if 'workflows' in metadata:
+ metadata_str += '<b>Workflows:</b><br/>'
+ for workflow_metadata_dict in metadata[ 'workflows' ]:
+ metadata_str += '%s <b>%s</b><br/>' % \
+ ( workflow_metadata_dict[ 'name' ], workflow_metadata_dict[ 'format-version' ] )
+ return metadata_str
+ class MaliciousColumn( grids.BooleanColumn ):
+ def get_value( self, trans, grid, repository_metadata ):
+ return repository_metadata.malicious
+ # Grid definition
+ title = "Repository Metadata"
+ model_class = model.RepositoryMetadata
+ template='/webapps/community/repository/grid.mako'
+ default_sort_key = "repository_id"
+ columns = [
+ IdColumn( "Id",
+ visible=False,
+ attach_popup=False ),
+ RepositoryIdColumn( "Repository Id",
+ key="repository_id",
+ attach_popup=False ),
+ ChangesetRevisionColumn( "Revision",
+ attach_popup=False ),
+ MetadataColumn( "Metadata",
+ attach_popup=False ),
+ MaliciousColumn( "Malicious",
+ attach_popup=False )
+ ]
+ operations = [ grids.GridOperation( "Delete",
+ allow_multiple=True ) ]
+ standard_filters = []
+ default_filter = {}
+ num_rows_per_page = 50
+ preserve_state = False
+ use_paging = True
+ def build_initial_query( self, trans, **kwd ):
+ return trans.sa_session.query( self.model_class )
+
class AdminController( BaseController, Admin ):
user_list_grid = UserListGrid()
@@ -315,9 +374,44 @@
group_list_grid = GroupListGrid()
manage_category_list_grid = ManageCategoryListGrid()
repository_list_grid = AdminRepositoryListGrid()
+ repository_metadata_list_grid = RepositoryMetadataListGrid()
@web.expose
@web.require_admin
+ def browse_repository_metadata( self, trans, **kwd ):
+ if 'operation' in kwd:
+ operation = kwd[ 'operation' ].lower()
+ if operation == "delete":
+ return self.delete_repository_metadata( trans, **kwd )
+ # Render the list view
+ return self.repository_metadata_list_grid( trans, **kwd )
+ @web.expose
+ @web.require_admin
+ def delete_repository_metadata( self, trans, **kwd ):
+ # TODO: Add a javascript confirm before this method executes....
+ params = util.Params( kwd )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
+ id = kwd.get( 'id', None )
+ if id:
+ ids = util.listify( id )
+ count = 0
+ for repository_metadata_id in ids:
+ repository_metadata = get_repository_metadata_by_id( trans, repository_metadata_id )
+ trans.sa_session.delete( repository_metadata )
+ trans.sa_session.flush()
+ count += 1
+ if count:
+ message = "Deleted %d repository metadata %s" % ( count, inflector.cond_plural( len( ids ), "record" ) )
+ else:
+ message = "No repository metadata ids received for deleting."
+ status = 'error'
+ trans.response.send_redirect( web.url_for( controller='admin',
+ action='browse_repository_metadata',
+ message=util.sanitize_text( message ),
+ status=status ) )
+ @web.expose
+ @web.require_admin
def browse_repositories( self, trans, **kwd ):
# We add params to the keyword dict in this method in order to rename the param
# with an "f-" prefix, simulating filtering by clicking a search link. We have
--- a/lib/galaxy/webapps/community/controllers/common.py Mon Aug 15 13:28:40 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/common.py Mon Aug 15 16:12:12 2011 -0400
@@ -78,52 +78,54 @@
.filter( and_( trans.model.RepositoryMetadata.table.c.repository_id == trans.security.decode_id( id ),
trans.model.RepositoryMetadata.table.c.changeset_revision == changeset_revision ) ) \
.first()
+def get_repository_metadata_by_id( trans, id ):
+ """Get repository metadata from the database"""
+ return trans.sa_session.query( trans.model.RepositoryMetadata ).get( trans.security.decode_id( id ) )
def get_latest_repository_metadata( trans, id ):
"""Get last metadata defined for a specified repository from the database"""
return trans.sa_session.query( trans.model.RepositoryMetadata ) \
.filter( trans.model.RepositoryMetadata.table.c.repository_id == trans.security.decode_id( id ) ) \
.order_by( trans.model.RepositoryMetadata.table.c.update_time.desc() ) \
.first()
-def set_workflowl_metadata( trans, id, change_set_revision, exported_workflow_dict, metadata_dict ):
- # We'll store everything except the workflow steps in the database.
- flush_needed = False
+def generate_workflow_metadata( trans, id, change_set_revision, exported_workflow_dict, metadata_dict ):
+ """
+ Update the received metadata_dict with changes that have been applied
+ to the received exported_workflow_dict. Store everything except the
+ workflow steps in the database.
+ """
workflow_dict = { 'a_galaxy_workflow' : exported_workflow_dict[ 'a_galaxy_workflow' ],
'name' :exported_workflow_dict[ 'name' ],
'annotation' : exported_workflow_dict[ 'annotation' ],
'format-version' : exported_workflow_dict[ 'format-version' ] }
- repository_metadata = get_latest_repository_metadata( trans, id )
- if repository_metadata:
- metadata = repository_metadata.metadata
- if metadata and 'workflows' in metadata:
- metadata_workflows = metadata[ 'workflows' ]
- found = False
- for workflow_metadata_dict in metadata_workflows:
- if 'a_galaxy_workflow' in workflow_metadata_dict and util.string_as_bool( workflow_metadata_dict[ 'a_galaxy_workflow' ] ) and \
- 'name' in workflow_metadata_dict and workflow_metadata_dict[ 'name' ] == exported_workflow_dict[ 'name' ] and \
- 'annotation' in workflow_metadata_dict and workflow_metadata_dict[ 'annotation' ] == exported_workflow_dict[ 'annotation' ] and \
- 'format-version' in workflow_metadata_dict and workflow_metadata_dict[ 'format-version' ] == exported_workflow_dict[ 'format-version' ]:
- found = True
- break
- if not found:
- metadata_workflows.append( workflow_dict )
+ if 'workflows' in metadata_dict:
+ metadata_dict[ 'workflows' ].append( workflow_dict )
+ else:
+ metadata_dict[ 'workflows' ] = [ workflow_dict ]
+ return metadata_dict
+def new_workflow_metadata_required( trans, id, metadata_dict ):
+ """
+ TODO: Currently everything about an exported workflow except the name is hard-coded, so
+ there's no real way to differentiate versions of exported workflows. If this changes at
+ some future time, this method should be enhanced accordingly...
+ """
+ if 'workflows' in metadata_dict:
+ repository_metadata = get_latest_repository_metadata( trans, id )
+ if repository_metadata:
+ if repository_metadata.metadata:
+ # The repository has metadata, so update the workflows value - no new record is needed.
+ return False
else:
- if metadata is None:
- repository_metadata.metadata = {}
- repository_metadata.metadata[ 'workflows' ] = workflow_dict
- repository_metadata.changeset_revision = change_set_revision
- trans.sa_session.add( repository_metadata )
- if not flush_needed:
- flush_needed = True
- else:
- if 'workflows' in metadata_dict:
- metadata_dict[ 'workflows' ].append( workflow_dict )
- else:
- metadata_dict[ 'workflows' ] = [ workflow_dict ]
- return flush_needed, metadata_dict
-
-def set_tool_metadata( trans, id, change_set_revision, root, name, tool, metadata_dict ):
+ # There is no saved repository metadata, so we need to create a new repository_metadata table record.
+ return True
+ # The received metadata_dict includes no metadata for workflows, so a new repository_metadata table
+ # record is not needed.
+ return False
+def generate_tool_metadata( trans, id, change_set_revision, root, name, tool, metadata_dict ):
+ """
+ Update the received metadata_dict with changes that have been
+ applied to the received tool.
+ """
tool_requirements = []
- flush_needed = False
for tr in tool.requirements:
requirement_dict = dict( name=tr.name,
type=tr.type,
@@ -145,54 +147,42 @@
tool_config=os.path.join( root, name ),
requirements=tool_requirements,
tests=tool_tests )
- repository_metadata = get_latest_repository_metadata( trans, id )
- if repository_metadata:
- # We have the last RepositoryMetadata record generated for this repository.
- metadata = repository_metadata.metadata
- if metadata and 'tools' in metadata:
- # The metadata for 1 or more tools was successfully generated in the past for this repository..
- metadata_tools = metadata[ 'tools' ]
- found = False
- for tool_metadata_dict in metadata_tools:
- if 'id' in tool_metadata_dict and tool_metadata_dict[ 'id' ] == tool.id and \
- 'version' in tool_metadata_dict and tool_metadata_dict[ 'version' ] == tool.version:
- # We've found a record for the current tool id and version, so we'll
- # update the metadata associated with the record.
- found = True
- tool_metadata_dict[ 'name' ] = tool.name
- tool_metadata_dict[ 'description' ] = tool.description
- tool_metadata_dict[ 'version_string_cmd' ] = tool.version_string_cmd
- tool_metadata_dict[ 'tool_config' ] = os.path.join( root, name )
- tool_metadata_dict[ 'requirements' ] = tool_requirements
- tool_metadata_dict[ 'tests' ] = tool_tests
- if not flush_needed:
- flush_needed = True
- if found:
- repository_metadata.changeset_revision = change_set_revision
+ if 'tools' in metadata_dict:
+ metadata_dict[ 'tools' ].append( tool_dict )
+ else:
+ metadata_dict[ 'tools' ] = [ tool_dict ]
+ return metadata_dict
+def new_tool_metadata_required( trans, id, metadata_dict ):
+ """
+ Compare the last saved metadata for each tool in the repository with the new metadata
+ in metadata_dict to determine if a new repository_metadata table record is required, or
+ if the last saved metadata record can updated instead.
+ """
+ if 'tools' in metadata_dict:
+ repository_metadata = get_latest_repository_metadata( trans, id )
+ if repository_metadata:
+ metadata = repository_metadata.metadata
+ if metadata and 'tools' in metadata:
+ # The metadata for one or more tools was successfully generated in the past
+ # for this repository, so we compare the version string for each tool id
+ # in metadata_dict with what was previously saved to see if we need to create
+ # a new table record or if we can simply update the existing record.
+ for new_tool_metadata_dict in metadata_dict[ 'tools' ]:
+ for saved_tool_metadata_dict in metadata[ 'tools' ]:
+ if new_tool_metadata_dict[ 'id' ] == saved_tool_metadata_dict[ 'id' ]:
+ if new_tool_metadata_dict[ 'version' ] != saved_tool_metadata_dict[ 'version' ]:
+ return True
else:
- if 'tools' in metadata_dict:
- metadata_dict[ 'tools' ].append( tool_dict )
- else:
- metadata_dict[ 'tools' ] = [ tool_dict ]
- if not flush_needed:
- flush_needed = True
- if not flush_needed:
- flush_needed = True
+ # We have repository metadata that does not include metadata for any tools in the
+ # repository, so we can update the existing repository metadata.
+ return False
else:
- # Either the metadata is Null, or it does not include the key 'tools'.
- if metadata is None:
- repository_metadata.metadata = {}
- repository_metadata.metadata[ 'tools' ] = [ tool_dict ]
- repository_metadata.changeset_revision = change_set_revision
- trans.sa_session.add( repository_metadata )
- if not flush_needed:
- flush_needed = True
- else:
- if 'tools' in metadata_dict:
- metadata_dict[ 'tools' ].append( tool_dict )
- else:
- metadata_dict[ 'tools' ] = [ tool_dict ]
- return flush_needed, metadata_dict
+ # There is no saved repository metadata, so we need to create a new repository_metadata
+ # table record.
+ return True
+ # The received metadata_dict includes no metadata for tools, so a new repository_metadata table
+ # record is not needed.
+ return False
def set_repository_metadata( trans, id, change_set_revision, **kwd ):
"""Set repository metadata"""
message = ''
@@ -202,7 +192,6 @@
repo = hg.repository( get_configured_ui(), repo_dir )
change_set = get_change_set( trans, repo, change_set_revision )
invalid_files = []
- flush_needed = False
if change_set is not None:
metadata_dict = {}
for root, dirs, files in os.walk( repo_dir ):
@@ -221,7 +210,8 @@
full_path = os.path.abspath( os.path.join( root, name ) )
tool = load_tool( trans, full_path )
if tool is not None:
- flush_needed, metadata_dict = set_tool_metadata( trans, id, change_set_revision, root, name, tool, metadata_dict )
+ # Update the list metadata dictionaries for tools in metadata_dict.
+ metadata_dict = generate_tool_metadata( trans, id, change_set_revision, root, name, tool, metadata_dict )
except Exception, e:
invalid_files.append( ( name, str( e ) ) )
# Find all exported workflows
@@ -233,16 +223,22 @@
workflow_text = fp.read()
fp.close()
exported_workflow_dict = from_json_string( workflow_text )
- flush_needed, metadata_dict = set_workflowl_metadata( trans, id, change_set_revision, exported_workflow_dict, metadata_dict )
+ # Update the list of metadata dictionaries for workflows in metadata_dict.
+ metadata_dict = generate_workflow_metadata( trans, id, change_set_revision, exported_workflow_dict, metadata_dict )
except Exception, e:
invalid_files.append( ( name, str( e ) ) )
if metadata_dict:
- # The metadata_dict dictionary will contain items only
- # if the repository did not already have metadata set.
- repository_metadata = trans.model.RepositoryMetadata( repository.id, change_set_revision, metadata_dict )
- trans.sa_session.add( repository_metadata )
- if not flush_needed:
- flush_needed = True
+ if new_tool_metadata_required( trans, id, metadata_dict ) or new_workflow_metadata_required( trans, id, metadata_dict ):
+ # Create a new repository_metadata table row.
+ repository_metadata = trans.model.RepositoryMetadata( repository.id, change_set_revision, metadata_dict )
+ trans.sa_session.add( repository_metadata )
+ trans.sa_session.flush()
+ else:
+ # Update the last saved repository_metadata table row.
+ repository_metadata = get_latest_repository_metadata( trans, id )
+ repository_metadata.metadata = metadata_dict
+ trans.sa_session.add( repository_metadata )
+ trans.sa_session.flush()
else:
# change_set is None
message = "Repository does not include changeset revision '%s'." % str( change_set_revision )
@@ -284,10 +280,6 @@
correction_msg = exception_msg
message += "<b>%s</b> - %s<br/>" % ( tool_file, correction_msg )
status = 'error'
- elif flush_needed:
- # We only flush if there are no tool config errors, so change sets will only have metadata
- # if everything in them is valid.
- trans.sa_session.flush()
return message, status
def get_repository_by_name( trans, name ):
"""Get a repository from the database via name"""
--- a/templates/webapps/community/admin/index.mako Mon Aug 15 13:28:40 2011 -0400
+++ b/templates/webapps/community/admin/index.mako Mon Aug 15 16:12:12 2011 -0400
@@ -43,14 +43,30 @@
<div class="page-container" style="padding: 10px;"><div class="toolMenu"><div class="toolSectionList">
- <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_categories', webapp='community' )}">Browse by category</a></div>
- <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='admin', action='browse_repositories', webapp='community' )}">Browse all repositories</a></div>
+ <div class="toolSectionTitle">
+ Repositories
+ </div>
+ <div class="toolSectionBody">
+ <div class="toolSectionBg">
+ <div class="toolTitle">
+ <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_categories', webapp='community' )}">Browse by category</a>
+ </div>
+ <div class="toolTitle">
+ <a target="galaxy_main" href="${h.url_for( controller='admin', action='browse_repositories', webapp='community' )}">Browse all repositories</a>
+ </div>
+ <div class="toolTitle">
+ <a target="galaxy_main" href="${h.url_for( controller='admin', action='browse_repository_metadata', webapp='community' )}">Browse metadata</a>
+ </div>
+ </div>
+ </div><div class="toolSectionTitle">
Categories
</div><div class="toolSectionBody"><div class="toolSectionBg">
- <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='admin', action='manage_categories', webapp='community' )}">Manage categories</a></div>
+ <div class="toolTitle">
+ <a target="galaxy_main" href="${h.url_for( controller='admin', action='manage_categories', webapp='community' )}">Manage categories</a>
+ </div></div></div><div class="toolSectionPad"></div>
@@ -59,9 +75,15 @@
</div><div class="toolSectionBody"><div class="toolSectionBg">
- <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='admin', action='users', webapp='community' )}">Manage users</a></div>
- <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='admin', action='groups', webapp='community' )}">Manage groups</a></div>
- <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='admin', action='roles', webapp='community' )}">Manage roles</a></div>
+ <div class="toolTitle">
+ <a target="galaxy_main" href="${h.url_for( controller='admin', action='users', webapp='community' )}">Manage users</a>
+ </div>
+ <div class="toolTitle">
+ <a target="galaxy_main" href="${h.url_for( controller='admin', action='groups', webapp='community' )}">Manage groups</a>
+ </div>
+ <div class="toolTitle">
+ <a target="galaxy_main" href="${h.url_for( controller='admin', action='roles', webapp='community' )}">Manage roles</a>
+ </div></div></div></div>
--- a/templates/webapps/community/index.mako Mon Aug 15 13:28:40 2011 -0400
+++ b/templates/webapps/community/index.mako Mon Aug 15 16:12:12 2011 -0400
@@ -45,13 +45,21 @@
<div class="toolMenu"><div class="toolSectionList"><div class="toolSectionPad"></div>
- <div class="toolSectionTitle">Repositories</div>
+ <div class="toolSectionTitle">
+ Repositories
+ </div><div class="toolSectionBody"><div class="toolSectionBg">
- <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_categories', webapp='community' )}">Browse by category</a></div>
- <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_repositories', webapp='community' )}">Browse all repositories</a></div>
+ <div class="toolTitle">
+ <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_categories', webapp='community' )}">Browse by category</a>
+ </div>
+ <div class="toolTitle">
+ <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_repositories', webapp='community' )}">Browse all repositories</a>
+ </div>
%if trans.user:
- <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_repositories', operation='my_repositories', webapp='community' )}">Browse my repositories</a></div>
+ <div class="toolTitle">
+ <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_repositories', operation='my_repositories', webapp='community' )}">Browse my repositories</a>
+ </div>
%endif
</div></div>
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.
1
0