コード例 #1
0
ファイル: couchdb.py プロジェクト: dirkdejager/commcare-cloud
def generate_shard_plan(migration):
    shard_allocations = generate_shard_allocation(
        migration.source_couch_config, migration.plan.target_allocation)
    with open(migration.shard_plan_path, 'w', encoding='utf-8') as f:
        plan = {
            shard_allocation_doc.db_name: shard_allocation_doc.to_plan_json()
            for shard_allocation_doc in shard_allocations
        }
        # hack - yaml didn't want to dump this directly
        yaml.safe_dump(json.loads(json.dumps(plan)), f, indent=2)
    return shard_allocations
コード例 #2
0
ファイル: couchdb.py プロジェクト: dimagi/commcarehq-ansible
def generate_shard_plan(migration):
    shard_allocations = generate_shard_allocation(
        migration.source_couch_config, migration.plan.target_allocation
    )
    with open(migration.shard_plan_path, 'w') as f:
        plan = {
            shard_allocation_doc.db_name: shard_allocation_doc.to_plan_json()
            for shard_allocation_doc in shard_allocations
        }
        # hack - yaml didn't want to dump this directly
        yaml.safe_dump(json.loads(json.dumps(plan)), f, indent=2)
    return shard_allocations