Пример #1
0
	def fill(self, container):
		combinedEntry = container.getEntry('cmdargs', lambda entry: entry.section == 'global')
		newCmdLine = self._cmd_line_args
		if combinedEntry:
			newCmdLine = combinedEntry.value.split() + self._cmd_line_args
		(opts, _) = parse_cmd_line(newCmdLine)
		def setConfigFromOpt(section, option, value):
			if value is not None:
				self._addEntry(container, section, option, str(value), '<cmdline>')
		cmd_line_config_map = {
			'state!': { '#init': opts.init, '#resync': opts.resync,
				'#display config': opts.help_conf, '#display minimal config': opts.help_confmin },
			'action': { 'delete': opts.delete, 'reset': opts.reset },
			'global': { 'gui': opts.gui, 'submission': opts.submission },
			'jobs': { 'max retry': opts.max_retry, 'selected': opts.job_selector },
			'logging': { 'debug mode': opts.debug },
		}
		for section in cmd_line_config_map:
			for (option, value) in cmd_line_config_map[section].items():
				setConfigFromOpt(section, option, value)
		for entry in opts.logging:
			tmp = entry.replace(':', '=').split('=')
			if len(tmp) == 1:
				tmp.append('DEBUG')
			setConfigFromOpt('logging', tmp[0] + ' level', tmp[1])
		if opts.action is not None:
			setConfigFromOpt('workflow', 'action', opts.action.replace(',', ' '))
		if opts.continuous:
			setConfigFromOpt('workflow', 'duration', -1)
		Plugin.createInstance('StringConfigFiller', opts.override).fill(container)
Пример #2
0
	def fill(self, container):
		combinedEntry = container.getEntry('cmdargs', lambda entry: entry.section == 'global')
		newCmdLine = self._cmd_line_args
		if combinedEntry:
			newCmdLine = combinedEntry.value.split() + self._cmd_line_args
		(opts, _) = gc_cmd_line_parser(newCmdLine)
		def setConfigFromOpt(section, option, value):
			if value is not None:
				self._addEntry(container, section, option, str(value), '<cmdline>')
		cmd_line_config_map = {
			'state!': { '#init': opts.init, '#resync': opts.resync,
				'#display config': opts.help_conf, '#display minimal config': opts.help_confmin },
			'action': { 'delete': opts.delete, 'reset': opts.reset },
			'global': { 'gui': opts.gui, 'submission': opts.submission },
			'jobs': { 'max retry': opts.max_retry, 'selected': opts.job_selector },
			'logging': { 'debug mode': opts.debug },
		}
		for section in cmd_line_config_map:
			for (option, value) in cmd_line_config_map[section].items():
				setConfigFromOpt(section, option, value)
		for entry in opts.logging:
			tmp = entry.replace(':', '=').split('=')
			if len(tmp) == 1:
				tmp.append('DEBUG')
			setConfigFromOpt('logging', tmp[0] + ' level', tmp[1])
		if opts.action is not None:
			setConfigFromOpt('workflow', 'action', opts.action.replace(',', ' '))
		if opts.continuous:
			setConfigFromOpt('workflow', 'duration', -1)
		Plugin.createInstance('StringConfigFiller', opts.override).fill(container)
Пример #3
0
def initGC(args):
    if len(args) > 0:
        config = getConfig(args[0])
        userSelector = None
        if len(args) != 1:
            userSelector = JobSelector.create(args[1])
        return (config,
                Plugin.createInstance('TextFileJobDB',
                                      config,
                                      jobSelector=userSelector))
    sys.stderr.write('Syntax: %s <config file> [<job id>, ...]\n\n' %
                     sys.argv[0])
    sys.exit(os.EX_USAGE)