Coverage for /usr/local/lib/python3.12/site-packages/prefect/server/schemas/graph.py: 100%

37 statements  

« prev     ^ index     » next       coverage.py v7.10.6, created at 2025-12-05 10:48 +0000

1from typing import Any, List, Literal, Optional, Tuple 1a

2from uuid import UUID 1a

3 

4from prefect.server.schemas.states import StateType 1a

5from prefect.server.utilities.schemas import PrefectBaseModel 1a

6from prefect.types._datetime import DateTime 1a

7 

8 

9class GraphState(PrefectBaseModel): 1a

10 id: UUID 1a

11 timestamp: DateTime 1a

12 type: StateType 1a

13 name: str 1a

14 

15 

16class GraphArtifact(PrefectBaseModel): 1a

17 id: UUID 1a

18 created: DateTime 1a

19 key: Optional[str] 1a

20 type: Optional[str] 1a

21 is_latest: bool 1a

22 data: Optional[Any] # we only return data for progress artifacts for now 1a

23 

24 

25class Edge(PrefectBaseModel): 1a

26 id: UUID 1a

27 

28 

29class Node(PrefectBaseModel): 1a

30 kind: Literal["flow-run", "task-run"] 1a

31 id: UUID 1a

32 label: str 1a

33 state_type: StateType 1a

34 start_time: DateTime 1a

35 end_time: Optional[DateTime] 1a

36 parents: List[Edge] 1a

37 children: List[Edge] 1a

38 encapsulating: List[Edge] 1a

39 artifacts: List[GraphArtifact] 1a

40 

41 

42class Graph(PrefectBaseModel): 1a

43 start_time: Optional[DateTime] 1a

44 end_time: Optional[DateTime] 1a

45 root_node_ids: List[UUID] 1a

46 nodes: List[Tuple[UUID, Node]] 1a

47 artifacts: List[GraphArtifact] 1a

48 states: List[GraphState] 1a