3 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/80a640cc37c3/ Changeset: 80a640cc37c3 User: dannon Date: 2015-02-22 16:43:09+00:00 Summary: Clean up imports in workflow controller. Affected #: 1 file diff -r 37494bde7c95a6718d6be5313a2f7949cacb71c2 -r 80a640cc37c3b0821fcb5d4e22cfcec405db0db5 lib/galaxy/webapps/galaxy/controllers/workflow.py --- a/lib/galaxy/webapps/galaxy/controllers/workflow.py +++ b/lib/galaxy/webapps/galaxy/controllers/workflow.py @@ -4,42 +4,31 @@ import os import sgmllib import urllib2 -import copy from sqlalchemy import and_ + from tool_shed.util import common_util from tool_shed.util import encoding_util from galaxy import model from galaxy import util from galaxy import web -from galaxy.datatypes.data import Data +from galaxy.managers import workflows from galaxy.model.item_attrs import UsesItemRatings from galaxy.model.mapping import desc -from galaxy.tools.parameters.basic import DataToolParameter -from galaxy.tools.parameters.basic import DataCollectionToolParameter -from galaxy.tools.parameters import visit_input_values from galaxy.util.sanitize_html import sanitize_html from galaxy.web import error, url_for from galaxy.web.base.controller import BaseUIController, SharableMixin, UsesStoredWorkflowMixin from galaxy.web.framework.formbuilder import form -from galaxy.web.framework.helpers import grids, time_ago, to_unicode, escape -from galaxy.managers import workflows +from galaxy.web.framework.helpers import escape, grids, time_ago, to_unicode +from galaxy.workflow.extract import extract_workflow +from galaxy.workflow.extract import summarize +from galaxy.workflow.modules import MissingToolException +from galaxy.workflow.modules import module_factory from galaxy.workflow.modules import WorkflowModuleInjector -from galaxy.workflow.modules import MissingToolException -from galaxy.workflow.modules import module_factory, is_tool_module_type +from galaxy.workflow.render import WorkflowCanvas from galaxy.workflow.run import invoke from galaxy.workflow.run import WorkflowRunConfig -from galaxy.workflow.extract import summarize -from galaxy.workflow.extract import extract_workflow -from galaxy.workflow.steps import ( - attach_ordered_steps, - order_workflow_steps, - edgelist_for_workflow_steps, - order_workflow_steps_with_levels, -) -from galaxy.workflow.render import WorkflowCanvas, MARGIN, LINE_SPACING -from markupsafe import escape class StoredWorkflowListGrid( grids.Grid ): https://bitbucket.org/galaxy/galaxy-central/commits/8d3323ccb3f8/ Changeset: 8d3323ccb3f8 User: dannon Date: 2015-02-23 14:36:10+00:00 Summary: Cleanup, pep8 in workflow controller. Affected #: 1 file diff -r 80a640cc37c3b0821fcb5d4e22cfcec405db0db5 -r 8d3323ccb3f89ca949ab443b2ea37b8992a4f509 lib/galaxy/webapps/galaxy/controllers/workflow.py --- a/lib/galaxy/webapps/galaxy/controllers/workflow.py +++ b/lib/galaxy/webapps/galaxy/controllers/workflow.py @@ -45,7 +45,11 @@ default_sort_key = "-update_time" columns = [ grids.TextColumn( "Name", key="name", attach_popup=True, filterable="advanced" ), - grids.IndividualTagsColumn( "Tags", "tags", model_tag_association_class=model.StoredWorkflowTagAssociation, filterable="advanced", grid_name="StoredWorkflowListGrid" ), + grids.IndividualTagsColumn( "Tags", + "tags", + model_tag_association_class=model.StoredWorkflowTagAssociation, + filterable="advanced", + grid_name="StoredWorkflowListGrid" ), StepsColumn( "Steps" ), grids.GridColumn( "Created", key="create_time", format=time_ago ), grids.GridColumn( "Last Updated", key="update_time", format=time_ago ), @@ -78,10 +82,15 @@ use_async = True columns = [ grids.PublicURLColumn( "Name", key="name", filterable="advanced", attach_popup=True ), - grids.OwnerAnnotationColumn( "Annotation", key="annotation", model_annotation_association_class=model.StoredWorkflowAnnotationAssociation, filterable="advanced" ), + grids.OwnerAnnotationColumn( "Annotation", + key="annotation", + model_annotation_association_class=model.StoredWorkflowAnnotationAssociation, + filterable="advanced" ), grids.OwnerColumn( "Owner", key="username", model_class=model.User, filterable="advanced" ), grids.CommunityRatingColumn( "Community Rating", key="rating" ), - grids.CommunityTagsColumn( "Community Tags", key="tags", model_tag_association_class=model.StoredWorkflowTagAssociation, filterable="advanced", grid_name="PublicWorkflowListGrid" ), + grids.CommunityTagsColumn( "Community Tags", key="tags", + model_tag_association_class=model.StoredWorkflowTagAssociation, + filterable="advanced", grid_name="PublicWorkflowListGrid" ), grids.ReverseSortColumn( "Last Updated", key="update_time", format=time_ago ) ] columns.append( @@ -406,16 +415,14 @@ stored.name = san_new_name stored.latest_workflow.name = san_new_name trans.sa_session.flush() - # For current workflows grid: trans.set_message( "Workflow renamed to '%s'." % san_new_name ) return self.list( trans ) - # For new workflows grid: - #message = "Workflow renamed to '%s'." % new_name - #return self.list_grid( trans, message=message, status='done' ) else: return form( url_for(controller='workflow', action='rename', id=trans.security.encode_id(stored.id) ), - "Rename workflow", submit_text="Rename", use_panels=True ) \ - .add_text( "new_name", "Workflow Name", value=to_unicode( stored.name ) ) + "Rename workflow", + submit_text="Rename", + use_panels=True + ).add_text( "new_name", "Workflow Name", value=to_unicode( stored.name ) ) @web.expose @web.require_login( "use Galaxy workflows" ) @@ -486,7 +493,11 @@ """ Returns workflow's name and link. """ stored = self.get_stored_workflow( trans, id ) - return_dict = { "name": stored.name, "link": url_for(controller='workflow', action="display_by_username_and_slug", username=stored.user.username, slug=stored.slug ) } + return_dict = { "name": stored.name, + "link": url_for(controller='workflow', + action="display_by_username_and_slug", + username=stored.user.username, + slug=stored.slug ) } return return_dict @web.expose @@ -559,7 +570,10 @@ else: return form( url_for(controller="workflow", action="create"), "Create New Workflow", submit_text="Create", use_panels=True ) \ .add_text( "workflow_name", "Workflow Name", value="Unnamed workflow" ) \ - .add_text( "workflow_annotation", "Workflow Annotation", value="", help="A description of the workflow; annotation is shown alongside shared or published workflows." ) + .add_text( "workflow_annotation", + "Workflow Annotation", + value="", + help="A description of the workflow; annotation is shown alongside shared or published workflows." ) @web.expose def delete( self, trans, id=None ): @@ -605,10 +619,8 @@ 'tool_id': tool_id, 'tool_state': tool_state } ) - # update module state module.update_state( incoming ) - if type == 'tool': return { 'tool_state': module.get_state(), @@ -684,7 +696,8 @@ except workflows.MissingToolsException as e: return dict( name=e.workflow.name, - message="This workflow includes missing or invalid tools. It cannot be saved until the following steps are removed or the missing tools are enabled.", + message="This workflow includes missing or invalid tools. " + "It cannot be saved until the following steps are removed or the missing tools are enabled.", errors=e.errors, ) @@ -797,7 +810,7 @@ # Stream workflow to file. stored_dict = self._workflow_to_dict( trans, stored ) if not stored_dict: - #This workflow has a tool that's missing from the distribution + # This workflow has a tool that's missing from the distribution trans.response.status = 400 return "Workflow cannot be exported due to missing tools." valid_chars = '.,^_-()[]0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' @@ -918,7 +931,10 @@ message += "You can likely install the required tools from one of the Galaxy tool sheds listed below.<br/>" for missing_tool_tup in missing_tool_tups: missing_tool_id, missing_tool_name, missing_tool_version = missing_tool_tup - message += "<b>Tool name</b> %s, <b>id</b> %s, <b>version</b> %s<br/>" % ( escape( missing_tool_name ), escape( missing_tool_id ), escape( missing_tool_version ) ) + message += "<b>Tool name</b> %s, <b>id</b> %s, <b>version</b> %s<br/>" % ( + escape( missing_tool_name ), + escape( missing_tool_id ), + escape( missing_tool_version ) ) message += "<br/>" for shed_name, shed_url in trans.app.tool_shed_registry.tool_sheds.items(): if shed_url.endswith( '/' ): @@ -998,9 +1014,10 @@ ) # Index page with message workflow_id = trans.security.encode_id( stored_workflow.id ) - return trans.show_message( 'Workflow "%s" created from current history. You can <a href="%s" target="_parent">edit</a> or <a href="%s">run</a> the workflow.' % - ( escape( workflow_name ), url_for( controller='workflow', action='editor', id=workflow_id ), - url_for( controller='workflow', action='run', id=workflow_id ) ) ) + return trans.show_message( 'Workflow "%s" created from current history. ' + 'You can <a href="%s" target="_parent">edit</a> or <a href="%s">run</a> the workflow.' + % ( escape( workflow_name ), url_for( controller='workflow', action='editor', id=workflow_id ), + url_for( controller='workflow', action='run', id=workflow_id ) ) ) @web.expose def run( self, trans, id, history_id=None, hide_fixed_params=False, **kwargs ): @@ -1015,7 +1032,6 @@ # It is possible for a workflow to have 0 steps if len( workflow.steps ) == 0: error( "Workflow cannot be run because it does not have any steps" ) - #workflow = Workflow.from_simple( json.loads( stored.encoded_value ), trans.app ) if workflow.has_cycles: error( "Workflow cannot be run because it contains cycles" ) if workflow.has_errors: @@ -1068,7 +1084,8 @@ else: nh_name = "History from %s workflow" % workflow.name instance_inputs = [kwargs[multi_input_key] for multi_input_key in multi_input_keys] - instance_ds_names = [trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( instance_input ).name for instance_input in instance_inputs] + instance_ds_names = [trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( instance_input ).name + for instance_input in instance_inputs] nh_name = '%s%s' % (nh_name, _build_workflow_on_str( instance_ds_names )) new_history = trans.app.model.History( user=trans.user, name=nh_name ) new_history.copy_tags_from(trans.user, trans.get_history()) https://bitbucket.org/galaxy/galaxy-central/commits/67222d8cb3a5/ Changeset: 67222d8cb3a5 User: dannon Date: 2015-02-23 14:46:26+00:00 Summary: Update queries/filters in workflow controller to use sqlalchemy constructs for True, False, testing for None. Affected #: 1 file diff -r 8d3323ccb3f89ca949ab443b2ea37b8992a4f509 -r 67222d8cb3a54c7a3dc28accc8f16ff502fe547b lib/galaxy/webapps/galaxy/controllers/workflow.py --- a/lib/galaxy/webapps/galaxy/controllers/workflow.py +++ b/lib/galaxy/webapps/galaxy/controllers/workflow.py @@ -6,6 +6,7 @@ import urllib2 from sqlalchemy import and_ +from sqlalchemy.sql import expression from tool_shed.util import common_util from tool_shed.util import encoding_util @@ -121,7 +122,10 @@ def apply_query_filter( self, trans, query, **kwargs ): # A public workflow is published, has a slug, and is not deleted. - return query.filter( self.model_class.published == True ).filter( self.model_class.slug != None ).filter( self.model_class.deleted == False ) + return query.filter( + self.model_class.published == expression.true() ).filter( + self.model_class.slug.isnot(None)).filter( + self.model_class.deleted == expression.false()) # Simple SGML parser to get all content in a single tag. @@ -182,7 +186,7 @@ .query( model.StoredWorkflowUserShareAssociation ) \ .filter_by( user=user ) \ .join( 'stored_workflow' ) \ - .filter( model.StoredWorkflow.deleted == False ) \ + .filter( model.StoredWorkflow.deleted == expression.false() ) \ .order_by( desc( model.StoredWorkflow.update_time ) ) \ .all() @@ -213,7 +217,7 @@ shared_by_others = trans.sa_session \ .query( model.StoredWorkflowUserShareAssociation ) \ .filter_by( user=user ) \ - .filter( model.StoredWorkflow.deleted == False ) \ + .filter( model.StoredWorkflow.deleted == expression.false() ) \ .order_by( desc( model.StoredWorkflow.table.c.update_time ) ) \ .all() return trans.fill_template( "workflow/list_for_run.mako", @@ -307,7 +311,7 @@ if email: other = trans.sa_session.query( model.User ) \ .filter( and_( model.User.table.c.email == email, - model.User.table.c.deleted == False ) ) \ + model.User.table.c.deleted == expression.false() ) ) \ .first() if not other: mtype = "error" @@ -1274,7 +1278,7 @@ shared_by_others = trans.sa_session \ .query( model.StoredWorkflowUserShareAssociation ) \ .filter_by( user=user ) \ - .filter( model.StoredWorkflow.deleted == False ) \ + .filter( model.StoredWorkflow.deleted == expression.false() ) \ .all() return trans.fill_template( "workflow/configure_menu.mako", workflows=workflows, 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.