Skip to content

Commit

Permalink
Pass the current builder to the async put thread.
Browse files Browse the repository at this point in the history
Signed-off-by: Ye Cao <[email protected]>
  • Loading branch information
dashanji committed Nov 19, 2024
1 parent cdffb5b commit 8c1cc29
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion python/vineyard/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
from vineyard._C import VineyardException
from vineyard._C import _connect
from vineyard.core.builder import BuilderContext
from vineyard.core.builder import get_current_builders
from vineyard.core.builder import put
from vineyard.core.resolver import ResolverContext
from vineyard.core.resolver import get
Expand Down Expand Up @@ -881,16 +882,19 @@ def put(
**kwargs,
):
if as_async:

def _default_callback(future):
try:
result = future.result()
print(f"Successfully put object {result}", flush=True)
except Exception as e:
print(f"Failed to put object: {e}", flush=True)

current_builder = builder or get_current_builders()

thread_pool = self.put_thread_pool
result = thread_pool.submit(
self._put_internal, value, builder, persist, name, **kwargs
self._put_internal, value, current_builder, persist, name, **kwargs
)
result.add_done_callback(_default_callback)
return result
Expand Down

0 comments on commit 8c1cc29

Please sign in to comment.