Update conda environment on startup always (#1171) (#1176)

* Update environment on startup always

* Message to explicitly state no environment.yaml update required

Co-authored-by: hlky <106811348+hlky@users.noreply.github.com>

Co-authored-by: Brian Semrau <brian.semrau@gmail.com>
Co-authored-by: hlky <106811348+hlky@users.noreply.github.com>
This commit is contained in:
Thomas Mello 2022-09-16 12:26:01 +03:00 committed by GitHub
parent 4a8cc9ba6d
commit 1af2610c71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 19 deletions

View File

@ -36,25 +36,26 @@ IF "%v_conda_path%"=="" (
echo Stashing local changes and pulling latest update... echo Stashing local changes and pulling latest update...
call git stash call git stash
call git pull call git pull
echo If you want to restore changes you made before updating, run "git stash pop". set /P restore="Do you want to restore changes you made before updating? (Y/N): "
call "%v_conda_path%\Scripts\activate.bat" IF /I "%restore%" == "N" (
echo Removing changes please wait...
for /f "delims=" %%a in ('git log -1 --format^="%%H" -- environment.yaml') DO set v_cur_hash=%%a call git stash drop
set /p "v_last_hash="<"z_version_env.tmp" echo Changes removed, press any key to continue...
echo %v_cur_hash%>z_version_env.tmp pause >nul
) ELSE IF /I "%restore%" == "Y" (
echo Current environment.yaml hash: %v_cur_hash% echo Restoring changes, please wait...
echo Previous environment.yaml hash: %v_last_hash% call git stash pop --quiet
echo Changes restored, press any key to continue...
if "%v_last_hash%" == "%v_cur_hash%" ( pause >nul
echo environment.yaml unchanged. dependencies should be up to date.
echo if you still have unresolved dependencies, delete "z_version_env.tmp"
if not defined AUTO pause
) else (
echo environment.yaml changed. updating dependencies
call conda env create --name "%v_conda_env_name%" -f environment.yaml
call conda env update --name "%v_conda_env_name%" -f environment.yaml
if not defined AUTO pause
) )
for /f "delims=" %%a in ('git log -1 --format^="%%H" -- environment.yaml') DO set v_cur_hash=%%a
echo %v_cur_hash%>z_version_env.tmp
call conda env create --name "%v_conda_env_name%" -f environment.yaml
call conda env update --name "%v_conda_env_name%" -f environment.yaml
if not defined AUTO pause
call "%v_conda_path%\Scripts\activate.bat"
::cmd /k ::cmd /k

View File

@ -52,6 +52,24 @@ if not exist "z_version_env.tmp" (
call "%v_conda_path%\Scripts\activate.bat" "%v_conda_env_name%" call "%v_conda_path%\Scripts\activate.bat" "%v_conda_env_name%"
set v_last_hash=0
set /p "v_last_hash="<"z_version_env.tmp"
for /f "delims=" %%a in ('git log -1 --format^="%%H" -- environment.yaml') DO set v_cur_hash=%%a
if not "%v_last_hash%" == "%v_cur_hash%" (
set /P updateenv="Do you want to update with the latest environment.yaml? (Y/N): "
if /I "%updateenv%" == "N" (
echo Starting without updating dependencies.
) else if /I "%updateenv%" == "Y" (
echo Updating dependencies...
call conda env create --name "%v_conda_env_name%" -f environment.yaml
call conda env update --name "%v_conda_env_name%" -f environment.yaml
echo %v_cur_hash%>z_version_env.tmp
)
) else (
echo No environment.yaml update required.
)
:PROMPT :PROMPT
set SETUPTOOLS_USE_DISTUTILS=stdlib set SETUPTOOLS_USE_DISTUTILS=stdlib
IF EXIST "models\ldm\stable-diffusion-v1\model.ckpt" ( IF EXIST "models\ldm\stable-diffusion-v1\model.ckpt" (

View File

@ -52,6 +52,24 @@ if not exist "z_version_env.tmp" (
call "%v_conda_path%\Scripts\activate.bat" "%v_conda_env_name%" call "%v_conda_path%\Scripts\activate.bat" "%v_conda_env_name%"
set v_last_hash=0
set /p "v_last_hash="<"z_version_env.tmp"
for /f "delims=" %%a in ('git log -1 --format^="%%H" -- environment.yaml') DO set v_cur_hash=%%a
if not "%v_last_hash%" == "%v_cur_hash%" (
set /P updateenv="Do you want to update with the latest environment.yaml? (Y/N): "
if /I "%updateenv%" == "N" (
echo Starting without updating dependencies.
) else if /I "%updateenv%" == "Y" (
echo Updating dependencies...
call conda env create --name "%v_conda_env_name%" -f environment.yaml
call conda env update --name "%v_conda_env_name%" -f environment.yaml
echo %v_cur_hash%>z_version_env.tmp
)
) else (
echo No environment.yaml update required.
)
:PROMPT :PROMPT
set SETUPTOOLS_USE_DISTUTILS=stdlib set SETUPTOOLS_USE_DISTUTILS=stdlib
IF EXIST "models\ldm\stable-diffusion-v1\model.ckpt" ( IF EXIST "models\ldm\stable-diffusion-v1\model.ckpt" (