@@ -33,14 +33,19 @@ def __init__(
3333 dual = False ,
3434 hub_id = None ,
3535 path = "/mcp" ,
36+ mock = False ,
3637 ):
38+ # Probably can simplify some of this between worker and hub
3739 self .mcp = mcp
3840 self .host = host
3941 self .port = port
4042 self .path = path
4143 self .secret = secret or secrets .token_urlsafe (32 )
4244 self .workers : Dict [str , Dict [str , Any ]] = {}
43- self .hub_id = hub_id or socket .gethostname ()
45+
46+ # For use if we are also a worker.
47+ self .worker_id = hub_id or socket .gethostname ()
48+ self .mock = mock
4449
4550 # Make requests to hub in batches, in serial, or in parallel
4651 self .set_running_mode (batch , serial , dual )
@@ -103,6 +108,7 @@ def from_args(cls, mcp, args) -> Optional["HubManager"]:
103108 batch = args .batch ,
104109 serial = args .serial ,
105110 dual = args .dual ,
111+ mock = args .mock ,
106112 # server path
107113 path = args .path ,
108114 )
@@ -397,12 +403,13 @@ def __init__(self, *args, **kwargs):
397403 # Calls super on the HubManager. WorkerBase has no init
398404 super ().__init__ (* args , ** kwargs )
399405 self .setup_dual ()
406+ self .init_providers (kwargs .get ("mock" , False ))
400407
401408 def setup_dual (self ):
402409 """
403410 Setup dual mode, which means adding ourselves to the fleet.
404411 """
405- hub_id = self .hub_id or socket .gethostname ()
412+ hub_id = self .worker_id or socket .gethostname ()
406413 default_url = f"http://{ self .host } :{ self .port } { self .path } "
407414 self .workers [hub_id ] = {
408415 "url" : self .registration_url ,
0 commit comments