master: shorten RPC target names

This commit is contained in:
Sébastien Bourdeauducq 2024-02-27 15:20:48 +08:00
parent 3609f95207
commit 92eb3947a4
6 changed files with 15 additions and 15 deletions

View File

@ -255,7 +255,7 @@ class SimpleApplet:
if self.embed is None: if self.embed is None:
dataset_ctl = RPCClient() dataset_ctl = RPCClient()
self.loop.run_until_complete(dataset_ctl.connect_rpc( self.loop.run_until_complete(dataset_ctl.connect_rpc(
self.args.server, self.args.port_control, "master_dataset_db")) self.args.server, self.args.port_control, "dataset_db"))
self.req = AppletRequestRPC(self.loop, dataset_ctl) self.req = AppletRequestRPC(self.loop, dataset_ctl)
else: else:
self.req = AppletRequestIPC(self.ipc) self.req = AppletRequestIPC(self.ipc)

View File

@ -33,7 +33,7 @@ class DatasetCtl:
try: try:
remote = RPCClient() remote = RPCClient()
await remote.connect_rpc(self.master_host, self.master_port, await remote.connect_rpc(self.master_host, self.master_port,
"master_dataset_db") "dataset_db")
try: try:
if op_name == "set": if op_name == "set":
await remote.set(key_or_mod, value, persist, metadata) await remote.set(key_or_mod, value, persist, metadata)

View File

@ -127,7 +127,7 @@
"# let's connect to the master\n", "# let's connect to the master\n",
"\n", "\n",
"schedule, exps, datasets = [\n", "schedule, exps, datasets = [\n",
" Client(\"::1\", 3251, \"master_\" + i) for i in\n", " Client(\"::1\", 3251, i) for i in\n",
" \"schedule experiment_db dataset_db\".split()]\n", " \"schedule experiment_db dataset_db\".split()]\n",
"\n", "\n",
"print(\"current schedule\")\n", "print(\"current schedule\")\n",

View File

@ -343,13 +343,13 @@ def main():
else: else:
port = 3251 if args.port is None else args.port port = 3251 if args.port is None else args.port
target_name = { target_name = {
"submit": "master_schedule", "submit": "schedule",
"delete": "master_schedule", "delete": "schedule",
"set_dataset": "master_dataset_db", "set_dataset": "dataset_db",
"del_dataset": "master_dataset_db", "del_dataset": "dataset_db",
"scan_devices": "master_device_db", "scan_devices": "device_db",
"scan_repository": "master_experiment_db", "scan_repository": "experiment_db",
"ls": "master_experiment_db", "ls": "experiment_db",
"terminate": "master_management", "terminate": "master_management",
}[action] }[action]
remote = Client(args.server, port, target_name) remote = Client(args.server, port, target_name)

View File

@ -143,7 +143,7 @@ def main():
for target in "schedule", "experiment_db", "dataset_db", "device_db": for target in "schedule", "experiment_db", "dataset_db", "device_db":
client = AsyncioClient() client = AsyncioClient()
loop.run_until_complete(client.connect_rpc( loop.run_until_complete(client.connect_rpc(
args.server, args.port_control, "master_" + target)) args.server, args.port_control, target))
atexit.register(client.close_rpc) atexit.register(client.close_rpc)
rpc_clients[target] = client rpc_clients[target] = client

View File

@ -133,10 +133,10 @@ def main():
server_control = RPCServer({ server_control = RPCServer({
"master_management": master_management, "master_management": master_management,
"master_device_db": device_db, "device_db": device_db,
"master_dataset_db": dataset_db, "dataset_db": dataset_db,
"master_schedule": scheduler, "schedule": scheduler,
"master_experiment_db": experiment_db, "experiment_db": experiment_db,
}, allow_parallel=True) }, allow_parallel=True)
loop.run_until_complete(server_control.start( loop.run_until_complete(server_control.start(
bind, args.port_control)) bind, args.port_control))