def add_to_logbook()

in sagemaker_notebook_instance/env_setup.py [0:0]


def add_to_logbook(hostname: str, executable: str) -> None:
    if (hostname is None) or (executable is None):
        logging.warn('Could not add to logbook because either hostname or executable is empty.')
    else:
        new_entry = {'hostname': hostname, 'executable': executable}
        if LOGBOOK_FILE.is_file():
            with open(LOGBOOK_FILE, 'r') as f:
                logbook = json.load(f)
        else:
            logbook = []
        for entry in logbook:
            if (entry['hostname'] == hostname) and (entry['executable'] == executable):
                return  # don't need to add since already in logbook
        logbook.append(new_entry)
        with open(LOGBOOK_FILE, 'w') as f:
            json.dump(logbook, f)