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

tests: investigate import empty_dir failure #46

Open
efiop opened this issue Sep 22, 2023 · 0 comments
Open

tests: investigate import empty_dir failure #46

efiop opened this issue Sep 22, 2023 · 0 comments

Comments

@efiop
Copy link
Contributor

efiop commented Sep 22, 2023

#45

=================================== FAILURES ===================================
_______________________ TestImport.test_import_empty_dir _______________________
[gw0] linux -- Python 3.9.18 /opt/hostedtoolcache/Python/3.9.18/x64/bin/python

self = <dvc_gs.tests.test_dvc.TestImport object at 0x7f403314a850>
tmp_dir = PosixTmpDir('/tmp/pytest-of-runner/pytest-0/popen-gw0/test_import_empty_dir0')
dvc = Repo: '/tmp/pytest-of-runner/pytest-0/popen-gw0/test_import_empty_dir0'
workspace = FakeGCP: 'gs://pytest-servers-imfnca/', is_object_storage = True

    def test_import_empty_dir(self, tmp_dir, dvc, workspace, is_object_storage):
        # prefix based storage services (e.g s3) doesn't have the real concept
        # of directories. So instead we create an empty file that ends with a
        # trailing slash in order to actually support this operation
        if is_object_storage:
            contents: Union[str, Dict[str, str]] = ""
        else:
            contents = {}
    
        workspace.gen({"empty_dir/": contents})
    
>       dvc.imp_url("remote://workspace/empty_dir/")

