wy_qcos.db.utils package
Submodules
wy_qcos.db.utils.db_utils module
- wy_qcos.db.utils.db_utils.set_db_engine(engine)
Set db engine.
- wy_qcos.db.utils.db_utils.get_db_engine()
Get db engine.
- 返回:
Database engine instance or None if not initialized
- wy_qcos.db.utils.db_utils.get_db_session(request)
Get db session.
- 参数:
request (HTTPConnection)
- 返回类型:
Session
- wy_qcos.db.utils.db_utils.get_repository(repo)
Return database repository object, which contains operation function.
- 参数:
repo (type[BaseRepository])
- wy_qcos.db.utils.db_utils.create_db_session(db_engine)
- wy_qcos.db.utils.db_utils.get_db_filters(auth_data, filters={}, allow_super_admin=False, allow_project_admin=False)
Get db filters.
- 参数:
auth_data -- auth data
filters -- jsonrpc filters
allow_super_admin -- allow super admin to query all resources
allow_project_admin -- allow project admin to query resources in project
- 返回:
db filters
- wy_qcos.db.utils.db_utils.run_callbacks(job_id, db_engine, job_status, backend, results, callbacks, user={})
Run callbacks.
- 参数:
job_id -- job id
db_engine -- db_engine
job_status -- job status
backend -- backend
results -- results
callbacks -- callbacks
user -- user related info
- async wy_qcos.db.utils.db_utils.db_job_callback(flow, flow_run, state, results=None, is_run_callbacks=True)
Job callback.
- 参数:
flow -- flow
flow_run -- flow run
state -- flow state
results -- flow results
is_run_callbacks -- whether run callbacks or not
- wy_qcos.db.utils.db_utils.db_update_job(job_id, db_engine, job_status=None, progress=None, job_results=None, started_at=None, ended_at=None, is_callback_success=None)
Update job fields in database.
- 参数:
job_id -- job ID
db_engine -- database engine instance
job_status (str | None) -- optional, job status to set (e.g., RUNNING)
progress (int | None) -- optional, job progress (-1, 0-100) or None if not set
job_results (SetJobResultsRequest | None) -- optional, job_results or None if not set
started_at (str | None) -- optional, job start time in ISO format or None if not set
ended_at -- optional, job end time or None if not set
is_callback_success -- optional, is_callback_success or None if not set
- 返回:
True if successful, False otherwise