Parse the config file and spawn a ProTECT job for every input sample.

    :param str config_file: Path to the input config file
    :param int max_cores: The maximum cores to use for any single high-compute job.
349159
def parse_config_file(job, config_file, max_cores=None):
    
    sample_set, univ_options, processed_tool_inputs = _parse_config_file(job, config_file,
                                                                         max_cores)
    # Start a job for each sample in the sample set
    for patient_id in sample_set.keys():
        job.addFollowOnJobFn(launch_protect, sample_set[patient_id], univ_options,
                             processed_tool_inputs)
    return None
24149
def load_config_file(config_file_path, config_file):
    

    if config_file_path.lower().endswith(".yaml"):
        return yaml.load(config_file)

    if any(config_file_path.lower().endswith(extension) for extension in INI_FILE_EXTENSIONS):
        return load_config_from_ini_file(config_file)

    # At this point we have to guess the format of the configuration file.
    try:
        return yaml.load(config_file)
    except yaml.YAMLError:
        pass

    try:
        return load_config_from_ini_file(config_file)
    except:
        pass

    raise Exception("Could not load configuration file!")
542845
def load_config(self, configfile=None, override_config=None):
        
        self.config = configobj.ConfigObj()

        # Load in the collector's defaults
        if self.get_default_config() is not None:
            self.config.merge(self.get_default_config())

        if configfile is not None:
            self.configfile = os.path.abspath(configfile)

        if self.configfile is not None:
            config = load_config(self.configfile)

            if 'collectors' in config:
                if 'default' in config['collectors']:
                    self.config.merge(config['collectors']['default'])

                if self.name in config['collectors']:
                    self.config.merge(config['collectors'][self.name])

        if override_config is not None:
            if 'collectors' in override_config:
                if 'default' in override_config['collectors']:
                    self.config.merge(override_config['collectors']['default'])

                if self.name in override_config['collectors']:
                    self.config.merge(override_config['collectors'][self.name])

        self.process_config()
841699
def run(config, max_jobs, output=sys.stdout, job_type='local',
        report_type='text', shell='/bin/bash', temp='.metapipe', run_now=False):
    
    if max_jobs == None:
        max_jobs = cpu_count()

    parser = Parser(config)
    try:
        command_templates = parser.consume()
    except ValueError as e:
        raise SyntaxError('Invalid config file. \n%s' % e)
    options = '\n'.join(parser.global_options)

    queue_type = QUEUE_TYPES[report_type]
    pipeline = Runtime(command_templates,queue_type,JOB_TYPES,job_type,max_jobs)

    template = env.get_template('output_script.tmpl.sh')
    with open(temp, 'wb') as f:
        pickle.dump(pipeline, f, 2)
        script = template.render(shell=shell,
            temp=os.path.abspath(temp), options=options)

    if run_now:
        output = output if output != sys.stdout else PIPELINE_ALIAS
        submit_job = make_submit_job(shell, output, job_type)
        submit_job.submit()

    try:
        f = open(output, 'w')
        output = f
    except TypeError:
        pass

    output.write(script)
    f.close()
1182089
def configfile
      @log.debug "Finding config file"
      @config_file_paths.each { |file|
        @log.debug "Checking if file '#{file}' exists"
        if File.file?(file)
          @log.debug "Reading config file from: " + file
          config_file = File.read(file)
          parsed_config_file = YAML.load(config_file)
          #parsed_config_file = IniParse.parse(config_file).to_hash
          @log.debug "configuration read from config file: " + parsed_config_file.to_s
          return parsed_config_file if parsed_config_file.is_a?(Hash)
        else
          @log.debug "Configuration file '#{file}' not found"
        end
      }
      return {}
    end
298814
def parse_mapping(mapping_file: Optional[str]) -> configparser.ConfigParser:
    
    LOGGER.debug('Parsing mapping file. Command line: %s', mapping_file)

    def parse(mapping_file):
        config = configparser.ConfigParser()
        config.read_file(mapping_file)
        return config

    # give precedence to the user-specified file
    if mapping_file is not None:
        LOGGER.debug('Parsing command line mapping file')
        return parse(mapping_file)

    # fall back on XDG config location
    xdg_config_dir = xdg.BaseDirectory.load_first_config('pass-git-helper')
    if xdg_config_dir is None:
        raise RuntimeError(
            'No mapping configured so far at any XDG config location. '
            'Please create {config_file}'.format(
                config_file=DEFAULT_CONFIG_FILE))
    mapping_file = os.path.join(xdg_config_dir, CONFIG_FILE_NAME)
    LOGGER.debug('Parsing mapping file %s', mapping_file)
    with open(mapping_file, 'r') as file_handle:
        return parse(file_handle)
908327
def WriteConfig(self, config_file=None):
    
    config_file = config_file or self.config_file
    config_name = os.path.splitext(os.path.basename(config_file))[0]
    config_lock = (
        '%s/lock/google_%s.lock' % (constants.LOCALSTATEDIR, config_name))
    with file_utils.LockFile(config_lock):
      with open(config_file, 'w') as config_fp:
        if self.config_header:
          self._AddHeader(config_fp)
        self.config.write(config_fp)
