mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Add more output to discover command.
This commit is contained in:
parent
f2d34f4784
commit
11c9541b53
3 changed files with 15 additions and 5 deletions
|
|
@ -11,9 +11,9 @@ import functools
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from .tasks import sync_pair
|
from .tasks import discover_collections, sync_pair
|
||||||
from .utils import CliError, WorkerQueue, cli_logger, collections_for_pair, \
|
from .utils import CliError, WorkerQueue, cli_logger, handle_cli_error, \
|
||||||
handle_cli_error, load_config, parse_pairs_args
|
load_config, parse_pairs_args
|
||||||
from .. import __version__, log
|
from .. import __version__, log
|
||||||
from ..doubleclick import click
|
from ..doubleclick import click
|
||||||
from ..utils import expand_path
|
from ..utils import expand_path
|
||||||
|
|
@ -138,7 +138,7 @@ def discover(ctx, pairs, max_workers):
|
||||||
|
|
||||||
wq.spawn_worker()
|
wq.spawn_worker()
|
||||||
wq.put(functools.partial(
|
wq.put(functools.partial(
|
||||||
(lambda wq, **kwargs: collections_for_pair(**kwargs)),
|
discover_collections,
|
||||||
status_path=general['status_path'], name_a=name_a, name_b=name_b,
|
status_path=general['status_path'], name_a=name_a, name_b=name_b,
|
||||||
pair_name=pair, config_a=all_storages[name_a],
|
pair_name=pair, config_a=all_storages[name_a],
|
||||||
config_b=all_storages[name_b], pair_options=pair_options,
|
config_b=all_storages[name_b], pair_options=pair_options,
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import functools
|
import functools
|
||||||
|
import json
|
||||||
|
|
||||||
from .utils import CliError, JobFailed, cli_logger, collections_for_pair, \
|
from .utils import CliError, JobFailed, cli_logger, collections_for_pair, \
|
||||||
get_status_name, handle_cli_error, load_status, save_status, \
|
get_status_name, handle_cli_error, load_status, save_status, \
|
||||||
|
|
@ -81,3 +82,12 @@ def sync_collection(wq, pair_name, collection, config_a, config_b,
|
||||||
|
|
||||||
save_status(general['status_path'], pair_name, collection,
|
save_status(general['status_path'], pair_name, collection,
|
||||||
data_type='items', data=status)
|
data_type='items', data=status)
|
||||||
|
|
||||||
|
|
||||||
|
def discover_collections(wq, pair_name, **kwargs):
|
||||||
|
rv = collections_for_pair(pair_name=pair_name, **kwargs)
|
||||||
|
collections = list(c for c, (a, b) in rv)
|
||||||
|
if collections == [None]:
|
||||||
|
collections = None
|
||||||
|
cli_logger.info('Saved for {}: collections = {}'
|
||||||
|
.format(pair_name, json.dumps(collections)))
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ def collections_for_pair(status_path, name_a, name_b, pair_name, config_a,
|
||||||
:param skip_cache: Whether to skip the cached data and always do discovery.
|
:param skip_cache: Whether to skip the cached data and always do discovery.
|
||||||
Even with this option enabled, the new cache is written.
|
Even with this option enabled, the new cache is written.
|
||||||
|
|
||||||
:returns: iterable of (collection, a_args, b_args)
|
:returns: iterable of (collection, (a_args, b_args))
|
||||||
'''
|
'''
|
||||||
rv = load_status(status_path, pair_name, data_type='collections')
|
rv = load_status(status_path, pair_name, data_type='collections')
|
||||||
cache_key = _get_collections_cache_key(pair_options, config_a, config_b)
|
cache_key = _get_collections_cache_key(pair_options, config_a, config_b)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue