|
9 | 9 | from data_rentgen.server.errors.schemas.invalid_request import InvalidRequestSchema |
10 | 10 | from data_rentgen.server.errors.schemas.not_authorized import NotAuthorizedRedirectSchema, NotAuthorizedSchema |
11 | 11 | from data_rentgen.server.schemas.v1 import ( |
12 | | - JobDependenciesQueryV1, |
13 | | - JobDependenciesRelationsV1, |
14 | | - JobDependenciesResponseV1, |
15 | 12 | JobDetailedResponseV1, |
| 13 | + JobHierarchyQueryV1, |
| 14 | + JobHierarchyRelationsV1, |
| 15 | + JobHierarchyResponseV1, |
16 | 16 | JobLineageQueryV1, |
17 | 17 | JobPaginateQueryV1, |
18 | 18 | JobResponseV1, |
@@ -57,7 +57,7 @@ async def paginate_jobs( |
57 | 57 | return PageResponseV1[JobDetailedResponseV1].from_pagination(pagination) |
58 | 58 |
|
59 | 59 |
|
60 | | -@router.get("/lineage", summary="Get Job lineage graph") |
| 60 | +@router.get("/lineage", summary="Get Job lineage graph", tags=["Lineage"]) |
61 | 61 | async def get_jobs_lineage( |
62 | 62 | query_args: Annotated[JobLineageQueryV1, Query()], |
63 | 63 | lineage_service: Annotated[LineageService, Depends()], |
@@ -85,39 +85,39 @@ async def get_job_types( |
85 | 85 | return JobTypesResponseV1(job_types=list(job_types)) |
86 | 86 |
|
87 | 87 |
|
88 | | -@router.get("/dependencies", summary="Get ancestors and descendans of the Jobs") |
89 | | -async def get_job_dependencies( |
90 | | - query_args: Annotated[JobDependenciesQueryV1, Depends()], |
| 88 | +@router.get("/hierarchy", summary="Get ancestors and descendans of the Jobs", tags=["Hierarchy"]) |
| 89 | +async def get_job_hierarchy( |
| 90 | + query_args: Annotated[JobHierarchyQueryV1, Depends()], |
91 | 91 | job_service: Annotated[JobService, Depends()], |
92 | 92 | current_user: Annotated[User, Depends(get_user())], |
93 | | -) -> JobDependenciesResponseV1: |
94 | | - job_dependencies = await job_service.get_job_dependencies( |
| 93 | +) -> JobHierarchyResponseV1: |
| 94 | + job_hierarchy = await job_service.get_jobs_hierarchy( |
95 | 95 | start_node_id=query_args.start_node_id, |
96 | 96 | direction=query_args.direction, |
97 | 97 | depth=query_args.depth, |
98 | 98 | ) |
99 | | - return JobDependenciesResponseV1( |
100 | | - relations=JobDependenciesRelationsV1( |
| 99 | + return JobHierarchyResponseV1( |
| 100 | + relations=JobHierarchyRelationsV1( |
101 | 101 | parents=[ |
102 | 102 | JobParentEntityRelationV1( |
103 | 103 | from_=JobEntityV1(id=str(from_id)), |
104 | 104 | to=JobEntityV1(id=str(to_id)), |
105 | 105 | ) |
106 | | - for from_id, to_id in sorted(job_dependencies.parents) |
| 106 | + for from_id, to_id in sorted(job_hierarchy.parents) |
107 | 107 | ], |
108 | 108 | dependencies=[ |
109 | 109 | JobDependencyV1( |
110 | 110 | from_=JobEntityV1(id=str(from_id)), |
111 | 111 | to=JobEntityV1(id=str(to_id)), |
112 | 112 | type_=type_, |
113 | 113 | ) |
114 | | - for from_id, to_id, type_ in sorted(job_dependencies.dependencies) |
| 114 | + for from_id, to_id, type_ in sorted(job_hierarchy.dependencies) |
115 | 115 | ], |
116 | 116 | ), |
117 | 117 | nodes={ |
118 | 118 | "jobs": { |
119 | 119 | str(job.id): JobResponseV1.model_validate(job.data) |
120 | | - for job in sorted(job_dependencies.jobs, key=lambda item: item.id) |
| 120 | + for job in sorted(job_hierarchy.jobs, key=lambda item: item.id) |
121 | 121 | } |
122 | 122 | }, |
123 | 123 | ) |
0 commit comments