950532
def _run_toplevel(config, config_file, work_dir, parallel,
                  fc_dir=None, run_info_yaml=None):
    
    parallel = log.create_base_logger(config, parallel)
    log.setup_local_logging(config, parallel)
    logger.info("System YAML configuration: %s" % os.path.abspath(config_file))
    dirs = run_info.setup_directories(work_dir, fc_dir, config, config_file)
    config_file = os.path.join(dirs["config"], os.path.basename(config_file))
    pipelines, config = _pair_samples_with_pipelines(run_info_yaml, config)
    system.write_info(dirs, parallel, config)
    with tx_tmpdir(config if parallel.get("type") == "local" else None) as tmpdir:
        tempfile.tempdir = tmpdir
        for pipeline, samples in pipelines.items():
            for xs in pipeline(config, run_info_yaml, parallel, dirs, samples):
                pass
89296
public static ConfigDocument parseFile(File file, ConfigParseOptions options) {
        return Parseable.newFile(file, options).parseConfigDocument();
    }
1016316
def from_file(cls, filename):
        
        # Read the configuration file
        config = VSGConfigParser()
        if filename not in config.read([filename]):
            raise ValueError('Could not read VSG configuration file %s.' % filename)

        # set the root
        root = config.get('vsgen', 'root')
        root = os.path.normpath(os.path.join(os.path.dirname(filename), root))
        config.set('vsgen', 'root', root)

        return VSGSuite(config)
1217524
def parse_config_file():
    
    for filename in ('.tagcube', os.path.expanduser('~/.tagcube')):

        filename = os.path.abspath(filename)

        if not os.path.exists(filename):
            msg = 'TagCube configuration file "%s" does not exist'
            cli_logger.debug(msg % filename)
            continue

        msg = 'Parsing tagcube configuration file "%s"'
        cli_logger.debug(msg % filename)

        email, api_key = _parse_config_file_impl(filename)
        if email is not None and api_key is not None:
            msg = ('Found authentication credentials:\n'
                   '    email: %s\n'
                   '    api_key: %s')
            tokenized_api_key = '%s...%s' % (api_key[:3], api_key[-3:])
            args = (email, tokenized_api_key)
            cli_logger.debug(msg % args)

            return email, api_key
        else:
            msg = 'Configuration file does not contain credentials'
            cli_logger.debug(msg)
    else:
        return None, None
863516
def _handle_config(self, config_file):
        
        config = self._get_config(config_file)

        self.resolver = DatabaseManager(
            config.get("databases", config.get("DATABASES", {}))
        )

        return True
188005
def read_config(config_file=CONFIG_FILE_DEFAULT, override_url=None):
    ''' '''
    config = ConfigParser()
    config.read_dict(DEFAULT_SETTINGS)

    try:
        config.readfp(open(config_file))
        logger.debug("Using config file at " + config_file)
    except:
        logger.error(
            "Could not find {0}, running with defaults.".format(config_file))

    if not logger.handlers:
        # Before doing anything else, configure logging
        # Handlers might be already registered in repeated test suite runs
        # In production, this should never happen
        if config.getboolean("Logging", "to_file"):
            handler = logging.FileHandler(config.get("Logging", "file"))
        else:
            handler = logging.StreamHandler()
        handler.setFormatter(logging.Formatter(
            config.get("Logging", "format")))
        logger.addHandler(handler)
    logger.setLevel(config.get("Logging", "level"))

    if override_url:
        config['Server']['url'] = override_url

    return config
1190747
def _get_config(config_file):
    ''''''
    parser = ConfigParser.SafeConfigParser()
    if os.path.lexists(config_file):
        try:
            log.info('Reading config: %s', config_file)
            inp = open(config_file)
            parser.readfp(inp)
            return parser
        except (IOError, ConfigParser.ParsingError), err:
            raise ConfigError("Failed to read configuration %s\n%s" % (config_file, err))
    return None
535520
def load_config_file(self):
        """"""
        config_parser = SafeConfigParser()

        config_parser.read(self.CONFIG_FILE)

        if config_parser.has_section('handlers'):
            self._config['handlers_package'] = config_parser.get('handlers', 'package')

        if config_parser.has_section('auth'):
            self._config['consumer_key'] = config_parser.get('auth', 'consumer_key')
            self._config['consumer_secret'] = config_parser.get('auth', 'consumer_secret')
            self._config['token_key'] = config_parser.get('auth', 'token_key')
            self._config['token_secret'] = config_parser.get('auth', 'token_secret')

        if config_parser.has_section('stream'):
            self._config['user_stream'] = config_parser.get('stream', 'user_stream').lower() == 'true'
        else:
            self._config['user_stream'] = False

        if config_parser.has_option('general', 'min_seconds_between_errors'):
            self._config['min_seconds_between_errors'] = config_parser.get('general', 'min_seconds_between_errors')
        if config_parser.has_option('general', 'sleep_seconds_on_consecutive_errors'):
            self._config['sleep_seconds_on_consecutive_errors'] = config_parser.get(
                'general', 'sleep_seconds_on_consecutive_errors')
181561
def load_config(configfile):
    
    try:
        with open(configfile, 'r') as ymlfile:
            try:
                config = yaml.load(ymlfile)
                return config
            except yaml.parser.ParserError:
                raise PyYAMLConfigError(
                    'Could not parse config file: {}'.format(configfile),
                )
    except IOError:
        raise PyYAMLConfigError(
            'Could not open config file: {}'.format(configfile),
        )
510897
def create_config(allow_insecure_config_file=False):
    
    config = Config()
    config.add_properties(GLOBAL_CONFIG_FILENAME)
    user_config_filename = get_user_config_filename()
    if user_config_filename == LOCAL_CONFIG_FILENAME and not allow_insecure_config_file:
        verify_file_private(user_config_filename)
    config.add_properties(user_config_filename)
    return config