we generate an environment file programtically, here is how the resultant file looks like:
FROM mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu20.04
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN echo "source /opt/miniconda/etc/profile.d/conda.sh && conda activate" >> ~/.bashrc
RUN echo $'channels:\n\
- anaconda\n\
- conda-forge\n\
- defaults\n\
dependencies:\n\
- python=3.8.10\n\
- pip:\n\
- azureml-sdk==1.50.0\n\
- azureml-dataset-runtime==1.50.0\n\
- azure-storage-blob\n\
- numpy==1.23.5\n\
- pandas==2.0.0\n\
- scipy==1.5.2\n\
- scikit-learn==1.2.2\n\
- azure-eventgrid==4.9.0\n\
- conda:\n\
- conda=23.3.0' > conda_env.yml
RUN source /opt/miniconda/etc/profile.d/conda.sh && conda activate && conda install conda && pip install cmake && conda env update -f conda_env.yml
ENV cluster_identity_name=clisyer-ide-name
ENV cluster_identity_id=1234567
ENV data_drift_event_topic_name=someName
ENV sa_name=someStorage
And the image builds successfully, the env vars are okay as I see in logs:
But, when I try to access this environment programmatically:
if environment_name in environments:
restored_environment = environments[environment_name]
logging.info('Found environment: %s:%s', restored_environment.name, restored_environment.version)
I see the outout here which is correct name and correct version. But printing the environment variables returns this:
Only example env var is there and not the ones we set in the dokcer file.
However, I see the environment definition after fetching the environment and I can see the json containing ENV definitions:
Am I doing something wrong when accessing the environment variables? Can someone plz help?