Submit your innovative use case or inspiring success story to the 2023 Dataiku Frontrunner Awards! LET'S GO

Adding a code environment to a code studio template

Solved!
samanthamarkley
Level 1
Adding a code environment to a code studio template

I have created a code studio template that allows me to run Voila within my DSS instance, but I am having issues attaching a code environment to the template.

I have tried adding the code environment block to the template but have had no success. The only way I have been able to get the Python packages into the template is by installing them via the append to dockerfile block, but this is not ideal for my use case.

Any ideas on how I can include a code environment in the code studio template?

0 Kudos
1 Solution
samanthamarkley
Level 1
Author

The solution that worked for this was to first add my code environment block to my template and then active this code environment in my entrypoint file like:

# Activate code environment
source /opt/dataiku/python-code-envs/webapp_env/bin/activate

# Run the webapp
/opt/dataiku/python-code-envs/webapp_env/bin/python -m voila --Voila.ip="$BIND_ADDR" --no-browser --Voila.tornado_settings="{'allow_origin': '*'}" --Voila.base_url="$BASE_URL/" --port=8866 /home/dataiku/workspace/code_studio-versioned/Untitled.ipynb

These steps replaced the need for the "Append to Dockerfile" block. Note of caution: make sure you carefully select the Python and package versions, conflicts will cause the code studio to fail!

View solution in original post

2 Replies
JordanB
Dataiker

Hi @samanthamarkley,

You will need to build a template for CodeStudio with VScode and select a block type "ADD Code Environment" and then select the one you want to use. For new code env, create a new template.
 
 
Screen Shot 2023-03-24 at 5.45.12 PM.png
 
Thanks!
Jordan
0 Kudos
samanthamarkley
Level 1
Author

The solution that worked for this was to first add my code environment block to my template and then active this code environment in my entrypoint file like:

# Activate code environment
source /opt/dataiku/python-code-envs/webapp_env/bin/activate

# Run the webapp
/opt/dataiku/python-code-envs/webapp_env/bin/python -m voila --Voila.ip="$BIND_ADDR" --no-browser --Voila.tornado_settings="{'allow_origin': '*'}" --Voila.base_url="$BASE_URL/" --port=8866 /home/dataiku/workspace/code_studio-versioned/Untitled.ipynb

These steps replaced the need for the "Append to Dockerfile" block. Note of caution: make sure you carefully select the Python and package versions, conflicts will cause the code studio to fail!