From 4dc04e1472b0c0e7d761966dea690dca24f645f2 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Sun, 8 Feb 2015 11:16:14 -0500 Subject: [PATCH 1/2] Fix a few instances of incorrect (deprecated) use of value instead of identity testing in xml parsing. --- lib/galaxy/forms/forms.py | 2 +- lib/galaxy/sample_tracking/external_service_types.py | 4 ++-- lib/galaxy/workflow/scheduling_manager.py | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/galaxy/forms/forms.py b/lib/galaxy/forms/forms.py index e8734fb6d6b..02ae869b177 100644 --- a/lib/galaxy/forms/forms.py +++ b/lib/galaxy/forms/forms.py @@ -50,7 +50,7 @@ class FormDefinitionFactory( object ): #load fields fields = [] fields_elem = elem.find( 'fields' ) - if fields_elem: + if fields_elem is not None: for field_elem in fields_elem.findall( 'field' ): field_type = field_elem.get( 'type' ) assert field_type in self.field_type_factories, 'Invalid form field type ( %s ).' % field_type diff --git a/lib/galaxy/sample_tracking/external_service_types.py b/lib/galaxy/sample_tracking/external_service_types.py index 80c63d4cf8b..839d4370028 100644 --- a/lib/galaxy/sample_tracking/external_service_types.py +++ b/lib/galaxy/sample_tracking/external_service_types.py @@ -96,9 +96,9 @@ class ExternalServiceType( object ): def parse_run_details( self, root ): self.run_details = {} run_details_elem = root.find( 'run_details' ) - if run_details_elem: + if run_details_elem is not None: results_elem = run_details_elem.find( 'results' ) - if results_elem: + if results_elem is not None: # Get the list of resulting datatypes # TODO: the 'results_urls' attribute is only useful if the transfer protocol is http(s), so check if that is the case. self.run_details[ 'results' ], self.run_details[ 'results_urls' ] = self.parse_run_details_results( results_elem ) diff --git a/lib/galaxy/workflow/scheduling_manager.py b/lib/galaxy/workflow/scheduling_manager.py index 556ee469217..1aca8751f4d 100644 --- a/lib/galaxy/workflow/scheduling_manager.py +++ b/lib/galaxy/workflow/scheduling_manager.py @@ -112,8 +112,7 @@ class WorkflowSchedulingManager( object ): def __init_schedulers_for_element( self, plugins_element ): plugins_kwds = dict( plugins_element.items() ) self.default_scheduler_id = plugins_kwds.get( 'default', DEFAULT_SCHEDULER_ID ) - - for plugin_element in plugins_element.getchildren(): + for plugin_element in plugins_element: plugin_type = plugin_element.tag plugin_kwds = dict( plugin_element.items() ) workflow_scheduler_id = plugin_kwds.get( 'id', None ) From a831c6e148c47d070f887fda16e5739f0e5df5e8 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Sun, 8 Feb 2015 11:21:42 -0500 Subject: [PATCH 2/2] Minor formatting, spelling in workflow scheduling_manager. --- lib/galaxy/workflow/scheduling_manager.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/galaxy/workflow/scheduling_manager.py b/lib/galaxy/workflow/scheduling_manager.py index 1aca8751f4d..6b14926ee7d 100644 --- a/lib/galaxy/workflow/scheduling_manager.py +++ b/lib/galaxy/workflow/scheduling_manager.py @@ -31,11 +31,11 @@ class WorkflowSchedulingManager( object ): self.app = app self.__job_config = app.job_config self.workflow_schedulers = {} - self.active_workflow_schedulers = {} # Passive workflow schedulers - # won't need to be monitored I - # guess. + self.active_workflow_schedulers = {} + # Passive workflow schedulers won't need to be monitored I guess. + self.request_monitor = None - + self.__plugin_classes = self.__plugins_dict() self.__init_schedulers() @@ -67,7 +67,7 @@ class WorkflowSchedulingManager( object ): try: self.request_monitor.shutdown() except Exception: - log.exception( "Failed to shutdown worklfow request monitor." ) + log.exception( "Failed to shutdown workflow request monitor." ) def queue( self, workflow_invocation, request_params ): workflow_invocation.state = model.WorkflowInvocation.states.NEW @@ -133,7 +133,7 @@ class WorkflowSchedulingManager( object ): self.workflow_schedulers[ workflow_scheduler_id ] = workflow_scheduler if isinstance( workflow_scheduler, galaxy.workflow.schedulers.ActiveWorkflowSchedulingPlugin ): self.active_workflow_schedulers[ workflow_scheduler_id ] = workflow_scheduler - + def __start_request_monitor( self ): self.request_monitor = WorkflowRequestMonitor( self.app, self )