From ef58c2438f8b3f1db2f2fc7b372e262a3e7883fc Mon Sep 17 00:00:00 2001 From: steveri Date: Fri, 22 Sep 2023 10:38:28 -0700 Subject: [PATCH 1/5] Aha no heroku cleanup (#1776) * little refactor plus better usage of env file for passing info between steps * refactor function from custom-checkout to separate script set-trigfrom-and-reqtype * much simpler submodule-discover-and-update * no more hofstee * replace old code w new REQUEST_TYPE mechanism * purging heroku from the system * clone dir must be empty AND EXTANT before cloning * temporarily need to use dev branch in place of master maybe * better hack for aha-flow development branches * problems with "buildkite-agent annotate" * double-dollar problems AGAIN * tweaking comments / log outputs --- .buildkite/bin/custom-checkout.sh | 186 +++------------------ .buildkite/bin/set-trigfrom-and-reqtype.sh | 57 +++++++ .buildkite/bin/update-pr-repo.sh | 7 +- .buildkite/hooks/post-checkout | 14 -- .buildkite/hooks/pre-exit | 31 ---- .buildkite/pipeline.yml | 84 ++++++---- 6 files changed, 131 insertions(+), 248 deletions(-) create mode 100644 .buildkite/bin/set-trigfrom-and-reqtype.sh delete mode 100644 .buildkite/hooks/post-checkout delete mode 100644 .buildkite/hooks/pre-exit diff --git a/.buildkite/bin/custom-checkout.sh b/.buildkite/bin/custom-checkout.sh index dd4b2800..faa9b4c2 100755 --- a/.buildkite/bin/custom-checkout.sh +++ b/.buildkite/bin/custom-checkout.sh @@ -1,150 +1,38 @@ #!/bin/bash # What this script does: -# - Update and initialize all aha repo submodules. -# - Check out aha branch BUILDKITE_COMMIT if build triggered from aha repo -# or AHA DEFAULT (no-heroku now, master later) if triggered from submod push/pull. +# - Check out aha branch BUILDKITE_COMMIT if build triggered from aha repo. +# - Else check out master if triggered from submod push/pull. +# - Update and initialize all submodules. # - If triggered from submod, update submod to match commit hash of triggering repo. # Setup set +u # nounset? not on my watch! set +x # debug OFF -PS4="_" # Prevents "+++" prefix during 3-deep "set -x" execution +PS4=">" # Prevents "+++" prefix during 3-deep "set -x" execution -echo "--- CHECKOUT FULL REPO, submodules and all" - -# Checkout -echo "+++ custom-checkout.sh BEGIN" -echo I am `whoami` +echo "+++ BEGIN custom-checkout.sh" echo I am in dir `pwd` -cd $BUILDKITE_BUILD_CHECKOUT_PATH # Just in case, I dunno, whatevs. - - -############################################################################## -# FIXME yeah okay this could be offloaded as a separate script maybe something -# like "source annotate-w-pr-links.sh" -echo "+++ BEGIN TRIGGERED-FROM LINKS" - -# If pull request, show where request came from. -if [ "$BUILDKITE_PULL_REQUEST_REPO" ]; then - # BUILDKITE_PULL_REQUEST_REPO="https://github.com/StanfordAHA/lake.git" - # BUILDKITE_PULL_REQUEST="166" - # BUILDKITE_COMMIT=7c5e88021a01fef1a04ea56b570563cae2050b1f - - # E.g. repo="https://github.com/StanfordAHA/lake" - repo=`echo "$BUILDKITE_PULL_REQUEST_REPO" | sed 's/.git$//'` - r=`echo "$repo" | sed 's/http.*github.com.//'` - - # E.g. url_cm="https://github.com/StanfordAHA/lake/commit/7c5...0b1f" - first7=`expr "$BUILDKITE_COMMIT" : '\(.......\)'` # 7c5e880 - url_cm=${repo}/commit/${BUILDKITE_COMMIT} - mdlink_cm="[${first7}](${url_cm})" - - # E.g. url_pr="https://github.com/StanfordAHA/lake/pull/166" - url_pr=${repo}/pull/${BUILDKITE_PULL_REQUEST} - mdlink_pr="[Pull Request #${BUILDKITE_PULL_REQUEST}](${url_pr})" - - # E.g. "Triggered from StanfordAHA/canal ca602ef (Pull Request #58)" - cat < $commdir/DO_PR-${BUILDKITE_BUILD_NUMBER} + echo "Push or PR from aha repo: check out requested aha branch $BUILDKITE_COMMIT" + git fetch -v --prune -- origin $BUILDKITE_COMMIT + git checkout -qf $BUILDKITE_COMMIT fi -echo "--- Check out appropriate AHA branch: $BUILDKITE_COMMIT, $DEV_BRANCH, or master" -cd $BUILDKITE_BUILD_CHECKOUT_PATH -# FIXME can delete DEV_BRANCH part once dev branch merges to master FIXME -DEV_BRANCH=remotes/origin/no-heroku -echo 'git checkout -qf $BUILDKITE_COMMIT || git checkout -qf $DEV_BRANCH || git checkout -qf master'; set -x - git checkout -qf $BUILDKITE_COMMIT || git checkout -qf $DEV_BRANCH || git checkout -qf master - -echo "--- PREP AHA REPO and all its submodules"; set -x -pwd -# E.g. CHECKOUT_PATH=/var/lib/buildkite-agent/builds/r7cad-docker-1/stanford-aha/aha-flow -cd $BUILDKITE_BUILD_CHECKOUT_PATH # Actually I think we're already there but whatevs +echo "--- Initialize all submodules YES THIS TAKES AWHILE" +set -x git submodule update --checkout # This is probably unnecessary but whatevs -git remote set-url origin https://github.com/hofstee/aha git submodule foreach --recursive "git clean -ffxdq" -git clean -ffxdq -set +x - -# FIXME can of course delete this after heroku is gone FIXME -# Heroku always sets message to "PR from " with BUILDKITE_COMMIT="HEAD" -# so as to checkout aha master. Heroku also sends desired submod commit -# hash as env var FLOW_HEAD_SHA. In this new regime, we set BUILDKITE_COMMIT -# as the desired submod commit, and auto-discover the repo that goes with the commit. - -echo "--- See if we need to update a submodule" -unset PR_FROM_SUBMOD - -# PR_FROM_SUBMOD means build was triggered by foreign (non-aha) repo, -# i.e. one of the submods. The submod sends its commit hash BUT DOES -# NOT TELL US WHAT REPO IT IS. :( - -# We detect this by attempting to fetch BUILDKITE_COMMIT from aha repo. -# Success means this is an aha-triggered build. Failure means we need to -# find what repo actually did trigger the commit. - -echo git fetch -v --prune -- origin $BUILDKITE_COMMIT -if git fetch -v --prune -- origin $BUILDKITE_COMMIT; then - - # Pretty sure we already did this, in pipeline.xml BDI step pre-checkout hook - # But what the heck, let's do it again, don't break what is working already. - git checkout -f $BUILDKITE_COMMIT - echo "Found aha commit '$BUILDKITE_COMMIT'; no need to update submodule" - -else - echo '-------------------------------------------' - echo 'REQUESTED COMMIT DOES NOT EXIST in aha repo' - echo '(This must be a pull request from one of the submods)' - echo 'Will checkout aha default branch' - PR_FROM_SUBMOD=true - - # FIXME don't need if-then-else below after dev merges to master. - # Use dev branch as default until it gets merged and deleted. - AHA_DEFAULT_BRANCH=no-heroku - echo "Meanwhile, will use default branch '$AHA_DEFAULT_BRANCH' for aha repo" - if git fetch -v --prune -- origin $AHA_DEFAULT_BRANCH; then - echo "Fetching aha branch '$AHA_DEFAULT_BRANCH'" - git checkout -f $AHA_DEFAULT_BRANCH - else - echo "Aha branch '$AHA_DEFAULT_BRANCH' does not exist" - echo "Fetching aha master branch" - git fetch -v --prune -- origin master - git checkout -f master - fi -fi - -set -x git submodule sync --recursive echo "--- git submodule update --init --recursive --force" git submodule update --init --recursive --force @@ -152,40 +40,12 @@ echo '--- git submodule foreach --recursive "git reset --hard"' git submodule foreach --recursive "git reset --hard" set +x -update_repo=`git config --get remote.origin.url` +# Update submod -# To find out what repo triggered the commit, we iterate through -# all the submodules and find which one can successfully checkout -# the desired BUILKITE_COMMIT. - -# NOTE this is not necessary for pull requests, which embed the -# repo information as BUILDKITE_PULL_REQUEST. Push requests have -# no such mechanism however :( -# In general we don't process push requests from submodules, but -# this was useful for development etc. - -if [ "$PR_FROM_SUBMOD" ]; then - echo "--- Handle PR" - echo "+++ Looking for submod commit $BUILDKITE_COMMIT" - unset FOUND_SUBMOD - submods=`git submodule status | awk '{print $2}'` # canal lake hwtypes... - for submod in $submods; do - echo "- " Looking in submod $submod - # --- THIS IS WHERE THE CHECKOUT HAPPENS --- - (set -x; cd $submod; git fetch origin && git checkout $BUILDKITE_COMMIT) && FOUND_SUBMOD=true || echo "NOT " $submod - [ "$FOUND_SUBMOD" ] && echo "- FOUND valid commit in submod" $submod - [ "$FOUND_SUBMOD" ] && break - done - - if [ "$FOUND_SUBMOD" ]; then - echo "--- Updated submodule '$submod' w commit '$BUILDKITE_COMMIT'" - update_repo=`cd $submod; git config --get remote.origin.url` - else - echo "ERROR could not find requesting submod"; exit 13 - fi - set +x -else - echo "--- NOT A PULL REQUEST" +# Note PR_REPO_TAIL comes from set-trigfrom-and-reqtype.sh +if [ "$REQUEST_TYPE" == "SUBMOD_PR" ]; then + echo "--- Update submodule '$PR_REPO_TAIL' w commit '$BUILDKITE_COMMIT'" + (set -x; cd $PR_REPO_TAIL; git fetch origin && git checkout $BUILDKITE_COMMIT) fi -echo "--- custom-checkout.sh END" +echo "--- END custom-checkout.sh" diff --git a/.buildkite/bin/set-trigfrom-and-reqtype.sh b/.buildkite/bin/set-trigfrom-and-reqtype.sh new file mode 100644 index 00000000..36c19964 --- /dev/null +++ b/.buildkite/bin/set-trigfrom-and-reqtype.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +# What does this script do? +# 1. If build was triggered by a pull request, annotate build with +# links pointing to pull request on github. +# 2. Set REQUEST_TYPE to one of "AHA_PUSH", "AHA_PR", or "SUBMOD_PR" +# 3. Set PR_REPO_TAIL to submod associated with the PR, e.g. "canal" +# 4. Add REQUEST_TYPE env temp file for use by later steps + +echo "+++ set-trigfrom-and-reqtype.sh BEGIN" +cd $BUILDKITE_BUILD_CHECKOUT_PATH # Just in case, I dunno, whatevs. + +echo "+++ BEGIN TRIGGERED-FROM LINKS" + +# If pull request, show where request came from. +# And set e.g. PR_REPO_TAIL="lake" +PR_REPO_TAIL= +if [ "$BUILDKITE_PULL_REQUEST_REPO" ]; then + # BUILDKITE_PULL_REQUEST_REPO="https://github.com/StanfordAHA/lake.git" + # BUILDKITE_PULL_REQUEST="166" + # BUILDKITE_COMMIT=7c5e88021a01fef1a04ea56b570563cae2050b1f + + # E.g. repo="https://github.com/StanfordAHA/lake" + repo=`echo "$BUILDKITE_PULL_REQUEST_REPO" | sed 's/.git$//'` + r=`echo "$repo" | sed 's/http.*github.com.//'` # "StanfordAHA/lake" + PR_REPO_TAIL=`echo "$repo" | sed "s,http.*github.com/.*/,,"` # "lake" + echo "Found PR from submod $PR_REPO_TAIL" + + # E.g. url_cm="https://github.com/StanfordAHA/lake/commit/7c5...0b1f" + first7=`expr "$BUILDKITE_COMMIT" : '\(.......\)'` # 7c5e880 + url_cm=${repo}/commit/${BUILDKITE_COMMIT} + mdlink_cm="[${first7}](${url_cm})" + + # E.g. url_pr="https://github.com/StanfordAHA/lake/pull/166" + url_pr=${repo}/pull/${BUILDKITE_PULL_REQUEST} + mdlink_pr="[Pull Request #${BUILDKITE_PULL_REQUEST}](${url_pr})" + + # E.g. "Triggered from StanfordAHA/canal ca602ef (Pull Request #58)" + cat <> $env + +echo "+++ set-trigfrom-and-reqtype.sh END" diff --git a/.buildkite/bin/update-pr-repo.sh b/.buildkite/bin/update-pr-repo.sh index 694d129c..4c8b4ed9 100644 --- a/.buildkite/bin/update-pr-repo.sh +++ b/.buildkite/bin/update-pr-repo.sh @@ -13,12 +13,7 @@ cd $BUILDKITE_BUILD_CHECKOUT_PATH # Just in case, I dunno, whatevs. # Also need to rediscover pull number BUILDKITE_PULL_REQUEST -# FIXME delete this clause after heroku is gone forever -if [ "$FLOW_HEAD_SHA" ]; then - echo "- Heroku build, leave it alone for now" - echo "- Nothing to do, returning to main script." - -elif [ "$BUILDKITE_PULL_REQUEST_REPO" ]; then +if [ "$BUILDKITE_PULL_REQUEST_REPO" ]; then echo "- BUILDKITE_PULL_REQUEST_REPO already set, to '$BUILDKITE_PULL_REQUEST_REPO'" echo "- Nothing to do, returning to main script." diff --git a/.buildkite/hooks/post-checkout b/.buildkite/hooks/post-checkout deleted file mode 100644 index e1e9953b..00000000 --- a/.buildkite/hooks/post-checkout +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -e - -echo "+++ LOCAL POST CHECKOUT FROM AHA REPO" -echo "PWD: " `pwd` - -if [[ ${BUILDKITE_STEP_KEY} =~ ^(docker-build|integration-tests)$ ]]; then - mkdir -p temp - echo Renewing `pwd`/temp/.TEST - rm -rf temp/.TEST - touch temp/.TEST - set +x -else - echo "Nothing to do, not the right step yet" -fi diff --git a/.buildkite/hooks/pre-exit b/.buildkite/hooks/pre-exit deleted file mode 100644 index a77cc7b9..00000000 --- a/.buildkite/hooks/pre-exit +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -e -if [[ ${BUILDKITE_STEP_KEY} =~ ^(docker-build|integration-tests)$ ]]; then - if [[ -f "temp/.TEST" ]]; then - echo "--- Tests failed." - status="failure" - elif [[ ${BUILDKITE_STEP_KEY} = "integration-tests" ]]; then - echo "--- Tests passed!" - status="success" - fi - rm -rf temp/.TEST - - if [[ -n ${FLOW_ORG} ]]; then - case "$status,${BUILDKITE_STEP_KEY}" in - failure,*) ;& - success,integration-tests) - curl -X POST ${FLOW_URL}/aha-flow-app/hook \ - -H "Authorization: ${AHA_FLOW_TOKEN}" \ - -H "content-type: application/json" \ - -d '{ - "org": "'${FLOW_ORG}'", - "repo": "'${FLOW_REPO}'", - "head_sha": "'${FLOW_HEAD_SHA}'", - "status": "'completed'", - "conclusion": "'${status}'", - "id": "'${FLOW_ID}'", - "url": "'${BUILDKITE_BUILD_URL}'" - }' - ;; - esac - fi -fi diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 7268818f..743c8889 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -17,9 +17,47 @@ steps: # Req from submod repo: check out aha master branch, update submod w BUILDKITE_COMMIT pre-checkout: | echo "+++ BDI PRE CHECKOUT HOOK" - source $BUILDKITE_BUILD_CHECKOUT_PATH/.buildkite/bin/update-pr-repo.sh + set +u # nounset? not on my watch! + + if [ "$$FLOW_HEAD_SHA" ]; then + echo "+++ ERROR Not processing heroku requests anymore"; exit 13; fi + + # Clone the aha repo; starting in root dir '/' I think + echo I am in dir `pwd` + aha_clone=$BUILDKITE_BUILD_CHECKOUT_PATH; + set -x + /bin/rm -rf $$aha_clone; mkdir -p $$aha_clone + git clone https://github.com/StanfordAHA/aha $$aha_clone; cd $$aha_clone; + git remote set-url origin https://github.com/StanfordAHA/aha # Why? + git clean -ffxdq + set +x + + # Use this hack to (temporarily) use dev branches during development + USING_MASTER=; DEV=aha-no-heroku-cleanup + if [ "$$DEV" ]; then + git fetch -v --prune -- origin $$DEV || USING_MASTER=true + git checkout $$DEV || USING_MASTER=true + if ! [ "$$USING_MASTER" ]; then + msg="### WARNING Using dev branch '$${DEV}' instead of master" + buildkite-agent annotate --style "warning" --context dev "$$msg" + fi + fi + bin=$BUILDKITE_BUILD_CHECKOUT_PATH/.buildkite/bin + + # Make sure env var BUILDKITE_PULL_REQUEST_REPO is set correctly + source $$bin/update-pr-repo.sh + + # If build was triggered by a pull request, annotate build with + # links pointing to pull request on github. + # Set REQUEST_TYPE to one of "AHA_PUSH", "AHA_PR", or "SUBMOD_PR" + # Set PR_REPO_TAIL to submod associated with the PR, e.g. "canal" + # Add REQUEST_TYPE env temp file for use by later steps + source $$bin/set-trigfrom-and-reqtype.sh + ~/bin/status-update --force pending # Send "pending" status to github PR page - source $BUILDKITE_BUILD_CHECKOUT_PATH/.buildkite/bin/custom-checkout.sh + + # Checkout and update correct aha branch and submodules + source $$bin/custom-checkout.sh # Send regression test pass-fail info to github pull request page pre-exit: | @@ -41,12 +79,6 @@ steps: - echo "--- Creating garnet Image" - docker build . -t "garnet:aha-flow-build-${BUILDKITE_BUILD_NUMBER}" - # Docker image successfully built. Remove - # .TEST file to avoid reporting failure to - # aha-flow-app. This is a heroku thing I guess. - # FIXME remove heroku, remove this, along with pre-exit and post-checkout hooks FIXME - - rm -rf temp/.TEST - - echo "--- Pruning Docker Images" - yes | docker image prune -a --filter "until=6h" --filter=label='description=garnet' || true @@ -100,44 +132,28 @@ steps: shell: ["/bin/bash", "-e", "-c"] - improbable-eng/metahook: - pre-checkout: | - set +x - echo "+++ OIT PRE CHECKOUT HOOK BEGIN" - - # I THINK we don't actually need an aha clone for this step!? - # I THINK all we need is a path to the "temp" canary !!? - # FIXME/TODO use non-agent-specific path instead, e.g. $commdir FIXME - # FIXME then this hook can go away entirely, yes? FIXME - # FIXME but cannot do any of this until after heroku goes away... - mkdir -p $$BUILDKITE_BUILD_CHECKOUT_PATH/temp - cd $$BUILDKITE_BUILD_CHECKOUT_PATH - echo "--- OIT PRE CHECKOUT HOOK END" - pre-command: | - # Cannot run this as part of pre-checkout, - # because already have local post-checkout hook with odd co-dependence on temp dir - # Actually no I think all it does is delete temp/.TEST... - # FIXME can simplify all this after heroku goes away echo "+++ OIT PRE COMMAND HOOK BEGIN" # Use temp/.TEST to pass fail/success info into and out of docker container - # This duplicates what happens in existing aha/.buildkite/hooks/post-checkout, - # FIXME which can be deleted once this merges to master FIXME - # FIXME also can delete aha/.buildkite/hooks/pre-exit when/if heroku goes away FIXME echo Renewing `pwd`/temp/.TEST mkdir -p temp; rm -rf temp/.TEST; touch temp/.TEST - # FIXME/TODO there are obvious much better ways to do this FIXME + # If trigger came from a submod repo, we will do "pr" regressions. + # Otherwise, trigger came from aha repo push/pull and we just do "daily" regressions. + # We use "env" file to pass information between steps. + # THIS ASSUMES THAT ALL STEPS RUN ON SAME HOST MACHINE and thus see the same commdir! + + # env file sets REQUEST_TYPE to one of "AHA_PUSH", "AHA_PR", or "SUBMOD_PR" + source /var/lib/buildkite-agent/builds/DELETEME/env-$$BUILDKITE_BUILD_NUMBER + echo "--- Pass DO_PR info to docker" - echo "Use file 'DO_PR' as a signal to do pr tests or not omg" echo "Info gets passed to docker by mounting temp dir as /buildkite omg omg" - commdir=/var/lib/buildkite-agent/builds/DELETEME; - if test -f $$commdir/DO_PR-$${BUILDKITE_BUILD_NUMBER}; then + if [ "$$REQUEST_TYPE" == "SUBMOD_PR" ]; then echo "+++ SET DO_PR"; mkdir -p temp; touch temp/DO_PR else echo "+++ UNSET DO_PR"; /bin/rm -rf temp/DO_PR fi - pwd test -e temp/DO_PR && echo FOO temp/DO_PR exists || echo FOO temp/DO_PR not exists echo "--- OIT PRE COMMAND HOOK END" @@ -147,7 +163,7 @@ steps: echo "Send status to github." cd $$BUILDKITE_BUILD_CHECKOUT_PATH - # Docker removes temp/.TEST if all the tests passed + # Docker will have removed temp/.TEST if all the tests passed if [ "$$BUILDKITE_COMMAND_EXIT_STATUS" == 0 ]; then test -f temp/.TEST && export BUILDKITE_COMMAND_EXIT_STATUS=13 fi From 92f72389d5f7d99709bdc6fa2fc559fb670b2b1b Mon Sep 17 00:00:00 2001 From: Max Strange <46541870+mbstrange2@users.noreply.github.com> Date: Fri, 22 Sep 2023 12:07:15 -0700 Subject: [PATCH 2/5] Update Dockerfile - remove tmp install for torch Remove the tmp dir for the torch install --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 16fc4229..a3da297b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -118,6 +118,7 @@ WORKDIR /aha RUN mkdir -p /aha/tmp/torch_install/ ENV TMPDIR=/aha/tmp/torch_install/ RUN source /aha/bin/activate && pip install --cache-dir=$TMPDIR --build=$TMPDIR torch==1.7.1+cpu -f https://download.pytorch.org/whl/torch_stable.html +RUN rm -rf $TMPDIR WORKDIR /aha RUN source bin/activate && pip install urllib3==1.26.15 && pip install wheel six && pip install systemrdl-compiler peakrdl-html && pip install -e . && pip install packaging==21.3 && pip install -e ./pono/deps/smt-switch/build/python && pip install -e pono/build/python/ && aha deps install From e9764ef3a17bb103a3d92615cd63caa3f4a36626 Mon Sep 17 00:00:00 2001 From: Max Strange <46541870+mbstrange2@users.noreply.github.com> Date: Fri, 22 Sep 2023 16:54:37 -0700 Subject: [PATCH 3/5] Update Dockerfile save and restore TMPDIR after abusing it for torch install --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index a3da297b..d2599b71 100644 --- a/Dockerfile +++ b/Dockerfile @@ -116,9 +116,11 @@ RUN source /aha/bin/activate && pip install scipy numpy pytest && pip install -e # Install torch (need big tmp folder) WORKDIR /aha RUN mkdir -p /aha/tmp/torch_install/ +ENV TMPTMPDIR=$TMPDIR ENV TMPDIR=/aha/tmp/torch_install/ RUN source /aha/bin/activate && pip install --cache-dir=$TMPDIR --build=$TMPDIR torch==1.7.1+cpu -f https://download.pytorch.org/whl/torch_stable.html RUN rm -rf $TMPDIR +ENV TMPDIR=$TMPTMPDIR WORKDIR /aha RUN source bin/activate && pip install urllib3==1.26.15 && pip install wheel six && pip install systemrdl-compiler peakrdl-html && pip install -e . && pip install packaging==21.3 && pip install -e ./pono/deps/smt-switch/build/python && pip install -e pono/build/python/ && aha deps install From 127648ad70f140961b8e3c00b87421ee8f7118f9 Mon Sep 17 00:00:00 2001 From: steveri Date: Fri, 22 Sep 2023 16:58:53 -0700 Subject: [PATCH 4/5] trying the "/bin/rm -rf *" thing --- Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index d2599b71..cff0d6d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -116,11 +116,9 @@ RUN source /aha/bin/activate && pip install scipy numpy pytest && pip install -e # Install torch (need big tmp folder) WORKDIR /aha RUN mkdir -p /aha/tmp/torch_install/ -ENV TMPTMPDIR=$TMPDIR ENV TMPDIR=/aha/tmp/torch_install/ RUN source /aha/bin/activate && pip install --cache-dir=$TMPDIR --build=$TMPDIR torch==1.7.1+cpu -f https://download.pytorch.org/whl/torch_stable.html -RUN rm -rf $TMPDIR -ENV TMPDIR=$TMPTMPDIR +RUN rm -rf $TMPDIR/* WORKDIR /aha RUN source bin/activate && pip install urllib3==1.26.15 && pip install wheel six && pip install systemrdl-compiler peakrdl-html && pip install -e . && pip install packaging==21.3 && pip install -e ./pono/deps/smt-switch/build/python && pip install -e pono/build/python/ && aha deps install From 553609b63ed9164a533f5d0566bf3d4041adf126 Mon Sep 17 00:00:00 2001 From: steveri Date: Sat, 23 Sep 2023 04:15:53 -0700 Subject: [PATCH 5/5] Restore Max's original fix, it was better than mine --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cff0d6d0..b79c223d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -116,9 +116,12 @@ RUN source /aha/bin/activate && pip install scipy numpy pytest && pip install -e # Install torch (need big tmp folder) WORKDIR /aha RUN mkdir -p /aha/tmp/torch_install/ +# Save (and later restore) existing value for TMPDIR, if any +ENV TMPTMPDIR=$TMPDIR ENV TMPDIR=/aha/tmp/torch_install/ RUN source /aha/bin/activate && pip install --cache-dir=$TMPDIR --build=$TMPDIR torch==1.7.1+cpu -f https://download.pytorch.org/whl/torch_stable.html -RUN rm -rf $TMPDIR/* +RUN rm -rf $TMPDIR +ENV TMPDIR=$TMPTMPDIR WORKDIR /aha RUN source bin/activate && pip install urllib3==1.26.15 && pip install wheel six && pip install systemrdl-compiler peakrdl-html && pip install -e . && pip install packaging==21.3 && pip install -e ./pono/deps/smt-switch/build/python && pip install -e pono/build/python/ && aha deps install