Пример #1
0
    def detect_app_change(self):
        while 1:
            try:
                current_app_base_version, current_app_changes = discipline_coach.get_git_dir_version(
                    VEIL_HOME, depress_log=True
                )
            except Exception:
                pass
            else:
                if self.init_app_base_version:
                    if self.init_app_base_version != current_app_base_version:
                        LOGGER.info("application base version changed: reload now")
                        self.init_app_base_version = current_app_base_version
                        return True
                else:
                    self.init_app_base_version = current_app_base_version

                if self.init_app_changes:
                    if is_python_source_code_changed(self.init_app_changes, current_app_changes):
                        LOGGER.info("application python source code changed: reload now")
                        self.init_app_changes = current_app_changes
                        return True
                else:
                    self.init_app_changes = current_app_changes
                return False
Пример #2
0
 def __init__(self):
     super(SourceCodeMonitor, self).__init__()
     self.daemon = True
     self.init_app_base_version = None
     self.init_app_changes = None
     self.init_framework_base_version = None
     self.init_framework_changes = None
     try:
         self.init_app_base_version, self.init_app_changes = discipline_coach.get_git_dir_version(
             VEIL_HOME, depress_log=True
         )
     except Exception:
         pass
     try:
         self.init_framework_base_version, self.init_framework_changes = discipline_coach.get_git_dir_version(
             VEIL_FRAMEWORK_HOME, depress_log=True
         )
     except Exception:
         pass