taskiq_dashboard
¶
TaskiqDashboard
¶
TaskiqDashboard(
api_token,
storage_type='sqlite',
database_dsn='sqlite+aiosqlite:///taskiq_dashboard.db',
broker=None,
scheduler=None,
**uvicorn_kwargs,
)
Initialize Taskiq Dashboard application.
Parameters:
-
api_token(str) –Access token for securing the dashboard API.
-
storage_type(str, default:'sqlite') –Type of the storage backend ('sqlite' or 'postgres').
-
database_dsn(str, default:'sqlite+aiosqlite:///taskiq_dashboard.db') –URL for the database.
-
broker(AsyncBroker | None, default:None) –Optional Taskiq broker instance to integrate with the dashboard.
-
scheduler(TaskiqScheduler | None, default:None) –Optional Taskiq scheduler instance to integrate with the dashboard.
-
uvicorn_kwargs(Any, default:{}) –Additional keyword arguments to pass to uvicorn.
Source code in taskiq_dashboard/interface/application.py
run
¶
api
¶
application
¶
lifespan
async
¶
Source code in taskiq_dashboard/api/application.py
get_application
¶
Source code in taskiq_dashboard/api/application.py
middlewares
¶
AccessTokenMiddleware
¶
Bases: BaseHTTPMiddleware
dispatch
async
¶
Source code in taskiq_dashboard/api/middlewares.py
routers
¶
action_router
module-attribute
¶
event_router
module-attribute
¶
schedule_router
module-attribute
¶
system_router
module-attribute
¶
task_router
module-attribute
¶
action
¶
router
module-attribute
¶
handle_task_run
async
¶
Source code in taskiq_dashboard/api/routers/action.py
handle_task_rerun
async
¶
Source code in taskiq_dashboard/api/routers/action.py
handle_task_delete
async
¶
Source code in taskiq_dashboard/api/routers/action.py
event
¶
router
module-attribute
¶
handle_task_event
async
¶
Handle task events from TaskiqAdminMiddleware.
This endpoint receives task events such as 'queued', 'started', and 'executed' from the TaskiqAdminMiddleware. It processes the event based on the task ID and event type.
Parameters:
-
task_id(UUID) –The unique identifier of the task.
-
event(Literal['queued', 'started', 'executed']) –The type of event (e.g., 'queued', 'started', 'executed').
Source code in taskiq_dashboard/api/routers/event.py
schedule
¶
router
module-attribute
¶
ScheduleFilter
¶
handle_schedule_list
async
¶
Source code in taskiq_dashboard/api/routers/schedule.py
handle_schedule_details
async
¶
Source code in taskiq_dashboard/api/routers/schedule.py
system
¶
task
¶
TaskFilter
¶
Bases: BaseModel
validate_status
classmethod
¶
Source code in taskiq_dashboard/api/routers/task.py
search_tasks
async
¶
Source code in taskiq_dashboard/api/routers/task.py
task_details
async
¶
Display detailed information for a specific task.
Source code in taskiq_dashboard/api/routers/task.py
dependencies
¶
TaskiqDashboardProvider
¶
Bases: Provider
Source code in taskiq_dashboard/dependencies.py
provide_settings
¶
provide_session_provider
async
¶
Source code in taskiq_dashboard/dependencies.py
provide_task_service
¶
Source code in taskiq_dashboard/dependencies.py
provide_schema_service
¶
Source code in taskiq_dashboard/dependencies.py
infrastructure
¶
APISettings
¶
Bases: BaseSettings
PostgresSettings
¶
Bases: BaseSettings
Настройки для подключения к PostgreSQL.
dsn
property
¶
Возвращает строку подключения к PostgreSQL составленную из параметров класса.
Пример использования с asyncpg:
>>> import asyncpg
>>> async def create_pool(settings: PostgresSettings) -> asyncpg.pool.Pool:
>>> return await asyncpg.create_pool(
>>> dsn=settings.postgres.dsn.get_secret_value(),
>>> min_size=settings.postgres.min_size,
>>> max_size=settings.postgres.max_size,
>>> statement_cache_size=settings.postgres.statement_cache_size,
>>> )
Пример использования с SQLAlchemy:
>>> import sqlalchemy
>>> async def create_pool(settings: PostgresSettings) -> sqlalchemy.ext.asyncio.AsyncEngine:
>>> return sqlalchemy.ext.asyncio.create_async_engine(
>>> settings.postgres.dsn.get_secret_value()
>>> )
Settings
¶
Bases: BaseSettings
SqliteSettings
¶
get_settings
cached
¶
database
¶
schemas
¶
sa_metadata
module-attribute
¶
sa_metadata = MetaData(
naming_convention={
'ix': 'ix_%(column_0_label)s',
'uq': 'uq_%(table_name)s_%(column_0_name)s',
'ck': 'ck_%(table_name)s_%(constraint_name)s',
'fk': 'fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s',
'pk': 'pk_%(table_name)s',
}
)
BaseTableSchema
¶
PostgresTask
¶
Bases: BaseTableSchema
id
class-attribute
instance-attribute
¶
id = mapped_column(
UUID(as_uuid=True), primary_key=True, default=uuid4
)
kwargs
class-attribute
instance-attribute
¶
labels
class-attribute
instance-attribute
¶
result
class-attribute
instance-attribute
¶
queued_at
class-attribute
instance-attribute
¶
queued_at = mapped_column(
DateTime(timezone=True), nullable=False, default=now
)
started_at
class-attribute
instance-attribute
¶
finished_at
class-attribute
instance-attribute
¶
SqliteTask
¶
Bases: BaseTableSchema
id
class-attribute
instance-attribute
¶
id = mapped_column(
Uuid(as_uuid=True), primary_key=True, default=uuid4
)
kwargs
class-attribute
instance-attribute
¶
labels
class-attribute
instance-attribute
¶
result
class-attribute
instance-attribute
¶
queued_at
class-attribute
instance-attribute
¶
queued_at = mapped_column(
DateTime(timezone=True), nullable=False, default=now
)
started_at
class-attribute
instance-attribute
¶
finished_at
class-attribute
instance-attribute
¶
session_provider
¶
AsyncPostgresSessionProvider
¶
Source code in taskiq_dashboard/infrastructure/database/session_provider.py
session
async
¶
Create and manage a new AsyncSession.
Usage
async with repository.session() as session: # use session for database operations result = await session.execute(...)
Source code in taskiq_dashboard/infrastructure/database/session_provider.py
services
¶
schema_service
¶
SchemaService
¶
Bases: AbstractSchemaService
Source code in taskiq_dashboard/infrastructure/services/schema_service.py
create_schema
async
¶
Source code in taskiq_dashboard/infrastructure/services/schema_service.py
task_service
¶
TaskRepository
¶
Bases: AbstractTaskRepository
Source code in taskiq_dashboard/infrastructure/services/task_service.py
find_tasks
async
¶
Source code in taskiq_dashboard/infrastructure/services/task_service.py
get_task_by_id
async
¶
Source code in taskiq_dashboard/infrastructure/services/task_service.py
create_task
async
¶
Source code in taskiq_dashboard/infrastructure/services/task_service.py
update_task
async
¶
Source code in taskiq_dashboard/infrastructure/services/task_service.py
batch_update
async
¶
Source code in taskiq_dashboard/infrastructure/services/task_service.py
delete_task
async
¶
Source code in taskiq_dashboard/infrastructure/services/task_service.py
settings
¶
PostgresSettings
¶
Bases: BaseSettings
Настройки для подключения к PostgreSQL.
dsn
property
¶
Возвращает строку подключения к PostgreSQL составленную из параметров класса.
Пример использования с asyncpg:
>>> import asyncpg
>>> async def create_pool(settings: PostgresSettings) -> asyncpg.pool.Pool:
>>> return await asyncpg.create_pool(
>>> dsn=settings.postgres.dsn.get_secret_value(),
>>> min_size=settings.postgres.min_size,
>>> max_size=settings.postgres.max_size,
>>> statement_cache_size=settings.postgres.statement_cache_size,
>>> )
Пример использования с SQLAlchemy:
>>> import sqlalchemy
>>> async def create_pool(settings: PostgresSettings) -> sqlalchemy.ext.asyncio.AsyncEngine:
>>> return sqlalchemy.ext.asyncio.create_async_engine(
>>> settings.postgres.dsn.get_secret_value()
>>> )
SqliteSettings
¶
APISettings
¶
Bases: BaseSettings
Settings
¶
Bases: BaseSettings
interface
¶
application
¶
TaskiqDashboard
¶
TaskiqDashboard(
api_token,
storage_type='sqlite',
database_dsn='sqlite+aiosqlite:///taskiq_dashboard.db',
broker=None,
scheduler=None,
**uvicorn_kwargs,
)
Initialize Taskiq Dashboard application.
Parameters:
-
api_token(str) –Access token for securing the dashboard API.
-
storage_type(str, default:'sqlite') –Type of the storage backend ('sqlite' or 'postgres').
-
database_dsn(str, default:'sqlite+aiosqlite:///taskiq_dashboard.db') –URL for the database.
-
broker(AsyncBroker | None, default:None) –Optional Taskiq broker instance to integrate with the dashboard.
-
scheduler(TaskiqScheduler | None, default:None) –Optional Taskiq scheduler instance to integrate with the dashboard.
-
uvicorn_kwargs(Any, default:{}) –Additional keyword arguments to pass to uvicorn.