Skip to content

Commit d51cdcf

Browse files
committed
refactor: Remove unused code in formula actor class, update documentation
1 parent 86cdc22 commit d51cdcf

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

powerapi/formula/formula_actor.py

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,49 +38,45 @@
3838

3939
class FormulaState(State):
4040
"""
41-
Formula Actor State
41+
State of the Formula actor.
4242
"""
4343

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+
"""
4550
State.__init__(self, actor)
46-
self.formula_id = formula_id
4751
self.pushers = pushers
4852

4953

5054
class FormulaActor(Actor):
5155
"""
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.
5757
"""
5858

5959
def __init__(self, name, pushers: Dict[str, PusherActor], level_logger=logging.WARNING, timeout=None):
6060
"""
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
6866
"""
6967
Actor.__init__(self, name, level_logger, timeout)
70-
71-
#: (powerapi.State): Basic state of the Formula.
7268
self.state = FormulaState(self, pushers)
7369

7470
def setup(self):
7571
"""
76-
Formula basic setup, Connect the formula to the pusher
72+
Setup the Formula actor.
7773
"""
7874
for _, pusher in self.state.pushers.items():
7975
pusher.connect_data()
8076

8177
def teardown(self):
8278
"""
83-
Allow to close actor_pusher socket
79+
Teardown the Formula actor.
8480
"""
8581
for _, pusher in self.state.pushers.items():
8682
pusher.state.socket_interface.close()

0 commit comments

Comments
 (0)