-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
58 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
from examples import tasks | ||
from fluid.scheduler import TaskScheduler | ||
from fluid.utils import log | ||
from fluid.scheduler.cli import TaskManagerCLI | ||
|
||
task_manager = TaskScheduler() | ||
task_manager.register_from_module(tasks) | ||
task_manager_cli = task_manager.cli() | ||
task_manager_cli = TaskManagerCLI("examples.tasks:task_app") | ||
|
||
|
||
if __name__ == "__main__": | ||
log.config(app_names=["fluid"]) | ||
task_manager_cli() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
"""Reusable server side python modules""" | ||
|
||
__version__ = "1.1.3" | ||
__version__ = "1.2.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,17 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Any, Callable | ||
|
||
import uvicorn | ||
from fastapi import FastAPI | ||
|
||
from fluid.utils import log | ||
from fluid.utils.worker import Workers | ||
|
||
from .service import FastapiAppWorkers | ||
|
||
|
||
def app_workers(app: FastAPI) -> Workers: | ||
"""Get workers from app state or create new workers.""" | ||
if workers := getattr(app.state, "workers", None): | ||
return workers | ||
else: | ||
workers = FastapiAppWorkers.setup(app) | ||
app.state.workers = workers | ||
return workers | ||
|
||
|
||
def serve_app( | ||
app: FastAPI | Callable[..., Any] | str, | ||
host: str, | ||
port: int, | ||
reload: bool = False, | ||
) -> None: | ||
uvicorn.run( | ||
app, | ||
port=port, | ||
host=host, | ||
log_level="info", | ||
reload=reload, | ||
log_config=log.config(), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters