Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjoyo committed Apr 29, 2024
1 parent 1e1a2b1 commit 0a54b9a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bpm-ai-core/bpm_ai_core/util/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ def __init__(self, class_name, host, port, instance_args=None, instance_kwargs=N
self.instance_kwargs = instance_kwargs or {}

def __getattr__(self, name):
if name == '__slots__':
return ['class_name', 'host', 'port', 'instance_args', 'instance_kwargs']

async def remote_method(*args, **kwargs):
data = pickle.dumps((self.class_name, name, args, kwargs, self.instance_args, self.instance_kwargs))
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=600)) as session:
Expand All @@ -85,8 +88,12 @@ async def remote_method(*args, **kwargs):
else:
error_message = await response.text()
raise Exception(f"Remote method call failed: {error_message}")

return remote_method

def __str__(self):
return f"RemoteObjectProxy(class_name={self.class_name}, host={self.host}, port={self.port}, instance_args={self.instance_args}, instance_kwargs={self.instance_kwargs})"


def create_remote_object_daemon(
host='0.0.0.0',
Expand Down

0 comments on commit 0a54b9a

Please sign in to comment.