Skip to content

Commit

Permalink
server improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
latentvector committed Oct 12, 2024
1 parent 2b6056a commit 6f90a38
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions commune/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from functools import partial
# set the module functions as globals


# for f in :
# globals()[f] = getattr(Module, f)
c = Block = Lego = M = Module # alias c.Module as c.Block, c.Lego, c.M
Expand Down
14 changes: 7 additions & 7 deletions commune/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
import os
import asyncio




class Server(c.Module):
network : str = 'local'

Expand Down Expand Up @@ -97,10 +94,14 @@ def __del__(self):

@classmethod
def fleet(cls, module, n:int = 1, **kwargs):
futures = []
for _ in range(n):
c.print(c.serve(module=module, name = module + '::' + str(_), **kwargs))

return {'success':True, 'message':f'Served {n} servers'}
future = c.submit(c.serve, dict(module=module, name = module + '::' + str(_), **kwargs))
futures.append(future)
for future in c.as_completed(futures):
c.print(future.result())
return {'success':True, 'message':f'Served {n} servers', 'namespace': c.namespace()}



Expand Down Expand Up @@ -478,8 +479,7 @@ def get_server_info(self , module,**kwargs ) -> Dict[str, Any]:
info['key'] = module.key.ss58_address
return info

def get_server_schema(self,
module) -> 'Schema':
def get_server_schema(self, module) -> 'Schema':
schema = {}
functions = []
for k in self.functions_attributes:
Expand Down

0 comments on commit 6f90a38

Please sign in to comment.