-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpipeline_runtime.py
118 lines (87 loc) · 2.75 KB
/
pipeline_runtime.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
"""
Author(s):
Kamil Vojanec <[email protected]>
Dominik Tran <[email protected]>
Copyright: (C) 2024 CESNET, z.s.p.o.
Define interface for accessing pipeline runtime of (DPDK) application.
"""
from abc import ABC, abstractmethod
class PipelineRuntime(ABC):
"""Interface for accessing pipeline runtime."""
@abstractmethod
def get_pid(self):
pass
@abstractmethod
def get_pipeline_names(self) -> list[str]:
pass
@abstractmethod
def get_worker_status(self, worker_id: int, name: str = None):
"""Obtain worker's status in the selected pipeline.
Parameters
----------
worker_id: int
Numerical ID (starting from 0) of a worker in the selected pipeline.
name : str, optional
Name of the pipeline (default is the first pipeline).
"""
pass
@abstractmethod
def get_workers_count(self, name: str = None):
"""Obtain count of workers of the selected pipeline.
Parameters
----------
name : str, optional
Name of the pipeline (default is the first pipeline).
"""
pass
@abstractmethod
def get_pipeline_stage_names(self, name: str = None) -> list[str]:
"""Obtain list of stage names of the selected pipeline.
Parameters
----------
name : str, optional
Name of the pipeline (default is the first pipeline).
"""
pass
@abstractmethod
def wait_until_active(self, timeout=5):
pass
@abstractmethod
def get_worker_chain_status(self, worker_id: int, name: str = None) -> dict:
"""Obtain worker's chain status in the selected pipeline.
Parameters
----------
worker_id: int
Numerical ID (starting from 0) of a worker in the selected pipeline.
name : str, optional
Name of the pipeline (default is the first pipeline).
"""
pass
@abstractmethod
def get_stats(self) -> dict:
"""Obtain pipeline's statistics across all ports.
Returns
-------
dict
Dictionary with aggregated port statistics.
"""
pass
@abstractmethod
def get_xstats(self) -> dict:
"""Obtain pipeline's extended statistics across all ports.
Returns
-------
dict
Dictionary with aggregated port statistics.
"""
pass
@abstractmethod
def get_mempool_stats(self) -> list[dict]:
"""Obtain statistics of mempools in the underlying application if any.
Each mempool is identified by a unique name.
Returns
-------
list
List of mempool statistics (each is a directory).
"""
pass