Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support specified vineyard socket and skip the launching vineyardd process #2481

Merged
merged 2 commits into from
Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion mars/services/storage/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
if vineyard is not None:
storage_configs.append({'vineyard': dict(
vineyard_size='256M',
vineyard_socket='/tmp/vineyard.sock'
)})

# shared_memory
Expand Down
4 changes: 1 addition & 3 deletions mars/storage/tests/test_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,8 @@ async def storage_context(ray_start_regular, request):
await PlasmaStorage.teardown(**teardown_params)
elif request.param == 'vineyard':
vineyard_size = '256M'
vineyard_socket = '/tmp/vineyard.sock'
params, teardown_params = await VineyardStorage.setup(
vineyard_size=vineyard_size,
vineyard_socket=vineyard_socket)
vineyard_size=vineyard_size)
storage = VineyardStorage(**params)
assert storage.level == StorageLevel.MEMORY

Expand Down
22 changes: 13 additions & 9 deletions mars/storage/vineyard.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,17 @@ async def setup(cls, **kwargs) -> Tuple[Dict, Dict]:
raise TypeError(f'VineyardStorage got unexpected config: {",".join(kwargs)}')

vineyard_size = calc_size_by_str(vineyard_size, virtual_memory().total)
vineyard_store = vineyard.deploy.local.start_vineyardd(
etcd_endpoints,
vineyardd_path,
vineyard_size,
vineyard_socket,
rpc=False)
vineyard_socket = (await loop.run_in_executor(
None, vineyard_store.__enter__))[1]
if vineyard_socket is not None: # pragma: no cover
vineyard_store = None
else:
vineyard_store = vineyard.deploy.local.start_vineyardd(
etcd_endpoints,
vineyardd_path,
vineyard_size,
vineyard_socket,
rpc=False)
vineyard_socket = (await loop.run_in_executor(
None, vineyard_store.__enter__))[1]
init_params = dict(vineyard_size=vineyard_size,
vineyard_socket=vineyard_socket)
teardown_params = dict(vineyard_store=vineyard_store)
Expand All @@ -144,7 +147,8 @@ async def setup(cls, **kwargs) -> Tuple[Dict, Dict]:
@implements(StorageBackend.teardown)
async def teardown(**kwargs):
vineyard_store = kwargs.get('vineyard_store')
vineyard_store.__exit__(None, None, None)
if vineyard_store is not None:
vineyard_store.__exit__(None, None, None)

@property
@implements(StorageBackend.level)
Expand Down