Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
This repository was archived by the owner on May 22, 2025. It is now read-only.

execute-notebook-on-startup [Script doesn't work] #105

Open
@dineshmane

Description

@dineshmane

Hi,
I tried to execute the script given at https://github.com/aws-samples/amazon-sagemaker-notebook-instance-lifecycle-config-samples/blob/master/scripts/execute-notebook-on-startup/on-start.sh

found two error while running:
environment not found
jupyter nbconvert cmd didn't run as expected due to one missing argument.

Attaching the correct script.



#!/bin/bash

set -e

# OVERVIEW
# This script executes an existing Notebook file on the instance during start using nbconvert(https://github.com/jupyter/nbconvert)

# PARAMETERS

ENVIRONMENT=python3
NOTEBOOK_FILE=/home/ec2-user/SageMaker/MyNotebook.ipynb

source /home/ec2-user/anaconda3/bin/activate "$ENVIRONMENT"

jupyter nbconvert  --to notebook --ExecutePreprocessor.kernel_name=python3 --execute "$NOTEBOOK_FILE"

source /home/ec2-user/anaconda3/bin/deactivate

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions