예제 #1
0
from taurus_engine import taurus_logging
from taurus_engine.exceptions import InsufficientConfigurationError
from taurus_engine.runtime.dynamodb.definitions import (
  InstanceDataHourlyDynamoDBDefinition,
  MetricDynamoDBDefinition,
  MetricDataDynamoDBDefinition,
  MetricTweetsDynamoDBDefinition)

from htmengine import htmengineerrno, utils
from htmengine.runtime.anomaly_service import AnomalyService

from taurus_engine import logging_support



g_log = taurus_logging.getExtendedLogger(__name__)



# FIXME Hack around boto bug #2413
# See https://github.com/boto/boto/issues/2413
FIXED_DYNAMODB_CONTEXT = Context(
  Emin=-128,
  Emax=126,
  rounding=None,
  prec=5, # Reduce precision for overall reduction in payload size
  traps=[
    Clamped,
    Overflow,
    Underflow
  ]
예제 #2
0
from htmengine import utils
from htmengine.adapters.datasource import createDatasourceAdapter
import htmengine.exceptions as app_exceptions

from taurus_engine import config, repository, taurus_logging
from taurus_engine.repository import schema
from taurus_engine.webservices import ManagedConnectionWebapp
from taurus_engine.webservices.handlers import AuthenticatedBaseHandler
from taurus_engine.webservices.responses import (InvalidRequestResponse,
                                                 NotAllowedResponse)
from taurus_engine.webservices.utils import getMetricDisplayFields, loadSchema

_PROCESSING_TIME_PER_RECORD = 0.05  # seconds per record

log = taurus_logging.getExtendedLogger("webservices")

urls = (
    '',
    'ModelHandler',
    '/',
    'ModelHandler',
    '/data',
    'MetricDataHandler',
    '/data/stats',
    'MetricDataStatsHandler',
    '/export',
    'ModelExportHandler',
    '/([-\w]*)',
    'ModelHandler',
    '/([-\w]*)/data',
예제 #3
0
# See the GNU Affero Public License for more details.
#
# You should have received a copy of the GNU Affero Public License
# along with this program.  If not, see http://www.gnu.org/licenses.
#
# http://numenta.org/licenses/
# ----------------------------------------------------------------------
import web

from taurus_engine import logging_support
from taurus_engine.taurus_logging import getExtendedLogger
from taurus_engine.webservices import (instances_api, metrics_api, models_api)

logging_support.LoggingSupport.initService()

log = getExtendedLogger("webapp-logger")

urls = (
    # Web UI
    "",
    "DefaultHandler",
    "/",
    "DefaultHandler",
    "/_instances",
    instances_api.app,
    "/_metrics",
    metrics_api.app,
    "/_models",
    models_api.app)

예제 #4
0
# pylint: disable=C0103,W1401

import web

from htmengine import utils

from taurus_engine import repository, taurus_logging
from taurus_engine.webservices import ManagedConnectionWebapp
from taurus_engine.webservices.handlers import AuthenticatedBaseHandler
from taurus_engine.webservices.models_api import ModelHandler
from taurus_engine.webservices.responses import InvalidRequestResponse



log = taurus_logging.getExtendedLogger("webservices")

urls = (
  "/?", "InstancesHandler",
)



class InstancesHandler(AuthenticatedBaseHandler):


  def DELETE(self):
    """
    Delete models for multiple instances

    ::
예제 #5
0
#
# http://numenta.org/licenses/
# ----------------------------------------------------------------------
import web

from taurus_engine import logging_support
from taurus_engine.taurus_logging import getExtendedLogger
from taurus_engine.webservices import (instances_api,
                                       metrics_api,
                                       models_api)



logging_support.LoggingSupport.initService()

log = getExtendedLogger("webapp-logger")



urls = (
  # Web UI
  "", "DefaultHandler",
  "/", "DefaultHandler",
  "/_instances", instances_api.app,
  "/_metrics", metrics_api.app,
  "/_models", models_api.app
)



class DefaultHandler(object):
from taurus_engine import taurus_logging
from taurus_engine.exceptions import InsufficientConfigurationError
from taurus_engine.runtime.dynamodb.definitions import (
    InstanceDataHourlyDynamoDBDefinition,
    MetricDynamoDBDefinition,
    MetricDataDynamoDBDefinition,
    MetricTweetsDynamoDBDefinition,
)

from htmengine import htmengineerrno, utils
from htmengine.runtime.anomaly_service import AnomalyService

from taurus_engine import logging_support


g_log = taurus_logging.getExtendedLogger(__name__)


# FIXME Hack around boto bug #2413
# See https://github.com/boto/boto/issues/2413
FIXED_DYNAMODB_CONTEXT = Context(
    Emin=-128,
    Emax=126,
    rounding=None,
    prec=5,  # Reduce precision for overall reduction in payload size
    traps=[Clamped, Overflow, Underflow],
)


def convertDefineModelResultToMetricItem(modelCommandResult):
    """ Convert "defineModel" Model Command Result to MetricItem suitable for