"vscode:/vscode.git/clone" did not exist on "70362e4b1fc89a7522aee982d29fd923fff59073"
run.py 651 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import asyncio
import random
import string

import uvloop
from client import init as client_init
from server import init as server_init
from triton_distributed_rs import DistributedRuntime, triton_worker


def random_string(length=10):
    chars = string.ascii_letters + string.digits  # a-z, A-Z, 0-9
    return "".join(random.choices(chars, k=length))


@triton_worker()
async def worker(runtime: DistributedRuntime):
    ns = random_string()
    task = asyncio.create_task(server_init(runtime, ns))
    await client_init(runtime, ns)
    runtime.shutdown()
    await task


if __name__ == "__main__":
    uvloop.install()
    asyncio.run(worker())