Jenkins Jobs激活同一Conda环境的问题

时间:2019-06-11 14:55:27

标签: jenkins anaconda conda

我有多个作业在同一个conda环境中运行。在执行python脚本之前,它们全部conda activate my_env

我目前有2个作业同时开始,其中一个总是失败:

The process cannot access the file because it is being used by another process.
The system cannot find the file C:\Users\USER\AppData\Local\Temp\conda-31754.tmp.
C:\Users\USER\AppData\Local\Temp\conda-31754.tmp
The process cannot access the file because it is being used by another process.

两个进程中的activate命令似乎都试图访问同一临时文件。

如何防止这种情况允许针对相同的conda环境并行执行脚本?

1 个答案:

答案 0 :(得分:0)

这是在更高版本的Windows上运行的issue with conda

我有一个解决方法,基本上是我用conda激活的批处理文件中的try / except类型循环:

@echo off
:activate_conda
call c:\PATH\TO\CONDA activate ENV_NAME
if %ERRORLEVEL% neq 0 goto activate_conda
REM do whatever after this line