|
26 | 26 | create_route_description, |
27 | 27 | ) |
28 | 28 |
|
| 29 | +_ASYNC_JOB_CLIENT_NAME = "API_SERVER" |
| 30 | + |
29 | 31 | router = APIRouter() |
30 | 32 | _logger = logging.getLogger(__name__) |
31 | 33 |
|
32 | 34 |
|
33 | 35 | def _get_job_id_data(user_id: UserID, product_name: ProductName) -> AsyncJobFilter: |
34 | | - return AsyncJobFilter(user_id=user_id, product_name=product_name) |
| 36 | + return AsyncJobFilter( |
| 37 | + user_id=user_id, product_name=product_name, client_name=_ASYNC_JOB_CLIENT_NAME |
| 38 | + ) |
35 | 39 |
|
36 | 40 |
|
37 | 41 | _DEFAULT_TASK_STATUS_CODES: dict[int | str, dict[str, Any]] = { |
@@ -61,7 +65,7 @@ async def list_tasks( |
61 | 65 | async_jobs: Annotated[AsyncJobClient, Depends(get_async_jobs_client)], |
62 | 66 | ): |
63 | 67 | user_async_jobs = await async_jobs.list_jobs( |
64 | | - job_id_data=_get_job_id_data(user_id, product_name), |
| 68 | + job_filter=_get_job_id_data(user_id, product_name), |
65 | 69 | filter_="", |
66 | 70 | ) |
67 | 71 | app_router = app.router |
@@ -102,7 +106,7 @@ async def get_task_status( |
102 | 106 | ): |
103 | 107 | async_job_rpc_status = await async_jobs.status( |
104 | 108 | job_id=task_id, |
105 | | - job_id_data=_get_job_id_data(user_id, product_name), |
| 109 | + job_filter=_get_job_id_data(user_id, product_name), |
106 | 110 | ) |
107 | 111 | _task_id = f"{async_job_rpc_status.job_id}" |
108 | 112 | return TaskStatus( |
@@ -134,7 +138,7 @@ async def cancel_task( |
134 | 138 | ): |
135 | 139 | await async_jobs.cancel( |
136 | 140 | job_id=task_id, |
137 | | - job_id_data=_get_job_id_data(user_id, product_name), |
| 141 | + job_filter=_get_job_id_data(user_id, product_name), |
138 | 142 | ) |
139 | 143 |
|
140 | 144 |
|
@@ -168,6 +172,6 @@ async def get_task_result( |
168 | 172 | ): |
169 | 173 | async_job_rpc_result = await async_jobs.result( |
170 | 174 | job_id=task_id, |
171 | | - job_id_data=_get_job_id_data(user_id, product_name), |
| 175 | + job_filter=_get_job_id_data(user_id, product_name), |
172 | 176 | ) |
173 | 177 | return TaskResult(result=async_job_rpc_result.result, error=None) |
0 commit comments