How to use the hdijupyterutils.hdijupyterutils.filesystemreaderwriter.FileSystemReaderWriter function in hdijupyterutils

To help you get started, we’ve selected a few hdijupyterutils 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 / hdijupyterutils / hdijupyterutils / filehandler.py View on Github external
def __init__(self, **kwargs):
        # Simply invokes the behavior of the superclass, but sets the filename keyword argument if it's not already set.
        if 'filename' in kwargs:
            super(MagicsFileHandler, self).__init__(**kwargs)
        else:
            magics_home_path = kwargs.pop(u"home_path")
            logs_folder_name = "logs"
            log_file_name = "log_{}.log".format(get_instance_id())
            directory = FileSystemReaderWriter(join_paths(magics_home_path, logs_folder_name))
            directory.ensure_path_exists()
            super(MagicsFileHandler, self).__init__(filename=join_paths(directory.path, log_file_name), **kwargs)