SDK¶
aana.sdk.AanaSDK
¶
Aana SDK to deploy and manage Aana deployments and endpoints.
PARAMETER | DESCRIPTION |
---|---|
name |
The name of the application. Defaults to "app".
TYPE:
|
migration_func |
The migration function to run. Defaults to None.
TYPE:
|
retryable_exceptions |
The exceptions that can be retried in the task queue. Defaults to ['InferenceException', 'ActorDiedError', 'OutOfMemoryError'].
TYPE:
|
Source code in aana/sdk.py
connect
¶
connect(port=8000, host='127.0.0.1', address='auto', dashboard_host='127.0.0.1', dashboard_port=8265, show_logs=False, num_cpus=None, num_gpus=None)
Connect to a Ray cluster or start a new Ray cluster and Ray Serve.
PARAMETER | DESCRIPTION |
---|---|
port |
The port to run the Aana server on. Defaults to 8000.
TYPE:
|
host |
The host to run the Aana server on. Defaults to "127.0.0.1".
TYPE:
|
address |
The address of the Ray cluster. Defaults to "auto".
TYPE:
|
dashboard_host |
The host to bind the dashboard server to. Can either be localhost (127.0.0.1) or 0.0.0.0 (available from all interfaces). By default, this is set to localhost to prevent access from external machines.
TYPE:
|
dashboard_port |
The port to bind the dashboard server to. Defaults to 8265.
TYPE:
|
show_logs |
If True, the logs will be shown, otherwise they will be hidden but can be accessed in the Ray dashboard. Defaults to False.
TYPE:
|
num_cpus |
Number of CPUs the user wishes to assign to each raylet. By default, this is set based on virtual cores.
TYPE:
|
num_gpus |
Number of GPUs the user wishes to assign to each raylet. By default, this is set based on detected GPUs.
TYPE:
|
Source code in aana/sdk.py
migrate
¶
Run Alembic migrations.
Source code in aana/sdk.py
print_app_status
¶
Show the status of the application using simple ASCII formatting.
PARAMETER | DESCRIPTION |
---|---|
app_name |
The name of the application.
TYPE:
|
app_status |
The status of the application.
TYPE:
|
Source code in aana/sdk.py
add_task_queue
¶
Add a task queue deployment.
PARAMETER | DESCRIPTION |
---|---|
deploy |
If True, the deployment will be deployed immediately, otherwise it will be registered and can be deployed later when deploy() is called. Defaults to False.
TYPE:
|
Source code in aana/sdk.py
register_deployment
¶
Register a deployment.
PARAMETER | DESCRIPTION |
---|---|
name |
The name of the deployment.
TYPE:
|
instance |
The instance of the deployment to be registered.
TYPE:
|
deploy |
If True, the deployment will be deployed immediately, otherwise it will be registered and can be deployed later when deploy() is called. Defaults to False.
TYPE:
|
Source code in aana/sdk.py
get_deployment_app
¶
Get the application instance for the deployment.
PARAMETER | DESCRIPTION |
---|---|
name |
The name of the deployment.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Application
|
The application instance for the deployment.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
KeyError
|
If the deployment is not found. |
Source code in aana/sdk.py
unregister_deployment
¶
Unregister a deployment.
PARAMETER | DESCRIPTION |
---|---|
name |
The name of the deployment to be unregistered.
TYPE:
|
get_main_app
¶
Get the main application instance.
RETURNS | DESCRIPTION |
---|---|
Application
|
The main application instance.
TYPE:
|
Source code in aana/sdk.py
register_endpoint
¶
register_endpoint(name, path, summary, endpoint_cls, admin_required=False, active_subscription_required=False, defer_option=DeferOption.OPTIONAL, event_handlers=None)
Register an endpoint.
PARAMETER | DESCRIPTION |
---|---|
name |
The name of the endpoint.
TYPE:
|
path |
The path of the endpoint.
TYPE:
|
summary |
The summary of the endpoint.
TYPE:
|
endpoint_cls |
The class of the endpoint.
TYPE:
|
admin_required |
If True, the endpoint requires admin access. Defaults to False.
TYPE:
|
active_subscription_required |
If True, the endpoint requires an active subscription. Defaults to False.
TYPE:
|
defer_option |
Defer option for the endpoint (always, never, optional).
TYPE:
|
event_handlers |
The event handlers to register for the endpoint.
TYPE:
|
Source code in aana/sdk.py
unregister_endpoint
¶
Unregister an endpoint.
PARAMETER | DESCRIPTION |
---|---|
name |
The name of the endpoint to be unregistered.
TYPE:
|
register_router
¶
Register a FastAPI router.
PARAMETER | DESCRIPTION |
---|---|
name |
The name of the router.
TYPE:
|
router |
The instance of the APIRouter to be registered.
TYPE:
|
unregister_router
¶
Unregister a FastAPI router.
PARAMETER | DESCRIPTION |
---|---|
name |
The name of the router to be unregistered.
TYPE:
|
wait_for_deployment
¶
Wait for the deployment to complete.
Source code in aana/sdk.py
deploy
¶
Deploy the application with the registered endpoints and deployments.
PARAMETER | DESCRIPTION |
---|---|
blocking |
If True, the function will block until interrupted. Defaults to False.
TYPE:
|
sequential |
If True, the deployments will be deployed sequentially. Defaults to False.
TYPE:
|
Source code in aana/sdk.py
shutdown
¶
build
¶
Build the application configuration file.
Two files will be created: app_config (.py) and config (.yaml).s
PARAMETER | DESCRIPTION |
---|---|
import_path |
The import path of the application.
TYPE:
|
host |
The host to run the application on. Defaults to "0.0.0.0".
TYPE:
|
port |
The port to run the application on. Defaults to 8000.
TYPE:
|
app_config_name |
The name of the application config file. Defaults to "app_config".
TYPE:
|
config_name |
The name of the config file. Defaults to "config".
TYPE:
|
Source code in aana/sdk.py
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 |
|