You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to get one fiber, one worker, so i can use it to test some kvcache related things. I'm a little confused about how SystemManager works and what the order of events should be between sysman.start() and sysman.ls.create_worker()
From service.py, it looks like sysman.start() should be called by FastAPI AFTER the workers and fibers are created, but looking at SystemManager I had expected the opposite.
Naiively, I was expecting to have to make a system manager, fully initialize it, and then try to create workers from it, so:
Interestingly, sleeping between sysman.start and trying to create the worker works.
importshortfinassfimportloggingfromshortfin_apps.llm.components.managerimportSystemManager# Set up logginglogging.basicConfig(level=logging.INFO)
logger=logging.getLogger(__name__)
# Create and start system managerlogger.info("Creating system manager...")
sysman=SystemManager(device="local-task")
sysman.start()
try:
importtime# time.sleep(1) # if you don't sleep this hangs indefinitelylogger.info("Creating worker...")
worker=sysman.ls.create_worker("test-worker")
logger.info(f"Created worker: {worker}")
logger.info("Creating fiber...")
fiber=sysman.ls.create_fiber(worker)
logger.info(f"Created fiber: {fiber}")
logger.info("Available devices:")
logger.info(fiber.devices_dict)
device=list(fiber.devices_dict.values())[0]
logger.info(f"Using device: {device}")
input("Press Enter to exit...")
finally:
# Clean uplogger.info("Shutting down system manager...")
sysman.shutdown()
It looks like sysman.start and sysman.shutdown does some interfacing with fastapi (see the following snippet from server.py:
@asynccontextmanagerasyncdeflifespan(app: FastAPI):
system.start()
yieldprint("Shutting down shortfin")
system.shutdown()
system=System()
app=FastAPI(lifespan=lifespan)
and worker / fiber configuration happens BEFORE sysman.start should be called.
The text was updated successfully, but these errors were encountered:
I'm trying to get one fiber, one worker, so i can use it to test some kvcache related things. I'm a little confused about how SystemManager works and what the order of events should be between
sysman.start()
andsysman.ls.create_worker()
From service.py, it looks like
sysman.start()
should be called by FastAPI AFTER the workers and fibers are created, but looking at SystemManager I had expected the opposite.Naiively, I was expecting to have to make a system manager, fully initialize it, and then try to create workers from it, so:
but this hangs indefinitely.
If I just don't start the sysman, then everything works:
Interestingly, sleeping between sysman.start and trying to create the worker works.
It looks like sysman.start and sysman.shutdown does some interfacing with fastapi (see the following snippet from
server.py
:and worker / fiber configuration happens BEFORE sysman.start should be called.
The text was updated successfully, but these errors were encountered: