commit/galaxy-central: natefoo: Make it possible to load dynamic job runner rules from somewhere other than galaxy.jobs.rules.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/9f63d9632d9d/ Changeset: 9f63d9632d9d User: natefoo Date: 2014-09-02 21:30:57 Summary: Make it possible to load dynamic job runner rules from somewhere other than galaxy.jobs.rules. Affected #: 3 files diff -r 5ce55f9f2923dcdf27150cce3addd6e1ff3782d7 -r 9f63d9632d9d690c2d5e353feac3f83f12db3f78 job_conf.xml.sample_advanced --- a/job_conf.xml.sample_advanced +++ b/job_conf.xml.sample_advanced @@ -22,6 +22,17 @@ <plugin id="cli" type="runner" load="galaxy.jobs.runners.cli:ShellJobRunner" /><plugin id="condor" type="runner" load="galaxy.jobs.runners.condor:CondorJobRunner" /><plugin id="slurm" type="runner" load="galaxy.jobs.runners.slurm:SlurmJobRunner" /> + <plugin id="dynamic" type="runner"> + <!-- The dynamic runner is not a real job running plugin and is + always loaded, so it does not need to be explicitly stated in + <plugins>. However, if you wish to change the base module + containing your dynamic rules, you can do so. + + The `load` attribute is not required (and ignored if + included). + --> + <param id="rules_module">galaxy.jobs.rules</param> + </plugin><!-- Pulsar runners (see more at https://pulsar.readthedocs.org) --><plugin id="pulsar_rest" type="runner" load="galaxy.jobs.runners.pulsar:PulsarRESTJobRunner"><!-- Allow optimized HTTP calls with libcurl (defaults to urllib) --> diff -r 5ce55f9f2923dcdf27150cce3addd6e1ff3782d7 -r 9f63d9632d9d690c2d5e353feac3f83f12db3f78 lib/galaxy/jobs/__init__.py --- a/lib/galaxy/jobs/__init__.py +++ b/lib/galaxy/jobs/__init__.py @@ -103,6 +103,7 @@ """ self.app = app self.runner_plugins = [] + self.dynamic_params = None self.handlers = {} self.handler_runner_plugins = {} self.default_handler_id = None @@ -147,6 +148,10 @@ self.runner_plugins.append(runner_info) else: log.error('Unknown plugin type: %s' % plugin.get('type')) + for plugin in self.__findall_with_required(plugins, 'plugin', ('id', 'type')): + if plugin.get('id') == 'dynamic' and plugin.get('type') == 'runner': + self.dynamic_params = self.__get_params(plugin) + # Load tasks if configured if self.app.config.use_tasked_jobs: self.runner_plugins.append(dict(id='tasks', load='tasks', workers=self.app.config.local_task_queue_workers)) diff -r 5ce55f9f2923dcdf27150cce3addd6e1ff3782d7 -r 9f63d9632d9d690c2d5e353feac3f83f12db3f78 lib/galaxy/jobs/mapper.py --- a/lib/galaxy/jobs/mapper.py +++ b/lib/galaxy/jobs/mapper.py @@ -1,6 +1,7 @@ import logging import inspect import os +import sys log = logging.getLogger( __name__ ) @@ -49,6 +50,11 @@ self.rules_module = galaxy.jobs.rules + if job_config.dynamic_params is not None: + rules_module_name = job_config.dynamic_params['rules_module'] + __import__(rules_module_name) + self.rules_module = sys.modules[rules_module_name] + def __get_rule_modules( self ): unsorted_module_names = self.__get_rule_module_names( ) ## Load modules in reverse order to allow hierarchical overrides 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.
participants (1)
-
commits-noreply@bitbucket.org