|
@@ -5,6 +5,7 @@ import logging
|
|
|
|
|
|
from core import ShellGui
|
|
from core import ShellGui
|
|
from core import Utils
|
|
from core import Utils
|
|
|
|
+from core.ConfigurationManager.BrainLoader import BrainLoader
|
|
from core.CrontabManager import CrontabManager
|
|
from core.CrontabManager import CrontabManager
|
|
from core.MainController import MainController
|
|
from core.MainController import MainController
|
|
import signal
|
|
import signal
|
|
@@ -49,6 +50,11 @@ def main():
|
|
|
|
|
|
# by default, no brain file is set. Use the default one: brain.yml in the root path
|
|
# by default, no brain file is set. Use the default one: brain.yml in the root path
|
|
brain_file = None
|
|
brain_file = None
|
|
|
|
+ # check if user set a brain.yml file
|
|
|
|
+ if args.brain_file:
|
|
|
|
+ brain_file = args.brain_file
|
|
|
|
+ # load the brain once
|
|
|
|
+ brain = BrainLoader.get_brain(file_path=brain_file)
|
|
|
|
|
|
# check the user provide a valid action
|
|
# check the user provide a valid action
|
|
if args.action not in ACTION_LIST:
|
|
if args.action not in ACTION_LIST:
|
|
@@ -56,13 +62,10 @@ def main():
|
|
parser.print_help()
|
|
parser.print_help()
|
|
|
|
|
|
if args.action == "start":
|
|
if args.action == "start":
|
|
- # check if user set a brain.yml file
|
|
|
|
- if args.brain_file:
|
|
|
|
- brain_file = args.brain_file
|
|
|
|
|
|
|
|
# user set a synapse to start
|
|
# user set a synapse to start
|
|
if args.run_synapse is not None:
|
|
if args.run_synapse is not None:
|
|
- SynapseLauncher.start_synapse(args.run_synapse, brain_file=brain_file)
|
|
|
|
|
|
+ SynapseLauncher.start_synapse(args.run_synapse, brain=brain)
|
|
|
|
|
|
if args.run_synapse is None:
|
|
if args.run_synapse is None:
|
|
# first, load events in crontab
|
|
# first, load events in crontab
|
|
@@ -78,7 +81,7 @@ def main():
|
|
MainController(brain_file=brain_file)
|
|
MainController(brain_file=brain_file)
|
|
|
|
|
|
if args.action == "gui":
|
|
if args.action == "gui":
|
|
- ShellGui(args.brain_file)
|
|
|
|
|
|
+ ShellGui(brain=brain)
|
|
|
|
|
|
|
|
|
|
def configure_logging(debug=None):
|
|
def configure_logging(debug=None):
|