How to use the deco.concurrent function in deco

To help you get started, we’ve selected a few deco examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mitmedialab / MediaCloud-Web-Tools / server / util / pushshift.py View on Github external
@concurrent
def _reddit_url_submissions_for(url):
    data = _cached_reddit_submission_search(url=_sanitize_url_for_reddit(url), aggs='created_utc', frequency='5y')
    if len(data['created_utc']) == 0:
        return 0
    return data['created_utc'][0]['doc_count']
github mitmedialab / MediaCloud-Web-Tools / server / views / sources / collectionedit.py View on Github external
@concurrent
def _update_source_worker(source_info):
    # worker function to help update sources in parallel
    user_mc = user_admin_mediacloud_client()
    media_id = source_info['media_id']
    logger.debug("Updating media {}".format(media_id))
    source_no_metadata_no_id = {k: v for k, v in list(source_info.items()) if k != 'media_id'
                                and k not in SOURCE_LIST_CSV_METADATA_PROPS}
    response = user_mc.mediaUpdate(media_id, source_no_metadata_no_id)
    return response
github notadamking / RLTrader / cli.py View on Github external
@concurrent(processes=args.proc_number)
def run_concurrent_optimize(trader: RLTrader, args):
    trader.optimize(args.trials, args.trials, args.parallel_jobs)

deco

A decorator for concurrency

MIT
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis