How to use the sparkmagic.utils.sparklogger.SparkLog function in sparkmagic

To help you get started, we’ve selected a few sparkmagic 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 jupyter-incubator / sparkmagic / sparkmagic / sparkmagic / magics / sparkmagicsbase.py View on Github external
def __init__(self, shell, data=None, spark_events=None):
        # You must call the parent constructor
        super(SparkMagicBase, self).__init__(shell)

        self.logger = SparkLog(u"SparkMagics")
        self.ipython_display = IpythonDisplay()
        self.spark_controller = SparkController(self.ipython_display)

        self.logger.debug("Initialized spark magics.")

        if spark_events is None:
            spark_events = SparkEvents()
        spark_events.emit_library_loaded_event()
github jupyter-incubator / sparkmagic / sparkmagic / sparkmagic / kernels / wrapperkernel / sparkkernelbase.py View on Github external
def __init__(self, implementation, implementation_version, language, language_version, language_info,
                 session_language, user_code_parser=None, **kwargs):
        # Required by Jupyter - Override
        self.implementation = implementation
        self.implementation_version = implementation_version
        self.language = language
        self.language_version = language_version
        self.language_info = language_info

        # Override
        self.session_language = session_language

        super(SparkKernelBase, self).__init__(**kwargs)

        self.logger = SparkLog(u"{}_jupyter_kernel".format(self.session_language))
        self._fatal_error = None
        self.ipython_display = IpythonDisplay()

        if user_code_parser is None:
            self.user_code_parser = UserCodeParser()
        else:
            self.user_code_parser = user_code_parser

        # Disable warnings for test env in HDI
        requests.packages.urllib3.disable_warnings()

        if not kwargs.get("testing", False):
            self._load_magics_extension()
            self._change_language()
            if conf.use_auto_viz():
                self._register_auto_viz()
github jupyter-incubator / sparkmagic / sparkmagic / sparkmagic / livyclientlib / sparkcontroller.py View on Github external
def __init__(self, ipython_display):
        self.logger = SparkLog(u"SparkController")
        self.ipython_display = ipython_display
        self.session_manager = SessionManager()
github jupyter-incubator / sparkmagic / sparkmagic / sparkmagic / livyclientlib / reliablehttpclient.py View on Github external
def __init__(self, endpoint, headers, retry_policy):
        self._endpoint = endpoint
        self._headers = headers
        self._retry_policy = retry_policy
        if self._endpoint.auth == constants.AUTH_KERBEROS:
            self._auth = HTTPKerberosAuth(mutual_authentication=REQUIRED)
        elif self._endpoint.auth == constants.AUTH_BASIC:
            self._auth = (self._endpoint.username, self._endpoint.password)
        elif self._endpoint.auth != constants.NO_AUTH:
            raise BadUserConfigurationException(u"Unsupported auth %s" %self._endpoint.auth)

        self.logger = SparkLog(u"ReliableHttpClient")

        self.verify_ssl = not conf.ignore_ssl_errors()
        if not self.verify_ssl:
            self.logger.debug(u"ATTENTION: Will ignore SSL errors. This might render you vulnerable to attacks.")
            requests.packages.urllib3.disable_warnings()
github jupyter-incubator / sparkmagic / sparkmagic / sparkmagic / livyclientlib / sparkcontroller.py View on Github external
def __init__(self, ipython_display):
        self.logger = SparkLog(u"SparkController")
        self.ipython_display = ipython_display
        self.session_manager = SessionManager(ipython_display)
github jupyter-incubator / sparkmagic / sparkmagic / sparkmagic / serverextension / handlers.py View on Github external
def post(self):
        self.logger = SparkLog(u"ReconnectHandler")

        spark_events = self._get_spark_events()

        try:
            data = json_decode(self.request.body)
        except ValueError as e:
            self.set_status(400)
            msg = "Invalid JSON in request body."
            self.logger.error(msg)
            self.finish(msg)
            spark_events.emit_cluster_change_event(None, 400, False, msg)
            return

        endpoint = None
        try:
            path = self._get_argument_or_raise(data, 'path')
github jupyter-incubator / sparkmagic / sparkmagic / sparkmagic / livyclientlib / sessionmanager.py View on Github external
def __init__(self):
        self.logger = SparkLog(u"SessionManager")

        self._sessions = dict()
github jupyter-incubator / sparkmagic / sparkmagic / sparkmagic / livyclientlib / command.py View on Github external
def __init__(self, code, spark_events=None):
        super(Command, self).__init__()
        self.code = textwrap.dedent(code)
        self.logger = SparkLog(u"Command")
        if spark_events is None:
            spark_events = SparkEvents()
        self._spark_events = spark_events
github jupyter-incubator / sparkmagic / sparkmagic / sparkmagic / controllerwidget / manageendpointwidget.py View on Github external
def __init__(self, spark_controller, ipywidget_factory, ipython_display, endpoints, refresh_method):
        # This is nested
        super(ManageEndpointWidget, self).__init__(spark_controller, ipywidget_factory, ipython_display, True)

        self.logger = SparkLog("ManageEndpointWidget")
        self.endpoints = endpoints
        self.refresh_method = refresh_method

        self.children = self.get_existing_endpoint_widgets()

        for child in self.children:
            child.parent_widget = self