File tree 5 files changed +72
-1
lines changed
dockers/docker-platform-monitor
src/sonic-daemon-base/sonic_daemon_base
5 files changed +72
-1
lines changed Original file line number Diff line number Diff line change @@ -91,3 +91,14 @@ stdout_logfile=syslog
91
91
stderr_logfile=syslog
92
92
startsecs=10
93
93
{% endif %}
94
+
95
+ {% if not skip_thermalctld %}
96
+ [program:thermalctld]
97
+ command=/usr/bin/thermalctld
98
+ priority=9
99
+ autostart=false
100
+ autorestart=true
101
+ stdout_logfile=syslog
102
+ stderr_logfile=syslog
103
+ startsecs=0
104
+ {% endif %}
Original file line number Diff line number Diff line change @@ -75,3 +75,7 @@ supervisorctl start psud
75
75
supervisorctl start syseepromd
76
76
{% endif %}
77
77
78
+ {% if not skip_thermalctld %}
79
+ supervisorctl start thermalctld
80
+ {% endif %}
81
+
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ $(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(LIBSENSORS) $(LM_SENSORS) $(FANCONTROL)
10
10
ifeq ($(CONFIGURED_PLATFORM ) ,barefoot)
11
11
$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(PYTHON_THRIFT )
12
12
endif
13
- $(DOCKER_PLATFORM_MONITOR)_PYTHON_DEBS += $(SONIC_LEDD ) $(SONIC_XCVRD ) $(SONIC_PSUD ) $(SONIC_SYSEEPROMD )
13
+ $(DOCKER_PLATFORM_MONITOR)_PYTHON_DEBS += $(SONIC_LEDD ) $(SONIC_XCVRD ) $(SONIC_PSUD ) $(SONIC_SYSEEPROMD ) $( SONIC_THERMALCTLD )
14
14
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2 )
15
15
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SWSSSDK_PY2 )
16
16
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_API_PY2 )
Original file line number Diff line number Diff line change
1
+ # sonic-thermalctld (SONiC Thermal control daemon) Debian package
2
+
3
+ SONIC_THERMALCTLD = python-sonic-thermalctld_1.0-1_all.deb
4
+ $(SONIC_THERMALCTLD)_SRC_PATH = $(SRC_PATH ) /sonic-platform-daemons/sonic-thermalctld
5
+ $(SONIC_THERMALCTLD)_WHEEL_DEPENDS = $(SONIC_DAEMON_BASE_PY2 )
6
+ SONIC_PYTHON_STDEB_DEBS += $(SONIC_THERMALCTLD )
Original file line number Diff line number Diff line change
1
+ import multiprocessing
2
+ import os
3
+ import signal
4
+ import threading
5
+
6
+
7
+ #
8
+ # ProcessTaskBase =====================================================================
9
+ #
10
+ class ProcessTaskBase (object ): # TODO: put this class to swss-platform-common
11
+ def __init__ (self ):
12
+ self .task_process = None
13
+ self .task_stopping_event = multiprocessing .Event ()
14
+
15
+ def task_worker (self ):
16
+ pass
17
+
18
+ def task_run (self ):
19
+ if self .task_stopping_event .is_set ():
20
+ return
21
+
22
+ self .task_process = multiprocessing .Process (target = self .task_worker )
23
+ self .task_process .start ()
24
+
25
+ def task_stop (self ):
26
+ self .task_stopping_event .set ()
27
+ os .kill (self .task_process .pid , signal .SIGKILL )
28
+
29
+
30
+ #
31
+ # ThreadTaskBase =====================================================================
32
+ #
33
+ class ThreadTaskBase (object ): # TODO: put this class to swss-platform-common;
34
+ def __init__ (self ):
35
+ self .task_thread = None
36
+ self .task_stopping_event = threading .Event ()
37
+
38
+ def task_worker (self ):
39
+ pass
40
+
41
+ def task_run (self ):
42
+ if self .task_stopping_event .is_set ():
43
+ return
44
+
45
+ self .task_thread = threading .Thread (target = self .task_worker )
46
+ self .task_thread .start ()
47
+
48
+ def task_stop (self ):
49
+ self .task_stopping_event .set ()
50
+ self .task_thread .join ()
You can’t perform that action at this time.
0 commit comments