|
38 | 38 |
|
39 | 39 | class FormulaState(State):
|
40 | 40 | """
|
41 |
| - Formula Actor State |
| 41 | + State of the Formula actor. |
42 | 42 | """
|
43 | 43 |
|
44 |
| - def __init__(self, actor, pushers, formula_id=None): |
| 44 | + def __init__(self, actor, pushers): |
| 45 | + """ |
| 46 | + Initialize a new Formula actor state. |
| 47 | + :param actor: Actor linked to the state |
| 48 | + :param pushers: Pushers available for the actor |
| 49 | + """ |
45 | 50 | State.__init__(self, actor)
|
46 |
| - self.formula_id = formula_id |
47 | 51 | self.pushers = pushers
|
48 | 52 |
|
49 | 53 |
|
50 | 54 | class FormulaActor(Actor):
|
51 | 55 | """
|
52 |
| - Formula abstract class. A Formula is an Actor which use data |
53 |
| - for computing some new useful power estimation. |
54 |
| -
|
55 |
| - A Formula is design to be handle by a Dispatcher, and to send |
56 |
| - result to a Pusher. |
| 56 | + Formula actor abstract class. |
57 | 57 | """
|
58 | 58 |
|
59 | 59 | def __init__(self, name, pushers: Dict[str, PusherActor], level_logger=logging.WARNING, timeout=None):
|
60 | 60 | """
|
61 |
| - :param str name: Actor name |
62 |
| - :param Dict[str, powerapi.PusherActor] pushers: Pusher actors whom send |
63 |
| - results |
64 |
| - :param int level_logger: Define logger level |
65 |
| - :param bool timeout: Time in millisecond to wait |
66 |
| - for a message before called |
67 |
| - timeout_handler. |
| 61 | + Initialize a new Formula actor. |
| 62 | + :param name: Actor name |
| 63 | + :param pushers: Pusher actors |
| 64 | + :param level_logger: Level of the logger |
| 65 | + :param timeout: Time in millisecond to wait for a message before calling the timeout handler |
68 | 66 | """
|
69 | 67 | Actor.__init__(self, name, level_logger, timeout)
|
70 |
| - |
71 |
| - #: (powerapi.State): Basic state of the Formula. |
72 | 68 | self.state = FormulaState(self, pushers)
|
73 | 69 |
|
74 | 70 | def setup(self):
|
75 | 71 | """
|
76 |
| - Formula basic setup, Connect the formula to the pusher |
| 72 | + Setup the Formula actor. |
77 | 73 | """
|
78 | 74 | for _, pusher in self.state.pushers.items():
|
79 | 75 | pusher.connect_data()
|
80 | 76 |
|
81 | 77 | def teardown(self):
|
82 | 78 | """
|
83 |
| - Allow to close actor_pusher socket |
| 79 | + Teardown the Formula actor. |
84 | 80 | """
|
85 | 81 | for _, pusher in self.state.pushers.items():
|
86 | 82 | pusher.state.socket_interface.close()
|
0 commit comments