chore: fix r profile#269
Conversation
| # Simple validation to prevent broken URLs | ||
| if [ -z "$R_VERSION" ] || [ -z "$UBUNTU_CODENAME" ]; then | ||
| echo "Error: Failed to detect environment variables for R profile." | ||
| exit 1 |
There was a problem hiding this comment.
I'm a little bit concerned about doing an exit 1 here when it fails to get the r version or ubuntu version, as this would prevent the pod from spinning up completely.
If someone is only using python in their notebook for example, a failing R setup shouldn't prevent them from using their notebook.
I'm thinking that it may be more safe to do an if..else here? Like
if [ -z "$R_VERSION" ] || [ -z "$UBUNTU_CODENAME" ]; then
echo "Error: Failed to detect environment variables for R profile."
else
PPM_URL="https...."
....
fi
That way, we at least log the problem and we have a trace of it when debugging if an error occurs, but it won't prevent the pod from starting.
But I am open to your thoughts on this!
|
|
||
| PPM_URL="https://${serviceaccountname}:${serviceaccounttoken}@artifactory.cloud.statcan.ca/artifactory/zone-r-ppm-bin-${UBUNTU_CODENAME}-${R_VERSION}-remote" | ||
|
|
||
| cat >> /opt/conda/lib/R/etc/Rprofile.site << EOF |
There was a problem hiding this comment.
I noticed you changed the command from a cat > to cat >> command, which means this now appends to the file instead of overwriting the file.
I don't see an immediate issue with this since this file should not be on persistent storage, so it should be resulting the same (and I tested with a notebook restart to confirm this). And this keeps our start up script a bit cleaner by avoid having to re-write the "plot_mimetypes" line.
I just wanted to comment on this point, I am not asking for a change here unless you feel the need to revert back.
There was a problem hiding this comment.
During my testing, I realized we already had an Rprofile.site, so I wanted to append to it rather than just overwrite it.
mathis-marcotte
left a comment
There was a problem hiding this comment.
LGTM
Tested on artifactory.cloud.statcan.ca/das-aaw-docker/jupyterlab-cpu:1a3b17065fa35de39f03eb47bd2733d0918cd424
Was able to successfully install an R package with install.packages("janitor") (using R studios)
Fixes the R Profile generation by replacing unreliable regex with robust regex.
jira: https://jirab.statcan.ca/browse/ZONE-465