当前位置: 首页>>代码示例>>Python>>正文


Python SyncService.host方法代码示例

本文整理汇总了Python中inbox.mailsync.service.SyncService.host方法的典型用法代码示例。如果您正苦于以下问题:Python SyncService.host方法的具体用法?Python SyncService.host怎么用?Python SyncService.host使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在inbox.mailsync.service.SyncService的用法示例。


在下文中一共展示了SyncService.host方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_concurrent_syncs

# 需要导入模块: from inbox.mailsync.service import SyncService [as 别名]
# 或者: from inbox.mailsync.service.SyncService import host [as 别名]
def test_concurrent_syncs(db, default_account, config):
    ss1 = SyncService(cpu_id=1, total_cpus=2)
    ss2 = SyncService(cpu_id=1, total_cpus=2)
    ss2.host = 'other-host'
    # Check that only one SyncService instance claims the account.
    assert ss1.accounts_to_start() == [1]
    assert ss2.accounts_to_start() == []
开发者ID:Analect,项目名称:sync-engine,代码行数:9,代码来源:test_sync_start_logic.py

示例2: test_concurrent_syncs

# 需要导入模块: from inbox.mailsync.service import SyncService [as 别名]
# 或者: from inbox.mailsync.service.SyncService import host [as 别名]
def test_concurrent_syncs(db, default_account, config):
    purge_other_accounts(default_account)
    ss1 = SyncService(cpu_id=default_account.id % 2, total_cpus=2)
    ss2 = SyncService(cpu_id=default_account.id % 2, total_cpus=2)
    ss2.host = "other-host"
    # Check that only one SyncService instance claims the account.
    assert ss1.accounts_to_start() == [default_account.id]
    assert ss2.accounts_to_start() == []
开发者ID:nohobby,项目名称:sync-engine,代码行数:10,代码来源:test_sync_start_logic.py

示例3: test_accounts_started_on_all_shards

# 需要导入模块: from inbox.mailsync.service import SyncService [as 别名]
# 或者: from inbox.mailsync.service.SyncService import host [as 别名]
def test_accounts_started_on_all_shards(db, default_account, config):
    config['SYNC_STEAL_ACCOUNTS'] = True
    purge_other_accounts(default_account)
    default_account.sync_host = None
    db.session.commit()
    ss = SyncService(cpu_id=0, total_cpus=1)
    ss.host = 'localhost'
    account_ids = {default_account.id}
    for key in (0, 1):
        with session_scope_by_shard_id(key) as db_session:
            acc = Account()
            acc.namespace = Namespace()
            db_session.add(acc)
            db_session.commit()
            account_ids.add(acc.id)

    assert len(account_ids) == 3
    assert set(ss.accounts_to_start()) == account_ids
    for id_ in account_ids:
        with session_scope(id_) as db_session:
            acc = db_session.query(Account).get(id_)
            assert acc.sync_host == 'localhost'
开发者ID:richee85,项目名称:sync-engine,代码行数:24,代码来源:test_sync_start_logic.py


注:本文中的inbox.mailsync.service.SyncService.host方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。