def run():
    'Run CVEjob.'
    feed_dir = Config.feed_dir
    feed_names = Config.feed_names
    date_range = Config.date_range
    cherrypicked_cve_id = Config.cve_id
    cherrypicked_year = None
    if cherrypicked_cve_id:
        cherrypicked_year = cherrypicked_cve_id.split(sep='-')[1]
        if (int(cherrypicked_year) < 2002):
            cherrypicked_year = 2002
    if date_range:
        date_range = parse_date_range(Config.date_range)
        feed_names = range(date_range[0].year, (date_range[1].year + 1))
        if cherrypicked_cve_id:
            if (int(cherrypicked_year) not in feed_names):
                logger.info('[{picked_cve_id}] does not belong to the given feed range: {date_range}'.format(picked_cve_id=cherrypicked_cve_id, date_range=date_range))
                return
            feed_names = [cherrypicked_year]
    if (not feed_names):
        if cherrypicked_cve_id:
            feed_names = [cherrypicked_year]
        else:
            feed_names = ['modified']
    with FeedManager(n_workers=multiprocessing.cpu_count()) as feed_manager:
        feeds = feed_manager.fetch_feeds(feed_names=feed_names, data_dir=feed_dir, update=True)
        collection = feed_manager.collect(feeds)
        collection = _filter_collection(collection, date_range, cherrypicked_cve_id)
    if (not collection):
        logger.info('Collection is empty.'.format(picked_cve_id=cherrypicked_cve_id))
        return
    logger.debug('Number of CVE Documents in the collection: {}'.format(collection.count()))
    if (Config.package_name and Config.cve_id):
        doc = [x for x in collection][0]
        (affected, safe) = NVDVersions(doc, Config.package_name, Config.ecosystem).run()
        victims_output = VictimsYamlOutput(ecosystem=Config.ecosystem, cve_doc=doc, winner=PackageNameCandidate(Config.package_name, Decimal('1.0')), candidates=[], affected=affected, fixedin=safe)
        _log_results(victims_output)
        victims_output.write()
        sys.exit(0)
    for doc in collection:
        cve_id = doc.cve.id_
        try:
            if (not validate_cve(doc)):
                logger.debug('[{cve_id}] was filtered out by input checks'.format(cve_id=cve_id))
                continue
            pkgfile_path = get_pkgfile_path(Config.pkgfile_dir, Config.ecosystem)
            identifier = get_identifier_cls()(doc, Config.ecosystem, pkgfile_path)
            candidates = identifier.identify()
            if (not candidates):
                logger.info('[{cve_id}] no package name candidates found'.format(cve_id=cve_id))
                continue
            selector = VersionSelector(doc, candidates, Config.ecosystem)
            winner = selector.pick_winner()
            if (not winner):
                logger.info('[{cve_id}] no package name found'.format(cve_id=cve_id))
                continue
            (affected, safe) = NVDVersions(doc, winner.package, Config.ecosystem).run()
            victims_output = VictimsYamlOutput(ecosystem=Config.ecosystem, cve_doc=doc, winner=winner, candidates=candidates, affected=affected, fixedin=safe)
            _log_results(victims_output)
            victims_output.write()
        except Exception as exc:
            logger.warning('[{cve_id}] Unexpected exception occurred: {exc}'.format(cve_id=cve_id, exc=exc), exc_info=True)
Run CVEjob.
def run():
    
    feed_dir = Config.feed_dir
    feed_names = Config.feed_names
    date_range = Config.date_range
    cherrypicked_cve_id = Config.cve_id
    cherrypicked_year = None
    if cherrypicked_cve_id:
        cherrypicked_year = cherrypicked_cve_id.split(sep='-')[1]
        if (int(cherrypicked_year) < 2002):
            cherrypicked_year = 2002
    if date_range:
        date_range = parse_date_range(Config.date_range)
        feed_names = range(date_range[0].year, (date_range[1].year + 1))
        if cherrypicked_cve_id:
            if (int(cherrypicked_year) not in feed_names):
                logger.info('[{picked_cve_id}] does not belong to the given feed range: {date_range}'.format(picked_cve_id=cherrypicked_cve_id, date_range=date_range))
                return
            feed_names = [cherrypicked_year]
    if (not feed_names):
        if cherrypicked_cve_id:
            feed_names = [cherrypicked_year]
        else:
            feed_names = ['modified']
    with FeedManager(n_workers=multiprocessing.cpu_count()) as feed_manager:
        feeds = feed_manager.fetch_feeds(feed_names=feed_names, data_dir=feed_dir, update=True)
        collection = feed_manager.collect(feeds)
        collection = _filter_collection(collection, date_range, cherrypicked_cve_id)
    if (not collection):
        logger.info('Collection is empty.'.format(picked_cve_id=cherrypicked_cve_id))
        return
    logger.debug('Number of CVE Documents in the collection: {}'.format(collection.count()))
    if (Config.package_name and Config.cve_id):
        doc = [x for x in collection][0]
        (affected, safe) = NVDVersions(doc, Config.package_name, Config.ecosystem).run()
        victims_output = VictimsYamlOutput(ecosystem=Config.ecosystem, cve_doc=doc, winner=PackageNameCandidate(Config.package_name, Decimal('1.0')), candidates=[], affected=affected, fixedin=safe)
        _log_results(victims_output)
        victims_output.write()
        sys.exit(0)
    for doc in collection:
        cve_id = doc.cve.id_
        try:
            if (not validate_cve(doc)):
                logger.debug('[{cve_id}] was filtered out by input checks'.format(cve_id=cve_id))
                continue
            pkgfile_path = get_pkgfile_path(Config.pkgfile_dir, Config.ecosystem)
            identifier = get_identifier_cls()(doc, Config.ecosystem, pkgfile_path)
            candidates = identifier.identify()
            if (not candidates):
                logger.info('[{cve_id}] no package name candidates found'.format(cve_id=cve_id))
                continue
            selector = VersionSelector(doc, candidates, Config.ecosystem)
            winner = selector.pick_winner()
            if (not winner):
                logger.info('[{cve_id}] no package name found'.format(cve_id=cve_id))
                continue
            (affected, safe) = NVDVersions(doc, winner.package, Config.ecosystem).run()
            victims_output = VictimsYamlOutput(ecosystem=Config.ecosystem, cve_doc=doc, winner=winner, candidates=candidates, affected=affected, fixedin=safe)
            _log_results(victims_output)
            victims_output.write()
        except Exception as exc:
            logger.warning('[{cve_id}] Unexpected exception occurred: {exc}'.format(cve_id=cve_id, exc=exc), exc_info=True)