Skip to content
This repository was archived by the owner on Dec 18, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/analyzer/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
import statsmodels.api as sm
import traceback
import logging
import imp
import sys
from time import time
from msgpack import unpackb, packb
from redis import StrictRedis

from settings import (
CUSTOM_ALGORITHM_MODULE,
ALGORITHMS,
CONSENSUS,
FULL_DURATION,
Expand All @@ -22,6 +25,16 @@

from algorithm_exceptions import *

# If you have a custom module for algorithms, load it here and inject into globals
if CUSTOM_ALGORITHM_MODULE:
try:
m = imp.load_module(CUSTOM_ALGORITHM_MODULE, *imp.find_module(CUSTOM_ALGORITHM_MODULE))
sys.modules['tmp_algorithms'] = m
from tmp_algorithms import *
except:
pass


logger = logging.getLogger("AnalyzerLog")
redis_conn = StrictRedis(unix_socket_path=REDIS_SOCKET_PATH)

Expand Down
4 changes: 4 additions & 0 deletions src/settings.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ ALGORITHMS = [
'ks_test',
]

# This allows a custom module to be loaded into the global namespace of the algorithm.py
# file. Use this to bring in function from outside of skyline
CUSTOM_ALGORITHM_MODULE = ''

# This is the number of algorithms that must return True before a metric is
# classified as anomalous.
CONSENSUS = 6
Expand Down