def synchronize_apps_no_cache(): """Force obtaining the results and checking everything again to avoid inconsistences. This should be run once a day.""" sync_id = start_synchronization() try: cached_requests = get_cached_session() synced_apps = _sync_golab_translations(cached_requests, force_reload = True) _sync_regular_apps(cached_requests, synced_apps, force_reload = True) finally: end_synchronization(sync_id)
def synchronize_apps_cache(): """Force obtaining the results and checking everything again to avoid inconsistences. This can safely be run every few minutes, since most applications will be in the cache.""" sync_id = start_synchronization() try: cached_requests = get_cached_session() synced_apps = _sync_golab_translations(cached_requests, force_reload = False) _sync_regular_apps(cached_requests, synced_apps, force_reload = False) finally: end_synchronization(sync_id)
def synchronize_apps_no_cache(source, single_app_url = None): """Force obtaining the results and checking everything again to avoid inconsistences. This should be run once a day.""" sync_id = start_synchronization(source = source, cached = False, single_app_url = single_app_url) number = 0 try: cached_requests = trutils.get_cached_session(caching = False) synced_apps = [] all_golab_apps = _get_golab_translations(cached_requests) all_golab_apps.extend(get_other_apps()) number += _sync_translations(cached_requests, "Go-Lab apps", synced_apps, all_golab_apps, force_reload = True, single_app_url = single_app_url) number += _sync_regular_apps(cached_requests, synced_apps, force_reload = True, single_app_url = single_app_url) finally: end_synchronization(sync_id, number)
def _generic_synchronize_apps(source, cached, provided_apps, single_app_url, full_cycle=False): sync_id = start_synchronization(source = source, cached = cached, single_app_url = single_app_url) number = 0 try: if full_cycle: sync_repo_apps(force=True) download_repository_apps() provided_apps = retrieve_all_translatable_apps() _sync_translations(provided_apps, force_reload = not cached) number = len(provided_apps) except: traceback.print_exc() finally: end_synchronization(sync_id, number)
def task_download_repository_apps(self, source = None): if source is None: source = 'sched-down' with my_app.app_context(): sync_id = start_synchronization(source=source, cached=False) try: with my_app.app_context(): changes = download_repository_apps() if changes: synchronize_apps_cache_wrapper.delay() finally: with my_app.app_context(): end_synchronization(sync_id, number = 0)
def _generic_synchronize_apps(source, cached, provided_apps, single_app_url, full_cycle=False): sync_id = start_synchronization(source=source, cached=cached, single_app_url=single_app_url) number = 0 try: if full_cycle: sync_repo_apps(force=True) download_repository_apps() provided_apps = retrieve_all_translatable_apps() _sync_translations(provided_apps, force_reload=not cached) number = len(provided_apps) except: traceback.print_exc() finally: end_synchronization(sync_id, number)
def synchronize_apps_no_cache(source, single_app_url=None): """Force obtaining the results and checking everything again to avoid inconsistences. This should be run once a day.""" sync_id = start_synchronization(source=source, cached=False, single_app_url=single_app_url) number = 0 try: cached_requests = trutils.get_cached_session(caching=False) synced_apps = [] all_golab_apps = _get_golab_translations(cached_requests) all_golab_apps.extend(get_other_apps()) number += _sync_translations(cached_requests, "Go-Lab apps", synced_apps, all_golab_apps, force_reload=True, single_app_url=single_app_url) number += _sync_regular_apps(cached_requests, synced_apps, force_reload=True, single_app_url=single_app_url) finally: end_synchronization(sync_id, number)