How to use the grok.grok_logging.getExtendedLogger function in grok

To help you get started, we’ve selected a few grok examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github numenta / numenta-apps / grok / grok / app / webservices / autostacks_api.py View on Github external
import htmengine.model_swapper.utils as model_swapper_utils
from grok.app.adapters.datasource import (createAutostackDatasourceAdapter,
                                          createCloudwatchDatasourceAdapter)
from grok.app.exceptions import DuplicateRecordError, ObjectNotFoundError
from grok.app.webservices import (AuthenticatedBaseHandler,
                                  ManagedConnectionWebapp)
from grok.app.webservices.responses import (InvalidRequestResponse,
                                            quotaErrorResponseWrapper)
from grok.app.webservices.utils import (getMetricDisplayFields,
                                        convertMetricRowToMetricDict)
from grok.app.exceptions import QuotaError
from grok import grok_logging
from grok.app import repository
from grok.app.quota import checkQuotaForInstanceAndRaise

log = grok_logging.getExtendedLogger("webservices")

urls = (
  r"/preview_instances/?", "AutostackInstancesHandler",
  r"/([-\w]+)/?", "AutostackHandler",
  r"/([-\w]+)/metrics/?([-\w]*)", "AutostackMetricsHandler",
  r"/([-\w]+)/instances/?", "AutostackInstancesHandler",
  r"/?", "AutostacksHandler",
 )



class AutostacksHandler(AuthenticatedBaseHandler):

  def GET(self): # pylint: disable=C0103
    """
      Get list of autostacks
github numenta / numenta-apps / grok / grok / app / runtime / metric_collector.py View on Github external
def _getLogger():
  return grok_logging.getExtendedLogger(_MODULE_NAME)
github numenta / numenta-apps / grok / grok / app / quota.py View on Github external
def _getLogger():
  return grok_logging.getExtendedLogger("grok.app.quota")
github numenta / numenta-apps / grok / grok / app / webservices / instances_api.py View on Github external
from grok.app.webservices import (AuthenticatedBaseHandler,
                                  ManagedConnectionWebapp)
from grok.app.webservices.models_api import ModelHandler
from grok.app.webservices.responses import (
    quotaErrorResponseWrapper,
    InvalidRequestResponse)
from grok.app.webservices.utils import encodeJson, loadSchema

# Number of instances to suggest (pre-checked)
_NUM_SUGGESTED_INSTANCES = 8
# Max number of instances to suggest including alternates (unchecked)
_MAX_SUGGESTED_INSTANCES_TOTAL = 28
# Time limit for fetching AWS instances
_AWS_INSTANCE_FETCHING_TIME_LIMIT = 5.0

log = grok_logging.getExtendedLogger("webservices")

urls = (
  "/(.+?)/(.+?\/.+?)/(.+\/*.+)", "InstanceDefaultsHandler",
  "/(.+)/(.+\/.+)", "InstanceDefaultsHandler",
  "/?", "InstancesHandler",
  # /_instances/suggestions
  "/suggestions", "InstanceSuggestionsHandler",
  # /_instances/suggestions/us-west-2
  "/suggestions/(.+?)", "InstanceSuggestionsHandler",
)

# Validation schema to ensure we are getting an array of strings.
# Does not validate valid region or namespace, those are handled elsewhere.
_INSTANCES_MODEL_CREATION_SCHEMA = loadSchema(
  "instances_model_creation_schema.json")
github numenta / numenta-apps / grok / grok / app / webservices / custom_api.py View on Github external
# http://numenta.org/licenses/
# ----------------------------------------------------------------------

import json

import web

from grok.app.adapters.datasource import createDatasourceAdapter
from grok.app import exceptions as app_exceptions, repository
from grok.app.webservices import (AuthenticatedBaseHandler,
                                  ManagedConnectionWebapp)
from grok.app.webservices.utils import (getMetricDisplayFields,
                                        convertMetricRowToMetricDict)
from grok import grok_logging

LOGGER = grok_logging.getExtendedLogger(__name__)

urls = (
  # /_metrics/custom
  '', "CustomDefaultHandler",
  # /_metrics/custom/
  '/', "CustomDefaultHandler",
  # /_metrics/custom/
  '/([\w\.\-]+)', "CustomDefaultHandler",
)



class CustomDefaultHandler(AuthenticatedBaseHandler):


  def GET(self):
github numenta / numenta-apps / grok / grok / app / webservices / support_api.py View on Github external
#
# http://numenta.org/licenses/
# ----------------------------------------------------------------------
# pylint: disable=C0103,W1401

import os.path

import web

import grok.app

from htmengine import utils
from grok.app.webservices import AuthenticatedBaseHandler
from grok import grok_logging

log = grok_logging.getExtendedLogger("webservices")

urls = (
  '', "SupportHandler"
)

FLAG_DIR = '/tmp/'
FLAG_FILE = FLAG_DIR + 'enable_support_access'


class SupportHandler(AuthenticatedBaseHandler):

  # is support access allowed? does flag file exist?
  def GET(self):
    res = os.path.isfile(FLAG_FILE)
    web.header('Content-Type', 'application/json; charset=UTF-8', True)
    return utils.jsonEncode({'result': res})