'This will download all profiles that are not already cached.'

def GetMissingProfiles(self, version=constants.PROFILE_REPOSITORY_VERSION):

    inv_profile = self.GetProfileByName('inventory', ignore_cache=True, version=version)
    inventory_json = zlib.decompress(inv_profile.data, (16 + zlib.MAX_WBITS))
    inventory = json.loads(inventory_json)
    cache_urn = rdfvalue.RDFURN(config.CONFIG['Rekall.profile_cache_urn'])
    profile_to_urn = {}
    urn_to_profile = {}
    for profile in inventory['$INVENTORY']:
        profile_urn = cache_urn.Add(version).Add(profile)
        profile_to_urn[profile] = profile_urn
        urn_to_profile[profile_urn] = profile
    profiles_to_get = set(urn_to_profile)
    for metadata in aff4.FACTORY.Stat(urn_to_profile, token=self.token):
        timestamp = metadata['type'][(-1)]
        profile_urn = metadata['urn']
        profile_name = urn_to_profile[profile_urn]
        inventory_timestamp = inventory['$INVENTORY'][profile_name].get('LastModified')
        if ((timestamp / 1000000.0) > inventory_timestamp):
            profiles_to_get.remove(metadata['urn'])
    pool = threadpool.ThreadPool.Factory('profiles', 50)
    pool.Start()
    try:
        for urn in profiles_to_get:
            profile = urn_to_profile[urn]
            logging.info('Getting    missing    profile:    %s', profile)
            try:
                pool.AddTask(self.GetProfileByName, (profile, version, True))
            except urllib2.URLError as e:
                logging.info('Exception:    %s', e)
    finally:
        pool.Join()
