-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: okkype <okkype@gmail.com>
- Loading branch information
Showing
10 changed files
with
66 additions
and
43 deletions.
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
Empty file.
Empty file.
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,5 @@ | ||
''' | ||
Created on 26 Jun 2019 | ||
@author: alif | ||
''' |
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,44 @@ | ||
''' | ||
Created on 26 Jun 2019 | ||
@author: alif | ||
''' | ||
from django.contrib.staticfiles.management.commands.runserver import ( | ||
Command as StaticRunserverCommand | ||
) | ||
from sihipo_root.threads import * | ||
import threading | ||
|
||
|
||
class Command(StaticRunserverCommand): | ||
|
||
# def handle(self, *args, **options): | ||
# super(Command, self).handle(*args, **options) | ||
|
||
def inner_run(self, *args, **options): | ||
thread_sensor_run = False | ||
thread_control_run = False | ||
thread_eval_run = False | ||
|
||
for t in threading.enumerate(): | ||
if t.getName() == 'thread_sensor': | ||
thread_sensor_run = True | ||
if t.getName() == 'thread_control': | ||
thread_control_run = True | ||
if t.getName() == 'thread_eval': | ||
thread_eval_run = True | ||
|
||
if not thread_sensor_run: | ||
tf_sensor = SensorThread(interval=36000) | ||
tf_sensor.start() | ||
self.stdout.write(self.style.SUCCESS('Successfully start Sensor Thread')) | ||
if not thread_control_run: | ||
tf_control = ControlThread() | ||
tf_control.start() | ||
self.stdout.write(self.style.SUCCESS('Successfully start Control Thread')) | ||
if not thread_eval_run: | ||
tf_eval = EvalThread() | ||
tf_eval.start() | ||
self.stdout.write(self.style.SUCCESS('Successfully start Eval Thread')) | ||
self.stdout.write('') | ||
super(Command, self).inner_run(*args, **options) |
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
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