(wq, pair_name, collections, config, callback, **kwargs)
| 11 | |
| 12 | |
| 13 | def prepare_pair(wq, pair_name, collections, config, callback, **kwargs): |
| 14 | pair = config.get_pair(pair_name) |
| 15 | |
| 16 | all_collections = dict(collections_for_pair( |
| 17 | status_path=config.general['status_path'], pair=pair |
| 18 | )) |
| 19 | |
| 20 | # spawn one worker less because we can reuse the current one |
| 21 | new_workers = -1 |
| 22 | for collection_name in (collections or all_collections): |
| 23 | try: |
| 24 | config_a, config_b = all_collections[collection_name] |
| 25 | except KeyError: |
| 26 | raise exceptions.UserError( |
| 27 | 'Pair {}: Collection {} not found. These are the ' |
| 28 | 'configured collections:\n{}' |
| 29 | .format(pair_name, |
| 30 | json.dumps(collection_name), |
| 31 | list(all_collections))) |
| 32 | new_workers += 1 |
| 33 | |
| 34 | collection = CollectionConfig(pair, collection_name, config_a, |
| 35 | config_b) |
| 36 | wq.put(functools.partial(callback, collection=collection, |
| 37 | general=config.general, **kwargs)) |
| 38 | |
| 39 | for _ in range(new_workers): |
| 40 | wq.spawn_worker() |
| 41 | |
| 42 | |
| 43 | def sync_collection(wq, collection, general, force_delete): |
nothing calls this directly
no test coverage detected