You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I poked around a bit and made some progress on automatically committing unsaved work in editor sessions. My approach is to run a script on the AE master (outside.sh) (or anywhere that you have kubectl access). That script copies a second script (commit.sh) into the running session and then executes it. I'm currently hitting an issue where I'm getting a 403 from the git server inside the pod. If / when I figure that out I'll update this issue. Thanks @A-Aron-T
The usage here is: $ bash outside.sh <pod name>
outside.sh:
#!/bin/bash
COMMIT_SCRIPT="./commit.sh"
PATH_IN_POD="/tmp/${COMMIT_SCRIPT}"
SESSION_POD=$1echo"Session pod name is ${SESSION_POD}"# get the name of the sidecar container#SIDECAR_CONTAINER=$(kubectl describe po ${SESSION_POD} | grep tool-anaconda-platform-sync | sed 's/[ :]//g')#echo "Sidecar container is ${SIDECAR_CONTAINER}"
kubectl cp ${COMMIT_SCRIPT}${SESSION_POD}:${PATH_IN_POD}#kubectl cp ${COMMIT_SCRIPT} ${SESSION_POD}:${PATH_IN_POD} -c ${SIDECAR_CONTAINER}#kubectl exec ${SESSION_POD} -c ${SIDECAR_CONTAINER} -- ${PATH_IN_POD}echo Executing bash script
kubectl exec${SESSION_POD} -- sudo -u anaconda ${PATH_IN_POD}```commit.sh:```bash
#!/bin/bashecho Switching to anaconda user
echo whoami: $(whoami)echo activating lab_launch
source /opt/continuum/anaconda/bin/activate lab_launch
echocd to project directory
pushd /opt/continuum/project
git add .
git commit -am "Automatic commit from command lineDate: $(date)Reason: Reason why your code was auto committed"
cur_branch=$(git rev-parse --abbrev-ref HEAD)
git push origin ${cur_branch}popd
Things that should be considered:
Q: What if there's a huge file?
A: Consider figuring out which files are big and commit them with git-lfs. You could achieve this with something like a find command to find the large files and then add them to be committed.
Q: What about the jupyter checkpoints from unsaved notebooks?
A: I don't think there's anyway way to force the browser to save an unsaved notebook. Though I'm hopeful to be wrong here.
The text was updated successfully, but these errors were encountered:
I poked around a bit and made some progress on automatically committing unsaved work in editor sessions. My approach is to run a script on the AE master (
outside.sh
) (or anywhere that you havekubectl
access). That script copies a second script (commit.sh
) into the running session and then executes it.I'm currently hitting an issue where I'm getting a 403 from the git server inside the pod. If / when I figure that out I'll update this issue.Thanks @A-Aron-TThe usage here is:
$ bash outside.sh <pod name>
outside.sh:
Things that should be considered:
Q: What if there's a huge file?
A: Consider figuring out which files are big and commit them with git-lfs. You could achieve this with something like a
find
command to find the large files and then add them to be committed.Q: What about the jupyter checkpoints from unsaved notebooks?
A: I don't think there's anyway way to force the browser to save an unsaved notebook. Though I'm hopeful to be wrong here.
The text was updated successfully, but these errors were encountered: