Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meet FileExistsError while importing vsts package occasionally #354

Closed
arrownj opened this issue Aug 13, 2020 · 1 comment
Closed

Meet FileExistsError while importing vsts package occasionally #354

arrownj opened this issue Aug 13, 2020 · 1 comment

Comments

@arrownj
Copy link

arrownj commented Aug 13, 2020

Hi Team,

We run some tests in ADO and meet below error:

____ ERROR collecting tests/latest/test_devops_build_commands_thru_mock.py _____
/usr/local/Cellar/azure-cli/2.10.1/libexec/lib/python3.8/site-packages/azure/cli/command_modules/appservice/tests/latest/test_devops_build_commands_thru_mock.py:10: in
from azure.cli.command_modules.appservice.azure_devops_build_interactive import (
/usr/local/Cellar/azure-cli/2.10.1/libexec/lib/python3.8/site-packages/azure/cli/command_modules/appservice/azure_devops_build_interactive.py:31: in
from .azure_devops_build_provider import AzureDevopsBuildProvider
/usr/local/Cellar/azure-cli/2.10.1/libexec/lib/python3.8/site-packages/azure/cli/command_modules/appservice/azure_devops_build_provider.py:7: in
from azure_functions_devops_build.project.project_manager import ProjectManager
/usr/local/Cellar/azure-cli/2.10.1/libexec/lib/python3.8/site-packages/azure_functions_devops_build/project/project_manager.py:14: in
from ..base.base_manager import BaseManager
/usr/local/Cellar/azure-cli/2.10.1/libexec/lib/python3.8/site-packages/azure_functions_devops_build/base/base_manager.py:6: in
from vsts.vss_connection import VssConnection
/usr/local/Cellar/azure-cli/2.10.1/libexec/lib/python3.8/site-packages/vsts/vss_connection.py:9: in
from ._file_cache import RESOURCE_CACHE as RESOURCE_FILE_CACHE
/usr/local/Cellar/azure-cli/2.10.1/libexec/lib/python3.8/site-packages/vsts/_file_cache.py:122: in
DEFAULT_CACHE_DIR = get_cache_dir()
/usr/local/Cellar/azure-cli/2.10.1/libexec/lib/python3.8/site-packages/vsts/_file_cache.py:117: in get_cache_dir
os.makedirs(vsts_cache_dir)
/usr/local/Cellar/azure-cli/2.10.1/libexec/lib/python3.8/os.py:223: in makedirs
mkdir(name, mode)
E FileExistsError: [Errno 17] File exists: '/Users/runner/.vsts/python-sdk/cache'

After check the source code, we found the error happens in this line.

It seems to have something to do with parallel running. Can anyone help with this ?

tedchamb added a commit that referenced this issue Aug 13, 2020
tedchamb added a commit that referenced this issue Aug 13, 2020
* fix for issue #354

* catch OSError instead of FileExistsError, since FileExistsError is not available in python 2.7
@tedchamb
Copy link
Member

tedchamb commented Aug 13, 2020

fixed in #356

This can happen if the cache directory doesn't exist and two threads try to create it at the same time.

You are using the very old package vsts. The fix is in azure-devops. To work around the issue you can do one of the following:

  1. create the cache directory before you run your tests: ~/.vsts/python-sdk/cache or in your case /Users/runner/.vsts/python-sdk/cache
  2. set the VSTS_CACHE_DIR env var to a folder path that already exists.

tedchamb added a commit that referenced this issue Aug 15, 2020
* fix for issue #354

* catch OSError instead of FileExistsError, since FileExistsError is not available in python 2.7

* Revert "update apis to match 6.0 RTW"

This reverts commit 5428142.

* regen 6.0 as preview

* bump version
pull bot pushed a commit to tooniez/azure-devops-python-api that referenced this issue Jul 27, 2024
* fix for issue microsoft#354

* catch OSError instead of FileExistsError, since FileExistsError is not available in python 2.7
pull bot pushed a commit to tooniez/azure-devops-python-api that referenced this issue Jul 27, 2024
* fix for issue microsoft#354

* catch OSError instead of FileExistsError, since FileExistsError is not available in python 2.7

* Revert "update apis to match 6.0 RTW"

This reverts commit e3f3fa9.

* regen 6.0 as preview

* bump version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants