Example #1
0
 def read_controller_config(self):
     """
     read the controller level config file
     """
     # load the controller config
     self.controller_config.update(fileio.load_config_from_json_file(
         "config/controller.json"))
Example #2
0
    def load_program_config(self):
        """loads the configuration for programs to run"""
        if self.programs != None and self.controller_config["programs_current"]:
            return

        self.controller_config["programs"] = fileio.load_config_from_json_file(
            "config/programs.json")

        self.programs = self.connect_programs()
Example #3
0
    def read_app_config(self):
        """
        load and read all the app configuration
        """
        if self.controller_config["config_current"] is True:
            log("config_current == true")
            return False

        log("config_current == false")

        config_file_observer = self.controller_config["config_file_observer"]
        if config_file_observer:
            config_file_observer.stop()

        config_file_observer = Observer()
        file_change_handler = ConfigFileWatcher(self)

        self.read_controller_config()

        # load the inputs config
        self.controller_config["inputs"] = fileio.load_config_from_json_file(
            "config/inputs.json")

        # load the outputs
        self.controller_config["outputs"] = fileio.load_config_from_json_file(
            "config/outputs.json")

        # load log configs
        self.controller_config["logs"] = fileio.load_config_from_json_file(
            "config/logs.json")

        config_file_observer.schedule(
            file_change_handler, os.path.join(self.cnfg_base_dir, "config"),
            recursive=False)

        config_file_observer.start()

        self.controller_config["config_file_observer"] = config_file_observer
        self.controller_config["file_change_handler"] = file_change_handler
        self.controller_config["config_current"] = True

        log("end read_app_config")

        return True
Example #4
0
    def read_output_config(self):
        """
        reads the outputs config json file and returns the dict
        for the output associated with this action
        """
        if self.output_dict:
            return self.output_dict

        self.output_config = fileio.load_config_from_json_file(
            "config/outputs.json")
        output = [
            o for o in self.output_config if o["name"] == self.output_name]
        if not output or output.count == 0:
            raise Exception(
                "Output '{}' not found. program: {}".format(self.output_name,
                                                            self.program.name))

        self.output_dict = output[0]
        return self.output_dict