/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/dvc/testing/workspace_tests.py:82: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/dvc/repo/__init__.py:61: in wrapper
    return f(repo, *args, **kwargs)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/dvc/repo/scm_context.py:151: in run
    return method(repo, *args, **kw)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/dvc/repo/imp_url.py:85: in imp_url
    stage.run(jobs=jobs, no_download=no_download)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/funcy/decorators.py:47: in wrapper
    return deco(call, *dargs, **dkwargs)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/dvc/stage/decorators.py:43: in rwlocked
    return call()
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/funcy/decorators.py:68: in __call__
    return self._func(*self._args, **self._kwargs)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/dvc/stage/__init__.py:600: in run
    self._sync_import(dry, force, kwargs.get("jobs", None), no_download)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/funcy/decorators.py:47: in wrapper
    return deco(call, *dargs, **dkwargs)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/dvc/stage/decorators.py:43: in rwlocked
    return call()
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/funcy/decorators.py:68: in __call__
    return self._func(*self._args, **self._kwargs)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/dvc/stage/__init__.py:637: in _sync_import
    sync_import(self, dry, force, jobs, no_download)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/dvc/stage/imports.py:62: in sync_import
    stage.deps[0].download(
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/dvc/dependency/base.py:50: in download
    fs_download(self.fs, self.fs_path, to.fs_path, jobs=jobs)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/dvc/fs/__init__.py:77: in download
    generic.copy(
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/dvc_objects/fs/generic.py:93: in copy
    return _get(
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/dvc_objects/fs/generic.py:211: in _get
    return _get_one(from_paths[0], to_paths[0])
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/dvc_objects/fs/generic.py:201: in _get_one
    return get_file(
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/dvc_objects/fs/callbacks.py:70: in func
    return wrapped(path1, path2, **kw)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/dvc_objects/fs/callbacks.py:42: in wrapped
    res = fn(*args, **kwargs)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/dvc_objects/fs/base.py:556: in get_file
    self.fs.get_file(from_info, to_info, callback=callback, **kwargs)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/fsspec/asyn.py:118: in wrapper
    return sync(self.loop, func, *args, **kwargs)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/fsspec/asyn.py:103: in sync
    raise return_result
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/fsspec/asyn.py:56: in _runner
    result[0] = await coro
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/gcsfs/core.py:1494: in _get_file
    await self._get_file_request(u2, lpath, callback=callback, **kwargs)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/decorator.py:221: in fun
    return await caller(func, *(extras + args), **kw)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/gcsfs/retry.py:146: in retry_request
    raise e
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/gcsfs/retry.py:122: in retry_request
    return await func(*args, **kwargs)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/gcsfs/core.py:1467: in _get_file_request
    r.raise_for_status()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(http://localhost:54355/download/storage/v1/b/pytest-servers-imfnca/o/empty_dir?alt=media) [404 Not Fou...charset=utf-8', 'X-Content-Type-Options': 'nosniff', 'Date': 'Fri, 22 Sep 2023 16:11:26 GMT', 'Content-Length': '10')>


    def raise_for_status(self) -> None:
        if not self.ok:
            # reason should always be not None for a started response
            assert self.reason is not None
            self.release()
>           raise ClientResponseError(
                self.request_info,
                self.history,
                status=self.status,
                message=self.reason,
                headers=self.headers,
            )
E           aiohttp.client_exceptions.ClientResponseError: 404, message='Not Found', url=URL('http://localhost:54355/download/storage/v1/b/pytest-servers-imfnca/o/empty_dir?alt=media')

/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/aiohttp/client_reqrep.py:1005: ClientResponseError
------------------------------ Captured log setup ------------------------------
DEBUG    gcsfs:core.py:436 GET: b/pytest-servers-imfnca, (), None
DEBUG    gcsfs:core.py:436 GET: b/{}/o, ('pytest-servers-imfnca',), None
DEBUG    gcsfs:core.py:436 POST: b, (), None
----------------------------- Captured stdout call -----------------------------
Importing 'remote://workspace/empty_dir/' -> 'empty_dir'
----------------------------- Captured stderr call -----------------------------
WARNING: 'remote://workspace/empty_dir/' is empty.
------------------------------ Captured log call -------------------------------
DEBUG    urllib3.util.retry:retry.py:351 Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=None, status=None)
DEBUG    urllib3.connectionpool:connectionpool.py:245 Starting new HTTP connection (1): localhost:54355
DEBUG    urllib3.connectionpool:connectionpool.py:473 http://localhost:54355 "POST /upload/storage/v1/b/pytest-servers-imfnca/o?uploadType=multipart HTTP/1.1" 200 502
DEBUG    google.auth._default:_default.py:255 Checking None for explicit credentials as part of auth process...
DEBUG    google.auth._default:_default.py:228 Checking Cloud SDK credentials as part of auth process...
DEBUG    google.auth._default:_default.py:234 Cloud SDK credentials not found on disk; not using them
DEBUG    google.auth.transport._http_client:_http_client.py:102 Making request: GET http://169.254.169.254
WARNING  google.auth._default:_default.py:338 Authentication failed using Compute Engine authentication due to unavailable metadata server.
DEBUG    gcsfs.credentials:credentials.py:238 Connection with method "google_default" failed
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/gcsfs/credentials.py", line 232, in connect
    self.connect(method=meth)
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/gcsfs/credentials.py", line 249, in connect
    self.__getattribute__("_connect_" + method)()
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/gcsfs/credentials.py", line 77, in _connect_google_default
    credentials, project = gauth.default(scopes=[self.scope])
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/google/auth/_default.py", line 691, in default
    raise exceptions.DefaultCredentialsError(_CLOUD_SDK_MISSING_CREDENTIALS)
google.auth.exceptions.DefaultCredentialsError: Your default credentials were not found. To set up Application Default Credentials, see https://cloud.google.com/docs/authentication/external/set-up-adc for more information.
DEBUG    gcsfs.credentials:credentials.py:238 Connection with method "cache" failed
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/gcsfs/credentials.py", line 232, in connect
    self.connect(method=meth)
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/gcsfs/credentials.py", line 249, in connect
    self.__getattribute__("_connect_" + method)()
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/gcsfs/credentials.py", line 104, in _connect_cache
    raise ValueError("No cached tokens")
ValueError: No cached tokens
DEBUG    google.auth.transport.requests:requests.py:185 Making request: GET http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/?recursive=true
DEBUG    urllib3.connectionpool:connectionpool.py:245 Starting new HTTP connection (1): metadata.google.internal:80
WARNING  google.auth.compute_engine._metadata:_metadata.py:205 Compute Engine Metadata server unavailable on attempt 1 of 5. Reason: HTTPConnectionPool(host='metadata.google.internal', port=80): Max retries exceeded with url: /computeMetadata/v1/instance/service-accounts/default/?recursive=true (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f40187580a0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
DEBUG    google.auth.transport.requests:requests.py:185 Making request: GET http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/?recursive=true
DEBUG    urllib3.connectionpool:connectionpool.py:245 Starting new HTTP connection (2): metadata.google.internal:80
WARNING  google.auth.compute_engine._metadata:_metadata.py:205 Compute Engine Metadata server unavailable on attempt 2 of 5. Reason: HTTPConnectionPool(host='metadata.google.internal', port=80): Max retries exceeded with url: /computeMetadata/v1/instance/service-accounts/default/?recursive=true (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f40186f8670>: Failed to establish a new connection: [Errno -2] Name or service not known'))
DEBUG    google.auth.transport.requests:requests.py:185 Making request: GET http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/?recursive=true
DEBUG    urllib3.connectionpool:connectionpool.py:245 Starting new HTTP connection (3): metadata.google.internal:80
WARNING  google.auth.compute_engine._metadata:_metadata.py:205 Compute Engine Metadata server unavailable on attempt 3 of 5. Reason: HTTPConnectionPool(host='metadata.google.internal', port=80): Max retries exceeded with url: /computeMetadata/v1/instance/service-accounts/default/?recursive=true (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f401875[110](https://github.com/iterative/dvc-gs/actions/runs/6276583341/job/17046587833?pr=45#step:7:111)0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
DEBUG    google.auth.transport.requests:requests.py:185 Making request: GET http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/?recursive=true
DEBUG    urllib3.connectionpool:connectionpool.py:245 Starting new HTTP connection (4): metadata.google.internal:80
WARNING  google.auth.compute_engine._metadata:_metadata.py:205 Compute Engine Metadata server unavailable on attempt 4 of 5. Reason: HTTPConnectionPool(host='metadata.google.internal', port=80): Max retries exceeded with url: /computeMetadata/v1/instance/service-accounts/default/?recursive=true (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f401870c3d0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
DEBUG    google.auth.transport.requests:requests.py:185 Making request: GET http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/?recursive=true
DEBUG    urllib3.connectionpool:connectionpool.py:245 Starting new HTTP connection (5): metadata.google.internal:80
WARNING  google.auth.compute_engine._metadata:_metadata.py:205 Compute Engine Metadata server unavailable on attempt 5 of 5. Reason: HTTPConnectionPool(host='metadata.google.internal', port=80): Max retries exceeded with url: /computeMetadata/v1/instance/service-accounts/default/?recursive=true (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f401870c130>: Failed to establish a new connection: [Errno -2] Name or service not known'))
DEBUG    gcsfs.credentials:credentials.py:238 Connection with method "cloud" failed
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/google/auth/compute_engine/credentials.py", line [113](https://github.com/iterative/dvc-gs/actions/runs/6276583341/job/17046587833?pr=45#step:7:114), in refresh
    self._retrieve_info(request)
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/google/auth/compute_engine/credentials.py", line 86, in _retrieve_info
    info = _metadata.get_service_account_info(
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/google/auth/compute_engine/_metadata.py", line 285, in get_service_account_info
    return get(request, path, params={"recursive": "true"})
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/google/auth/compute_engine/_metadata.py", line 214, in get
    raise exceptions.TransportError(
google.auth.exceptions.TransportError: Failed to retrieve http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/?recursive=true from the Google Compute Engine metadata service. Compute Engine Metadata server unavailable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/gcsfs/credentials.py", line 97, in _connect_cloud
    self.credentials.refresh(req)
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/google/auth/compute_engine/credentials.py", line [119](https://github.com/iterative/dvc-gs/actions/runs/6276583341/job/17046587833?pr=45#step:7:120), in refresh
    raise new_exc from caught_exc
google.auth.exceptions.RefreshError: Failed to retrieve http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/?recursive=true from the Google Compute Engine metadata service. Compute Engine Metadata server unavailable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/gcsfs/credentials.py", line 232, in connect
    self.connect(method=meth)
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/gcsfs/credentials.py", line 249, in connect
    self.__getattribute__("_connect_" + method)()
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/gcsfs/credentials.py", line 99, in _connect_cloud
    raise ValueError("Invalid gcloud credentials") from error
ValueError: Invalid gcloud credentials
DEBUG    gcsfs.credentials:credentials.py:233 Connected with method anon
INFO     dvc.stage.imports:imports.py:50 Importing 'remote://workspace/empty_dir/' -> 'empty_dir'
DEBUG    gcsfs:core.py:436 GET: b/{}/o/{}, ('pytest-servers-imfnca', 'empty_dir'), None
DEBUG    gcsfs:core.py:436 GET: b/{}/o, ('pytest-servers-imfnca',), None
DEBUG    gcsfs:core.py:436 GET: b/{}/o/{}, ('pytest-servers-imfnca', 'empty_dir'), None
DEBUG    gcsfs:core.py:436 GET: b/{}/o, ('pytest-servers-imfnca',), None
DEBUG    gcsfs:core.py:436 GET: b/{}/o/{}, ('pytest-servers-imfnca', 'empty_dir'), None
DEBUG    gcsfs:core.py:436 GET: b/{}/o, ('pytest-servers-imfnca',), None
WARNING  dvc.output:output.py:717 'remote://workspace/empty_dir/' is empty.
DEBUG    gcsfs:core.py:436 GET: b/{}/o/{}, ('pytest-servers-imfnca', 'empty_dir'), None
DEBUG    gcsfs:core.py:436 GET: b/{}/o, ('pytest-servers-imfnca',), None
DEBUG    gcsfs:core.py:436 GET: b/{}/o/{}, ('pytest-servers-imfnca', 'empty_dir'), None
DEBUG    gcsfs:core.py:436 GET: b/{}/o, ('pytest-servers-imfnca',), None
DEBUG    gcsfs:core.py:436 GET: b/{}/o/{}, ('pytest-servers-imfnca', 'empty_dir'), None
DEBUG    gcsfs:core.py:436 GET: b/{}/o, ('pytest-servers-imfnca',), None
DEBUG    gcsfs:retry.py:[145](https://github.com/iterative/dvc-gs/actions/runs/6276583341/job/17046587833?pr=45#step:7:146) Request returned 404, no retries.
=========================== short test summary info ============================
XPASS dvc_gs/tests/test_dvc.py::TestRemote::test_pull_00_prefix 
XPASS dvc_gs/tests/test_dvc.py::TestRemote::test_pull_no_00_prefix 
XPASS dvc_gs/tests/test_dvc.py::TestRemote::test_stage_cache_push_pull 
FAILED dvc_gs/tests/test_dvc.py::TestImport::test_import_empty_dir - aiohttp....
=================== 1 failed, 32 passed, 3 xpassed in 11.88s ===================
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

1 participant