forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add thermal control support for SONiC (sonic-net#3949) (#179)
* Add thermalctl to pmon docker * Still use original commit message for reference Co-authored-by: Junchao-Mellanox <57339448+Junchao-Mellanox@users.noreply.github.com>
- Loading branch information
1 parent
9e03c2a
commit 84382d1
Showing
5 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# sonic-thermalctld (SONiC Thermal control daemon) Debian package | ||
|
||
SONIC_THERMALCTLD = python-sonic-thermalctld_1.0-1_all.deb | ||
$(SONIC_THERMALCTLD)_SRC_PATH = $(SRC_PATH)/sonic-platform-daemons/sonic-thermalctld | ||
$(SONIC_THERMALCTLD)_WHEEL_DEPENDS = $(SONIC_DAEMON_BASE_PY2) | ||
SONIC_PYTHON_STDEB_DEBS += $(SONIC_THERMALCTLD) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import multiprocessing | ||
import os | ||
import signal | ||
import threading | ||
|
||
|
||
# | ||
# ProcessTaskBase ===================================================================== | ||
# | ||
class ProcessTaskBase(object): # TODO: put this class to swss-platform-common | ||
def __init__(self): | ||
self.task_process = None | ||
self.task_stopping_event = multiprocessing.Event() | ||
|
||
def task_worker(self): | ||
pass | ||
|
||
def task_run(self): | ||
if self.task_stopping_event.is_set(): | ||
return | ||
|
||
self.task_process = multiprocessing.Process(target=self.task_worker) | ||
self.task_process.start() | ||
|
||
def task_stop(self): | ||
self.task_stopping_event.set() | ||
os.kill(self.task_process.pid, signal.SIGKILL) | ||
|
||
|
||
# | ||
# ThreadTaskBase ===================================================================== | ||
# | ||
class ThreadTaskBase(object): # TODO: put this class to swss-platform-common; | ||
def __init__(self): | ||
self.task_thread = None | ||
self.task_stopping_event = threading.Event() | ||
|
||
def task_worker(self): | ||
pass | ||
|
||
def task_run(self): | ||
if self.task_stopping_event.is_set(): | ||
return | ||
|
||
self.task_thread = threading.Thread(target=self.task_worker) | ||
self.task_thread.start() | ||
|
||
def task_stop(self): | ||
self.task_stopping_event.set() | ||
self.task_thread.join() |