Commit 0716eccb5b065ccc7d465a35e93e201e7113ebb0
1 parent
ddc7106a
Exists in
dev
Bye Bye Celery (1 - from pyros.py)
Showing
1 changed file
with
32 additions
and
150 deletions
Show diff stats
pyros.py
@@ -9,10 +9,6 @@ import argparse | @@ -9,10 +9,6 @@ import argparse | ||
9 | import time | 9 | import time |
10 | import signal | 10 | import signal |
11 | 11 | ||
12 | -# For USE_CELERY global variable | ||
13 | -#from src.pyros import settings | ||
14 | -USE_CELERY = False | ||
15 | -#USE_CELERY = True | ||
16 | 12 | ||
17 | DEBUG = True | 13 | DEBUG = True |
18 | SIMULATOR_CONFIG_FILE = "conf.json" #default config file | 14 | SIMULATOR_CONFIG_FILE = "conf.json" #default config file |
@@ -54,28 +50,27 @@ class Utils: | @@ -54,28 +50,27 @@ class Utils: | ||
54 | print("Current directory : " + str(os.getcwd())) | 50 | print("Current directory : " + str(os.getcwd())) |
55 | return 0 | 51 | return 0 |
56 | 52 | ||
57 | - def replacePatternInFile(self, pattern, replace, file_path): | 53 | + def replacePatternInFile(self, pattern, replacement, file_path): |
58 | #try: | 54 | #try: |
59 | with fileinput.FileInput(file_path, inplace=True, backup='.bak') as file: | 55 | with fileinput.FileInput(file_path, inplace=True, backup='.bak') as file: |
60 | for line in file: | 56 | for line in file: |
61 | - print(line.replace(pattern, replace), end='') | 57 | + print(line.replace(pattern, replacement), end='') |
62 | ''' | 58 | ''' |
63 | except: | 59 | except: |
64 | return 1 | 60 | return 1 |
65 | return 0 | 61 | return 0 |
66 | ''' | 62 | ''' |
67 | # Now, check that replacement has been done or else ERROR !!! | 63 | # Now, check that replacement has been done or else ERROR !!! |
68 | - #pattern = "CELERY_TEST = "+str(set_it) | ||
69 | FOUND=False | 64 | FOUND=False |
70 | #with fileinput.FileInput(file_path) as file: | 65 | #with fileinput.FileInput(file_path) as file: |
71 | with open(file_path) as file: | 66 | with open(file_path) as file: |
72 | for line in file: | 67 | for line in file: |
73 | - #if replace in line: | ||
74 | - if line.startswith(replace): | 68 | + #if replacement in line: |
69 | + if line.startswith(replacement): | ||
75 | FOUND = True | 70 | FOUND = True |
76 | break | 71 | break |
77 | #if FOUND: print("pattern "+pattern+" found in file "+file_path) | 72 | #if FOUND: print("pattern "+pattern+" found in file "+file_path) |
78 | - if not FOUND: raise(Exception("pattern "+replace+" not found in file "+file_path)) | 73 | + if not FOUND: raise(Exception("pattern "+replacement+" not found in file "+file_path)) |
79 | 74 | ||
80 | 75 | ||
81 | def printColor(self, color, message, file=sys.stdout, eol=os.linesep, forced=False): | 76 | def printColor(self, color, message, file=sys.stdout, eol=os.linesep, forced=False): |
@@ -113,7 +108,6 @@ class AManager(Utils): | @@ -113,7 +108,6 @@ class AManager(Utils): | ||
113 | python_version = sys.version_info | 108 | python_version = sys.version_info |
114 | 109 | ||
115 | bin_dir = "" | 110 | bin_dir = "" |
116 | - celery = "celery" | ||
117 | venv_pip = "pip" | 111 | venv_pip = "pip" |
118 | venv_bin = "python" | 112 | venv_bin = "python" |
119 | wait = True | 113 | wait = True |
@@ -141,34 +135,29 @@ class AManager(Utils): | @@ -141,34 +135,29 @@ class AManager(Utils): | ||
141 | self.bin_dir = "Scripts" | 135 | self.bin_dir = "Scripts" |
142 | self.bin_name = "python.exe" | 136 | self.bin_name = "python.exe" |
143 | self.pip_name = "pip.exe" | 137 | self.pip_name = "pip.exe" |
144 | - self.celery = "celery.exe" | ||
145 | else: | 138 | else: |
146 | self.bin_dir = "bin" | 139 | self.bin_dir = "bin" |
147 | self.bin_name = "python" | 140 | self.bin_name = "python" |
148 | self.pip_name = "pip" | 141 | self.pip_name = "pip" |
149 | - self.celery = "celery" | ||
150 | self.venv_pip = self.path_dir_file + os.sep + config["path"] + os.sep + config["env"] + os.sep + self.bin_dir + os.sep + self.pip_name | 142 | self.venv_pip = self.path_dir_file + os.sep + config["path"] + os.sep + config["env"] + os.sep + self.bin_dir + os.sep + self.pip_name |
151 | self.venv_bin = self.path_dir_file + os.sep + config["path"] + os.sep + config["env"] + os.sep + self.bin_dir + os.sep + self.bin_name | 143 | self.venv_bin = self.path_dir_file + os.sep + config["path"] + os.sep + config["env"] + os.sep + self.bin_dir + os.sep + self.bin_name |
152 | - self.venv_cel = self.path_dir_file + os.sep + config["path"] + os.sep + config["env"] + os.sep + self.bin_dir + os.sep + self.celery | ||
153 | 144 | ||
154 | def help(self): | 145 | def help(self): |
155 | print("This function must be implemented") | 146 | print("This function must be implemented") |
156 | raise(NotImplementedError("Function not implemented")) | 147 | raise(NotImplementedError("Function not implemented")) |
157 | 148 | ||
158 | 149 | ||
159 | - def set_celery_test_and_simulator_modes_to(self, set_it:bool, simulator:bool=True): | 150 | + def set_simulator_mode_to(self, set_it:bool): |
160 | file_path = "pyros/settings.py" | 151 | file_path = "pyros/settings.py" |
161 | ''' | 152 | ''' |
162 | - self.replacePatternInFile("CELERY_TEST = False", "CELERY_TEST = True", file_path) | ||
163 | if simulator: self.replacePatternInFile("SIMULATOR = False", "SIMULATOR = True", file_path) | 153 | if simulator: self.replacePatternInFile("SIMULATOR = False", "SIMULATOR = True", file_path) |
164 | ''' | 154 | ''' |
165 | - self.replacePatternInFile("CELERY_TEST = "+str(not set_it), "CELERY_TEST = "+str(set_it), file_path) | ||
166 | - if simulator: self.replacePatternInFile("SIMULATOR = "+str(not set_it), "SIMULATOR = "+str(set_it), file_path) | 155 | + self.replacePatternInFile("SIMULATOR = "+str(not set_it), "SIMULATOR = "+str(set_it), file_path) |
167 | 156 | ||
168 | 157 | ||
169 | def signal_handler(self, signal, frame): | 158 | def signal_handler(self, signal, frame): |
170 | self.printFullTerm(Colors.WARNING, "Ctrl-c catched") | 159 | self.printFullTerm(Colors.WARNING, "Ctrl-c catched") |
171 | - self.set_celery_test_and_simulator_modes_to(False) | 160 | + self.set_simulator_mode_to(False) |
172 | for p in self.subproc: | 161 | for p in self.subproc: |
173 | proc, name = p | 162 | proc, name = p |
174 | self.printColor(Colors.BLUE, "Killing process " + str(name)) | 163 | self.printColor(Colors.BLUE, "Killing process " + str(name)) |
@@ -448,12 +437,10 @@ class Pyros(AManager): | @@ -448,12 +437,10 @@ class Pyros(AManager): | ||
448 | return self.execProcess("rm logs/*.log") | 437 | return self.execProcess("rm logs/*.log") |
449 | 438 | ||
450 | def test(self): | 439 | def test(self): |
451 | - ##self.singleWorker("scheduling") | ||
452 | self.changeDirectory("src") | 440 | self.changeDirectory("src") |
453 | ##self.execProcessFromVenv(self.venv_bin + " manage.py test") | 441 | ##self.execProcessFromVenv(self.venv_bin + " manage.py test") |
454 | self.execProcessFromVenvAsync(self.venv_bin + " manage.py test") | 442 | self.execProcessFromVenvAsync(self.venv_bin + " manage.py test") |
455 | self.changeDirectory("..") | 443 | self.changeDirectory("..") |
456 | - ##self.stop_workers() | ||
457 | return 0 | 444 | return 0 |
458 | 445 | ||
459 | def migrate(self): | 446 | def migrate(self): |
@@ -487,7 +474,7 @@ class Pyros(AManager): | @@ -487,7 +474,7 @@ class Pyros(AManager): | ||
487 | 474 | ||
488 | def reset_config(self): | 475 | def reset_config(self): |
489 | self.changeDirectory("src") | 476 | self.changeDirectory("src") |
490 | - self.set_celery_test_and_simulator_modes_to(False) | 477 | + self.set_simulator_mode_to(False) |
491 | self.addExecuted(self.current_command, "reset configuration") | 478 | self.addExecuted(self.current_command, "reset configuration") |
492 | self.changeDirectory("..") | 479 | self.changeDirectory("..") |
493 | return 0 | 480 | return 0 |
@@ -514,50 +501,6 @@ class Pyros(AManager): | @@ -514,50 +501,6 @@ class Pyros(AManager): | ||
514 | return 0 | 501 | return 0 |
515 | 502 | ||
516 | 503 | ||
517 | - def celery_on(self, TOTAL=True): | ||
518 | - self.changeDirectory("src") | ||
519 | - | ||
520 | - if TOTAL: self.execProcessFromVenvAsync(self.venv_cel + " worker -A pyros -Q alert_listener_q -n pyros@alert_listener -c 1") | ||
521 | - if TOTAL: self.execProcessFromVenvAsync(self.venv_cel + " worker -A pyros -Q monitoring_q -n pyros@monitoring -c 1") | ||
522 | - | ||
523 | - #self.singleWorker("majordome") | ||
524 | - self.execProcessFromVenvAsync(self.venv_cel + " worker -A pyros -Q majordome_q -n pyros@majordome -c 1") | ||
525 | - | ||
526 | - #self.singleWorker("scheduling") | ||
527 | - self.execProcessFromVenvAsync(self.venv_cel + " worker -A pyros -Q scheduling_q --purge -n pyros@scheduling -c 1") | ||
528 | - | ||
529 | - #self.singleWorker("execute_plan_vis") | ||
530 | - self.execProcessFromVenvAsync(self.venv_cel + " worker -A pyros -Q execute_plan_vis_q --purge -n pyros@execute_plan_vis -c 1") | ||
531 | - | ||
532 | - if TOTAL: self.execProcessFromVenvAsync(self.venv_cel + " worker -A pyros -Q night_calibrations_q --purge -n pyros@night_calibrations -c 1") | ||
533 | - | ||
534 | - #self.singleWorker("execute_plan_nir") | ||
535 | - self.execProcessFromVenvAsync(self.venv_cel + " worker -A pyros -Q execute_plan_nir_q --purge -n pyros@execute_plan_nir -c 1") | ||
536 | - | ||
537 | - #self.singleWorker("create_calibrations") | ||
538 | - self.execProcessFromVenvAsync(self.venv_cel + " worker -A pyros -Q create_calibrations_q --purge -n pyros@create_calibrations -c 1") | ||
539 | - | ||
540 | - #self.singleWorker("analysis") | ||
541 | - self.execProcessFromVenvAsync(self.venv_cel + " worker -A pyros -Q analysis_q --purge -n pyros@analysis -c 1") | ||
542 | - | ||
543 | - self.changeDirectory("..") | ||
544 | - return 0 | ||
545 | - | ||
546 | - # ex start() | ||
547 | - def start_workers(self): | ||
548 | - self.stop_workers() | ||
549 | - self.celery_on() | ||
550 | - return 0 | ||
551 | - | ||
552 | - # ex stop() | ||
553 | - def stop_workers(self): | ||
554 | - if (self.system == "Windows"): | ||
555 | - self.execProcessAsync("taskkill /f /im celery.exe") | ||
556 | - self.execProcessAsync("taskkill /f /im python.exe") | ||
557 | - else: | ||
558 | - self.execProcessAsync("ps aux | grep \"celery worker\" | awk '{print $2}' | xargs kill -9") | ||
559 | - return 0 | ||
560 | - | ||
561 | def init_database(self): | 504 | def init_database(self): |
562 | self.makemigrations() | 505 | self.makemigrations() |
563 | self.migrate() | 506 | self.migrate() |
@@ -596,15 +539,6 @@ class Pyros(AManager): | @@ -596,15 +539,6 @@ class Pyros(AManager): | ||
596 | what="all" | 539 | what="all" |
597 | ''' | 540 | ''' |
598 | 541 | ||
599 | - ''' OLD CODE | ||
600 | - self.stop_workers() | ||
601 | - #self.celery_on() | ||
602 | - # Start the 3 main agents (via their celery worker) : | ||
603 | - self.startAgent("monitoring") | ||
604 | - self.startAgent("majordome") | ||
605 | - self.startAgent("alert_listener") | ||
606 | - ''' | ||
607 | - | ||
608 | # Go into src/ | 542 | # Go into src/ |
609 | self.changeDirectory("src") | 543 | self.changeDirectory("src") |
610 | #print("Current directory : " + str(os.getcwd())) | 544 | #print("Current directory : " + str(os.getcwd())) |
@@ -655,17 +589,10 @@ class Pyros(AManager): | @@ -655,17 +589,10 @@ class Pyros(AManager): | ||
655 | 589 | ||
656 | 590 | ||
657 | 591 | ||
658 | - def startAgent(self, agent_name:str): | ||
659 | - # Start Celery Worker | ||
660 | - self.singleWorker(agent_name) | ||
661 | - time.sleep(3) | ||
662 | - # Put the agent task run() into the Worker queue | ||
663 | - | ||
664 | - | ||
665 | # Reset the database content | 592 | # Reset the database content |
666 | def reset_database_sim(self): | 593 | def reset_database_sim(self): |
667 | self.changeDirectory("src") | 594 | self.changeDirectory("src") |
668 | - self.set_celery_test_and_simulator_modes_to(True, False) | 595 | + self.set_simulator_mode_to(True, False) |
669 | ''' | 596 | ''' |
670 | Supprime toutes les donnรฉes de la base de donnรฉes | 597 | Supprime toutes les donnรฉes de la base de donnรฉes |
671 | et rรฉexรฉcute tout gestionnaire de post-synchronisation. | 598 | et rรฉexรฉcute tout gestionnaire de post-synchronisation. |
@@ -673,11 +600,11 @@ class Pyros(AManager): | @@ -673,11 +600,11 @@ class Pyros(AManager): | ||
673 | ''' | 600 | ''' |
674 | #TODO: remplacer par manage.py --noinput flush pour eviter le "echo yes"... | 601 | #TODO: remplacer par manage.py --noinput flush pour eviter le "echo yes"... |
675 | self.execProcess( self.venv_bin + " manage.py flush --noinput") | 602 | self.execProcess( self.venv_bin + " manage.py flush --noinput") |
676 | - self.set_celery_test_and_simulator_modes_to(True, False) | 603 | + self.set_simulator_mode_to(True, False) |
677 | self.changeDirectory("..") | 604 | self.changeDirectory("..") |
678 | 605 | ||
679 | 606 | ||
680 | - # Simulation for the scheduler ONLY (and only some celery workers, not all of them) | 607 | + # Simulation for the scheduler ONLY |
681 | def simulator_development(self): | 608 | def simulator_development(self): |
682 | self.simulator(False) | 609 | self.simulator(False) |
683 | 610 | ||
@@ -691,12 +618,11 @@ class Pyros(AManager): | @@ -691,12 +618,11 @@ class Pyros(AManager): | ||
691 | delete from request; | 618 | delete from request; |
692 | ''' | 619 | ''' |
693 | 620 | ||
694 | - # Simulation (by default, with ALL simulators and ALL celery workers) | 621 | + # Simulation (by default, with ALL simulators) |
695 | def simulator(self, TOTAL=True): | 622 | def simulator(self, TOTAL=True): |
696 | self.changeDirectory("src") | 623 | self.changeDirectory("src") |
697 | 624 | ||
698 | - # Set CELERY_TEST mode ON | ||
699 | - self.replacePatternInFile("CELERY_TEST = False", "CELERY_TEST = True", "pyros/settings.py") | 625 | + # Set SIMULATOR mode ON |
700 | self.replacePatternInFile("SIMULATOR = False", "SIMULATOR = True", "pyros/settings.py") | 626 | self.replacePatternInFile("SIMULATOR = False", "SIMULATOR = True", "pyros/settings.py") |
701 | 627 | ||
702 | # 0) Reset the database (Empty the database from any data) | 628 | # 0) Reset the database (Empty the database from any data) |
@@ -714,7 +640,7 @@ class Pyros(AManager): | @@ -714,7 +640,7 @@ class Pyros(AManager): | ||
714 | self.loaddata() | 640 | self.loaddata() |
715 | 641 | ||
716 | # | 642 | # |
717 | - # 1) Launch Django web server | 643 | + # 1) Launch web server |
718 | # | 644 | # |
719 | self.server() | 645 | self.server() |
720 | self.sleep(2) | 646 | self.sleep(2) |
@@ -727,18 +653,11 @@ class Pyros(AManager): | @@ -727,18 +653,11 @@ class Pyros(AManager): | ||
727 | self.printColor(Colors.GREEN, "If you want to shutdown the simulation, please run :") | 653 | self.printColor(Colors.GREEN, "If you want to shutdown the simulation, please run :") |
728 | self.printColor(Colors.GREEN, "CTRL-C or pyros.py kill_simulation") | 654 | self.printColor(Colors.GREEN, "CTRL-C or pyros.py kill_simulation") |
729 | self.printColor(Colors.GREEN, "If the simulation isn't correctly killed, please switch the variable") | 655 | self.printColor(Colors.GREEN, "If the simulation isn't correctly killed, please switch the variable") |
730 | - self.printColor(Colors.GREEN, "CELERY_TEST in src/pyros/settings.py to False") | 656 | + self.printColor(Colors.GREEN, "SIMULATOR in src/pyros/settings.py to False") |
731 | self.printFullTerm(Colors.WARNING, "SUMMARY") | 657 | self.printFullTerm(Colors.WARNING, "SUMMARY") |
732 | 658 | ||
733 | # | 659 | # |
734 | - # 2) (if USE_CELERY) Start Celery workers | ||
735 | - # | ||
736 | - if USE_CELERY: | ||
737 | - self.celery_on(TOTAL) | ||
738 | - self.sleep(3) | ||
739 | - | ||
740 | - # | ||
741 | - # 3) Start simulator(s) : | 660 | + # 2) Start simulator(s) : |
742 | # | 661 | # |
743 | self.sims_launch(TOTAL) | 662 | self.sims_launch(TOTAL) |
744 | 663 | ||
@@ -774,20 +693,6 @@ class Pyros(AManager): | @@ -774,20 +693,6 @@ class Pyros(AManager): | ||
774 | self.changeDirectory("..") | 693 | self.changeDirectory("..") |
775 | ''' | 694 | ''' |
776 | 695 | ||
777 | - ''' | ||
778 | - # | ||
779 | - # 2) (if not USE_CELERY) Start Agents | ||
780 | - # | ||
781 | - if TOTAL and not USE_CELERY : | ||
782 | - #pass | ||
783 | - # Start Environment Monitoring Agent | ||
784 | - # Start Majordome Agent | ||
785 | - # Start Alert Manager Agent | ||
786 | - self.start_agents() | ||
787 | - # Needed ? | ||
788 | - self.sleep(3) | ||
789 | - ''' | ||
790 | - | ||
791 | # When simulators are finished: | 696 | # When simulators are finished: |
792 | #self.kill_simulation() | 697 | #self.kill_simulation() |
793 | return 0 | 698 | return 0 |
@@ -799,8 +704,8 @@ class Pyros(AManager): | @@ -799,8 +704,8 @@ class Pyros(AManager): | ||
799 | def test_majordome(self): | 704 | def test_majordome(self): |
800 | self.changeDirectory("src") | 705 | self.changeDirectory("src") |
801 | 706 | ||
802 | - # Set CELERY_TEST mode ON | ||
803 | - self.set_celery_test_and_simulator_modes_to(True) | 707 | + # Set SIMULATOR mode ON |
708 | + self.set_simulator_mode_to(True) | ||
804 | 709 | ||
805 | # 0) Reset the database (Empty the database from any data) | 710 | # 0) Reset the database (Empty the database from any data) |
806 | self.changeDirectory("..") | 711 | self.changeDirectory("..") |
@@ -824,19 +729,11 @@ class Pyros(AManager): | @@ -824,19 +729,11 @@ class Pyros(AManager): | ||
824 | self.printColor(Colors.GREEN, "If you want to shutdown the simulation, please run :") | 729 | self.printColor(Colors.GREEN, "If you want to shutdown the simulation, please run :") |
825 | self.printColor(Colors.GREEN, "CTRL-C or pyros.py kill_simulation") | 730 | self.printColor(Colors.GREEN, "CTRL-C or pyros.py kill_simulation") |
826 | self.printColor(Colors.GREEN, "If the simulation isn't correctly killed, please switch the variable") | 731 | self.printColor(Colors.GREEN, "If the simulation isn't correctly killed, please switch the variable") |
827 | - self.printColor(Colors.GREEN, "CELERY_TEST in src/pyros/settings.py to False") | 732 | + self.printColor(Colors.GREEN, "SIMULATOR in src/pyros/settings.py to False") |
828 | self.printFullTerm(Colors.WARNING, "SUMMARY") | 733 | self.printFullTerm(Colors.WARNING, "SUMMARY") |
829 | 734 | ||
830 | - # 2) (if USE_CELERY) Start Celery workers | ||
831 | # | 735 | # |
832 | - ''' | ||
833 | - if USE_CELERY: | ||
834 | - self.celery_on(TOTAL) | ||
835 | - self.sleep(3) | ||
836 | - ''' | ||
837 | - | ||
838 | - # | ||
839 | - # 3) Start simulator(s) : | 736 | + # 2) Start simulator(s) : |
840 | # | 737 | # |
841 | #self.sims_launch(True) | 738 | #self.sims_launch(True) |
842 | agent='majordome' | 739 | agent='majordome' |
@@ -852,7 +749,7 @@ class Pyros(AManager): | @@ -852,7 +749,7 @@ class Pyros(AManager): | ||
852 | # When simulators are finished: | 749 | # When simulators are finished: |
853 | #self.kill_simulation() | 750 | #self.kill_simulation() |
854 | #self.changeDirectory("src") | 751 | #self.changeDirectory("src") |
855 | - self.set_celery_test_and_simulator_modes_to(False) | 752 | + self.set_simulator_mode_to(False) |
856 | self.changeDirectory("..") | 753 | self.changeDirectory("..") |
857 | self.execProcessAsync("ps aux | grep \"start_agent_majordome.py\" | awk '{ print $2 }' | xargs kill") | 754 | self.execProcessAsync("ps aux | grep \"start_agent_majordome.py\" | awk '{ print $2 }' | xargs kill") |
858 | 755 | ||
@@ -870,7 +767,7 @@ class Pyros(AManager): | @@ -870,7 +767,7 @@ class Pyros(AManager): | ||
870 | 767 | ||
871 | def kill_simulation(self): | 768 | def kill_simulation(self): |
872 | self.changeDirectory("src") | 769 | self.changeDirectory("src") |
873 | - self.set_celery_test_and_simulator_modes_to(False) | 770 | + self.set_simulator_mode_to(False) |
874 | self.changeDirectory("..") | 771 | self.changeDirectory("..") |
875 | if (self.system == "Windows"): | 772 | if (self.system == "Windows"): |
876 | self.execProcessAsync("taskkill /f /im python.exe") | 773 | self.execProcessAsync("taskkill /f /im python.exe") |
@@ -884,12 +781,12 @@ class Pyros(AManager): | @@ -884,12 +781,12 @@ class Pyros(AManager): | ||
884 | 781 | ||
885 | self.kill_server() | 782 | self.kill_server() |
886 | 783 | ||
887 | - # (if not using celery) Kill all agents : | ||
888 | - if not USE_CELERY: | ||
889 | - self.execProcessAsync("ps aux | grep \"start_agent_alert_manager.py\" | awk '{ print $2 }' | xargs kill") | ||
890 | - self.execProcessAsync("ps aux | grep \"start_agent_monitoring.py\" | awk '{ print $2 }' | xargs kill") | ||
891 | - self.execProcessAsync("ps aux | grep \"start_agent_majordome.py\" | awk '{ print $2 }' | xargs kill") | 784 | + # Kill all agents : |
785 | + self.execProcessAsync("ps aux | grep \"start_agent_alert_manager.py\" | awk '{ print $2 }' | xargs kill") | ||
786 | + self.execProcessAsync("ps aux | grep \"start_agent_monitoring.py\" | awk '{ print $2 }' | xargs kill") | ||
787 | + self.execProcessAsync("ps aux | grep \"start_agent_majordome.py\" | awk '{ print $2 }' | xargs kill") | ||
892 | #self.execProcessAsync("ps aux | grep \"start_agent_majordome.py\" | awk '{ print $2 }' | xargs kill") | 788 | #self.execProcessAsync("ps aux | grep \"start_agent_majordome.py\" | awk '{ print $2 }' | xargs kill") |
789 | + | ||
893 | # Kill all simulators : | 790 | # Kill all simulators : |
894 | self.execProcessAsync("ps aux | grep \" domeSimulator.py\" | awk '{ print $2 }' | xargs kill") | 791 | self.execProcessAsync("ps aux | grep \" domeSimulator.py\" | awk '{ print $2 }' | xargs kill") |
895 | self.execProcessAsync("ps aux | grep \" userSimulator.py\" | awk '{ print $2 }' | xargs kill") | 792 | self.execProcessAsync("ps aux | grep \" userSimulator.py\" | awk '{ print $2 }' | xargs kill") |
@@ -899,7 +796,6 @@ class Pyros(AManager): | @@ -899,7 +796,6 @@ class Pyros(AManager): | ||
899 | self.execProcessAsync("ps aux | grep \" cameraNIRSimulator.py\" | awk '{ print $2 }' | xargs kill") | 796 | self.execProcessAsync("ps aux | grep \" cameraNIRSimulator.py\" | awk '{ print $2 }' | xargs kill") |
900 | self.execProcessAsync("ps aux | grep \" cameraVISSimulator.py\" | awk '{ print $2 }' | xargs kill") | 797 | self.execProcessAsync("ps aux | grep \" cameraVISSimulator.py\" | awk '{ print $2 }' | xargs kill") |
901 | self.changeDirectory("..") | 798 | self.changeDirectory("..") |
902 | - if USE_CELERY: self.stop_workers() | ||
903 | 799 | ||
904 | self.printFullTerm(Colors.GREEN, "simulation ended") | 800 | self.printFullTerm(Colors.GREEN, "simulation ended") |
905 | return 0 | 801 | return 0 |
@@ -1001,8 +897,8 @@ class Pyros(AManager): | @@ -1001,8 +897,8 @@ class Pyros(AManager): | ||
1001 | # Get back to project root folder | 897 | # Get back to project root folder |
1002 | self.changeDirectory("..") | 898 | self.changeDirectory("..") |
1003 | 899 | ||
1004 | - # (if not celery) Launch agents (env monitor, major, alert mgr) | ||
1005 | - if not USE_CELERY: self.start_agents() | 900 | + # Launch agents (env monitor, major, alert mgr) |
901 | + self.start_agents() | ||
1006 | 902 | ||
1007 | # Wait for end of simulators : | 903 | # Wait for end of simulators : |
1008 | for p in procs: p.wait() | 904 | for p in procs: p.wait() |
@@ -1012,12 +908,6 @@ class Pyros(AManager): | @@ -1012,12 +908,6 @@ class Pyros(AManager): | ||
1012 | return 0 | 908 | return 0 |
1013 | 909 | ||
1014 | 910 | ||
1015 | - def singleWorker(self, worker): | ||
1016 | - self.changeDirectory("src") | ||
1017 | - self.execProcessFromVenvAsync(self.venv_cel + " worker -A pyros -Q "+ worker +"_q -n pyros@"+worker+" -c 1") | ||
1018 | - self.changeDirectory("..") | ||
1019 | - return 0 | ||
1020 | - | ||
1021 | def mysql_on(self): | 911 | def mysql_on(self): |
1022 | self.changeDirectory("src") | 912 | self.changeDirectory("src") |
1023 | self.replacePatternInFile("MYSQL = False", "MYSQL = True", "pyros/settings.py") | 913 | self.replacePatternInFile("MYSQL = False", "MYSQL = True", "pyros/settings.py") |
@@ -1050,7 +940,6 @@ class Pyros(AManager): | @@ -1050,7 +940,6 @@ class Pyros(AManager): | ||
1050 | "unittest": self.unittest, | 940 | "unittest": self.unittest, |
1051 | "reset_config": self.reset_config, | 941 | "reset_config": self.reset_config, |
1052 | "test_all": self.test_all, | 942 | "test_all": self.test_all, |
1053 | - "celery_on": self.celery_on, | ||
1054 | "reset_database_sim": self.reset_database_sim, | 943 | "reset_database_sim": self.reset_database_sim, |
1055 | "init_database": self.init_database, | 944 | "init_database": self.init_database, |
1056 | "kill_server": self.kill_server, | 945 | "kill_server": self.kill_server, |
@@ -1065,10 +954,6 @@ class Pyros(AManager): | @@ -1065,10 +954,6 @@ class Pyros(AManager): | ||
1065 | "start_agent_alertmanager": self.start_agent_alertmanager, | 954 | "start_agent_alertmanager": self.start_agent_alertmanager, |
1066 | "test_majordome": self.test_majordome, | 955 | "test_majordome": self.test_majordome, |
1067 | 956 | ||
1068 | - # ex start | ||
1069 | - "start_workers": self.start_workers, | ||
1070 | - # ex stop | ||
1071 | - "stop_workers": self.stop_workers, | ||
1072 | "simulator": self.simulator, | 957 | "simulator": self.simulator, |
1073 | "kill_simulation": self.kill_simulation, | 958 | "kill_simulation": self.kill_simulation, |
1074 | "sims_launch": self.sims_launch, | 959 | "sims_launch": self.sims_launch, |
@@ -1092,14 +977,11 @@ class Pyros(AManager): | @@ -1092,14 +977,11 @@ class Pyros(AManager): | ||
1092 | "updatedb": "Update the database", | 977 | "updatedb": "Update the database", |
1093 | "kill_server": "Kill the web server on port 8000", | 978 | "kill_server": "Kill the web server on port 8000", |
1094 | "init_database": "Create a standard context for pyros in db", | 979 | "init_database": "Create a standard context for pyros in db", |
1095 | - "unittest": "Runs the tests that don't need celery", | 980 | + "unittest": "Runs the unit tests", |
1096 | "test_all": "Run all the existing tests (this command needs to be updated when tests are added in the project", | 981 | "test_all": "Run all the existing tests (this command needs to be updated when tests are added in the project", |
1097 | - "celery_on": "Starts celery workers", | ||
1098 | - "start_workers": "Starts the celery workers (then the web server ???)", | ||
1099 | - "stop_workers": "Stops the celery workers", | ||
1100 | "simulator": "Launch a simulation", | 982 | "simulator": "Launch a simulation", |
1101 | "simulator_development": "Simulation for the scheduler only", | 983 | "simulator_development": "Simulation for the scheduler only", |
1102 | - "kill_simulation": "kill the simulators / celery workers / web server", | 984 | + "kill_simulation": "kill the simulators & web server", |
1103 | "sims_launch": "Launch only the simulators", | 985 | "sims_launch": "Launch only the simulators", |
1104 | } | 986 | } |
1105 | 987 |