コード例 #1
0
# http://numenta.org/licenses/
# ----------------------------------------------------------------------

# 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

    ::

        DELETE /_instances
コード例 #2
0
from nta.utils import amqp
from nta.utils.dynamodb_utils import retryOnTransientDynamoDBError

import taurus.engine
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
  publishing to dynamodb.
コード例 #3
0
ファイル: models_api.py プロジェクト: darian19/what
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', 'MetricDataHandler',
      '/([-\w]*)/export', 'ModelExportHandler',
)



# Schema for validating custom metrics model creation
コード例 #4
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
  ]
コード例 #5
0
ファイル: webapp.py プロジェクト: AmitShah/numenta-apps
#
# 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):
コード例 #6
0
ファイル: webapp.py プロジェクト: sergius/numenta-apps
#
# You should have received a copy of the GNU General 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,
                                       tweets_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,
    "/_tweets",
    tweets_api.app)