本文整理汇总了Python中nxdrive.client.RemoteDocumentClient.wait方法的典型用法代码示例。如果您正苦于以下问题:Python RemoteDocumentClient.wait方法的具体用法?Python RemoteDocumentClient.wait怎么用?Python RemoteDocumentClient.wait使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nxdrive.client.RemoteDocumentClient
的用法示例。
在下文中一共展示了RemoteDocumentClient.wait方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: UnitTestCase
# 需要导入模块: from nxdrive.client import RemoteDocumentClient [as 别名]
# 或者: from nxdrive.client.RemoteDocumentClient import wait [as 别名]
#.........这里部分代码省略.........
upload_tmp_dir=self.upload_tmp_dir)
# File system client to be used to create remote test documents
# and folders
remote_file_system_client_1 = RemoteFileSystemClient(
self.nuxeo_url, self.user_1, u'nxdrive-test-device-1',
self.version,
password=self.password_1, upload_tmp_dir=self.upload_tmp_dir)
remote_file_system_client_2 = RemoteFileSystemClient(
self.nuxeo_url, self.user_2, u'nxdrive-test-device-2',
self.version,
password=self.password_2, upload_tmp_dir=self.upload_tmp_dir)
self.remote_restapi_client_1 = RestAPIClient(
self.nuxeo_url, self.user_1, u'nxdrive-test-device-1',
self.version,
password=self.password_1
)
self.remote_restapi_client_2 = RestAPIClient(
self.nuxeo_url, self.user_2, u'nxdrive-test-device-2',
self.version,
password=self.password_2
)
# Register root
remote_document_client_1.register_as_root(self.workspace_1)
remote_document_client_2.register_as_root(self.workspace_2)
self.remote_document_client_1 = remote_document_client_1
self.remote_document_client_2 = remote_document_client_2
self.remote_file_system_client_1 = remote_file_system_client_1
self.remote_file_system_client_2 = remote_file_system_client_2
self._wait_sync = {self.engine_1.get_uid(): True, self.engine_2.get_uid(): True}
self._wait_remote_scan = {self.engine_1.get_uid(): True, self.engine_2.get_uid(): True}
self._remote_changes_count = {self.engine_1.get_uid(): 0, self.engine_2.get_uid(): 0}
self._no_remote_changes = {self.engine_1.get_uid(): False, self.engine_2.get_uid(): False}
def wait_sync(self, wait_for_async=False, timeout=DEFAULT_WAIT_SYNC_TIMEOUT, fail_if_timeout=True,
wait_for_engine_1=True, wait_for_engine_2=False, wait_win=False, enforce_errors=True):
log.debug("Wait for sync")
# First wait for server if needed
if wait_for_async:
self.wait()
if sys.platform == "win32" and wait_win:
from nxdrive.engine.watcher.local_watcher import WIN_MOVE_RESOLUTION_PERIOD
log.trace("Need to wait for Windows delete resolution")
sleep(WIN_MOVE_RESOLUTION_PERIOD/1000)
self._wait_sync = {
self.engine_1.get_uid(): wait_for_engine_1,
self.engine_2.get_uid(): wait_for_engine_2
}
self._no_remote_changes = {self.engine_1.get_uid(): not wait_for_engine_1,
self.engine_2.get_uid(): not wait_for_engine_2}
if enforce_errors:
if not self.connected:
self.engine_1.syncPartialCompleted.connect(self.engine_1.get_queue_manager().requeue_errors)
self.engine_2.syncPartialCompleted.connect(self.engine_1.get_queue_manager().requeue_errors)
self.connected = True
elif self.connected:
self.engine_1.syncPartialCompleted.disconnect(self.engine_1.get_queue_manager().requeue_errors)
self.engine_2.syncPartialCompleted.disconnect(self.engine_1.get_queue_manager().requeue_errors)
self.connected = False
while timeout > 0:
sleep(1)
timeout = timeout - 1