Commits

Edward Kirton committed 2fbf86c Draft

add support for optional module environment setup file

  • Participants
  • Parent commits 5811b0f

Comments (0)

Files changed (3)

lib/galaxy/config.py

         self.external_chown_script = kwargs.get('external_chown_script', None)
         self.environment_setup_file = kwargs.get( 'environment_setup_file', None )
         self.use_modules = string_as_bool( kwargs.get( 'use_modules', 'False' ) )
+        self.modules_environment_setup_file = string_as_bool( kwargs.get( 'modules_environment_setup_file', None ) )
         self.use_heartbeat = string_as_bool( kwargs.get( 'use_heartbeat', 'False' ) )
         self.use_memdump = string_as_bool( kwargs.get( 'use_memdump', 'False' ) )
         self.log_actions = string_as_bool( kwargs.get( 'log_actions', 'False' ) )

lib/galaxy/tools/__init__.py

                                                                                                 installed_tool_dependencies=installed_tool_dependencies )
                 if script_file is None and base_path is None:
                     if self.app.config.use_modules:
+                        if self.app.config.modules_environment_setup_file:
+                            commands.append( '. %s' % self.app.config.modules_environment_setup_file )
                         if requirement.version:
                             module_name = '%s/%s' % ( requirement.name, requirement.version )
                         else:
                             module_name = requirement.name
-                        module_fh = os.popen('module avail %s 2>&1 | grep %s' % ( module_name, module_name ) )
+                        module_fh = os.popen('module avail %s 2>1' % module_name )
                         module_avail = module_fh.read()
                         module_fh.close()
                         if module_avail:
                             commands.append( 'module load %s' % module_name )
                         else:
-                            log.warn( "Failed to resolve dependency on '%s' and module not available, ignoring", requirement.name )
-                    log.warn( "Failed to resolve dependency on '%s', ignoring", requirement.name )
+                            log.warn( "Failed to resolve dependency on '%s' and module not available, ignoring", module_name )
+                    else:
+                        log.warn( "Failed to resolve dependency on '%s', ignoring", requirement.name )
                 elif script_file is None:
                     commands.append( 'PACKAGE_BASE=%s; export PACKAGE_BASE; PATH="%s/bin:$PATH"; export PATH' % ( base_path, base_path ) )
                 else:

universe_wsgi.ini.sample

 
 # This option enables auto-loading of modules defined in tools' requirements tag.
 #use_modules = False
+#modules_environment_setup_file = /etc/profile.d/modules.sh
 
 # ---- Per-Tool Job Management ----------------------------------------------