Created
March 27, 2024 12:28
-
-
Save elect86/82bb7af9874d2d24f064f8d4cfaa43dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /home/barbie15/lakefs_automation/venv/bin/python /home/barbie15/.cache/JetBrains/RemoteDev/dist/add39388e538d_pycharm-professional-2023.3.4/plugins/python/helpers/pycharm/_jb_pytest_runner.py --target testApp.py::test_pass | |
| Testing started at 13:26 ... | |
| Launching pytest with arguments testApp.py::test_pass --no-header --no-summary -q in /home/barbie15/lakefs_automation/webhooks | |
| ============================= test session starts ============================== | |
| collecting ... collected 1 item | |
| testApp.py::test_pass FAILED [100%]True | |
| testApp.py:33 (test_pass) | |
| custom_handler = None | |
| @contextmanager | |
| def api_exception_handler(custom_handler: Optional[Callable[[LakeFSException], LakeFSException]] = None): | |
| """ | |
| Contexts which converts lakefs_sdk API exceptions to LakeFS exceptions and handles them. | |
| :param custom_handler: Optional handler which can be used to provide custom behavior for specific exceptions. | |
| If custom_handler returns an exception, this function will raise the exception at the end of the | |
| custom_handler invocation. | |
| """ | |
| try: | |
| > yield | |
| ../venv/lib/python3.11/site-packages/lakefs/exceptions.py:141: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| ../venv/lib/python3.11/site-packages/lakefs/import_manager.py:126: in _wait_for_completion | |
| resp = self._client.sdk_client.import_api.import_status(repository=self._repo_id, | |
| pydantic/decorator.py:40: in pydantic.decorator.validate_arguments.validate.wrapper_function | |
| ??? | |
| pydantic/decorator.py:134: in pydantic.decorator.ValidatedFunction.call | |
| ??? | |
| pydantic/decorator.py:206: in pydantic.decorator.ValidatedFunction.execute | |
| ??? | |
| ../venv/lib/python3.11/site-packages/lakefs_sdk/api/import_api.py:395: in import_status | |
| return self.import_status_with_http_info(repository, branch, id, **kwargs) # noqa: E501 | |
| pydantic/decorator.py:40: in pydantic.decorator.validate_arguments.validate.wrapper_function | |
| ??? | |
| pydantic/decorator.py:134: in pydantic.decorator.ValidatedFunction.call | |
| ??? | |
| pydantic/decorator.py:206: in pydantic.decorator.ValidatedFunction.execute | |
| ??? | |
| ../venv/lib/python3.11/site-packages/lakefs_sdk/api/import_api.py:504: in import_status_with_http_info | |
| return self.api_client.call_api( | |
| ../venv/lib/python3.11/site-packages/lakefs_sdk/api_client.py:407: in call_api | |
| return self.__call_api(resource_path, method, | |
| ../venv/lib/python3.11/site-packages/lakefs_sdk/api_client.py:222: in __call_api | |
| raise e | |
| ../venv/lib/python3.11/site-packages/lakefs_sdk/api_client.py:212: in __call_api | |
| response_data = self.request( | |
| ../venv/lib/python3.11/site-packages/lakefs_sdk/api_client.py:433: in request | |
| return self.rest_client.get_request(url, | |
| ../venv/lib/python3.11/site-packages/lakefs_sdk/rest.py:243: in get_request | |
| return self.request("GET", url, | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| self = <lakefs_sdk.rest.RESTClientObject object at 0x7fe51e98fe90> | |
| method = 'GET' | |
| url = 'http://192.168.11.104:8000/api/v1/repositories/test-repo/branches/main/import?id=co2114ikj97oqos2fod0' | |
| query_params = {} | |
| headers = {'Accept': 'application/json', 'Authorization': 'Basic QUtJQUpPNUtVT1U2WlFVUFdHQ1E6S3pIeXU0K1QvYXlqd1JlelFoSmtwY2JPbWFERGwxQVpWaEthNHM0Lw==', 'User-Agent': 'lakefs-python-sdk/1.14.0', 'X-Lakefs-Client': 'python-lakefs'} | |
| body = None, post_params = {}, _preload_content = True, _request_timeout = None | |
| def request(self, method, url, query_params=None, headers=None, | |
| body=None, post_params=None, _preload_content=True, | |
| _request_timeout=None): | |
| """Perform requests. | |
| :param method: http request method | |
| :param url: http request url | |
| :param query_params: query parameters in the url | |
| :param headers: http request headers | |
| :param body: request json body, for `application/json` | |
| :param post_params: request post parameters, | |
| `application/x-www-form-urlencoded` | |
| and `multipart/form-data` | |
| :param _preload_content: if False, the urllib3.HTTPResponse object will | |
| be returned without reading/decoding response | |
| data. Default is True. | |
| :param _request_timeout: timeout setting for this request. If one | |
| number provided, it will be total request | |
| timeout. It can also be a pair (tuple) of | |
| (connection, read) timeouts. | |
| """ | |
| method = method.upper() | |
| assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', | |
| 'PATCH', 'OPTIONS'] | |
| if post_params and body: | |
| raise ApiValueError( | |
| "body parameter cannot be used with post_params parameter." | |
| ) | |
| post_params = post_params or {} | |
| headers = headers or {} | |
| # url already contains the URL query string | |
| # so reset query_params to empty dict | |
| query_params = {} | |
| timeout = None | |
| if _request_timeout: | |
| if isinstance(_request_timeout, (int,float)): # noqa: E501,F821 | |
| timeout = urllib3.Timeout(total=_request_timeout) | |
| elif (isinstance(_request_timeout, tuple) and | |
| len(_request_timeout) == 2): | |
| timeout = urllib3.Timeout( | |
| connect=_request_timeout[0], read=_request_timeout[1]) | |
| try: | |
| # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` | |
| if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: | |
| # no content type provided or payload is json | |
| if not headers.get('Content-Type') or re.search('json', headers['Content-Type'], re.IGNORECASE): | |
| request_body = None | |
| if body is not None: | |
| request_body = json.dumps(body) | |
| r = self.pool_manager.request( | |
| method, url, | |
| body=request_body, | |
| preload_content=_preload_content, | |
| timeout=timeout, | |
| headers=headers) | |
| elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 | |
| r = self.pool_manager.request( | |
| method, url, | |
| fields=post_params, | |
| encode_multipart=False, | |
| preload_content=_preload_content, | |
| timeout=timeout, | |
| headers=headers) | |
| elif headers['Content-Type'] == 'multipart/form-data': | |
| # must del headers['Content-Type'], or the correct | |
| # Content-Type which generated by urllib3 will be | |
| # overwritten. | |
| del headers['Content-Type'] | |
| r = self.pool_manager.request( | |
| method, url, | |
| fields=post_params, | |
| encode_multipart=True, | |
| preload_content=_preload_content, | |
| timeout=timeout, | |
| headers=headers) | |
| # Pass a `string` parameter directly in the body to support | |
| # other content types than Json when `body` argument is | |
| # provided in serialized form | |
| elif isinstance(body, str) or isinstance(body, bytes): | |
| request_body = body | |
| r = self.pool_manager.request( | |
| method, url, | |
| body=request_body, | |
| preload_content=_preload_content, | |
| timeout=timeout, | |
| headers=headers) | |
| else: | |
| # Cannot generate the request from given parameters | |
| msg = """Cannot prepare a request message for provided | |
| arguments. Please check that your arguments match | |
| declared content type.""" | |
| raise ApiException(status=0, reason=msg) | |
| # For `GET`, `HEAD` | |
| else: | |
| r = self.pool_manager.request(method, url, | |
| fields={}, | |
| preload_content=_preload_content, | |
| timeout=timeout, | |
| headers=headers) | |
| except urllib3.exceptions.SSLError as e: | |
| msg = "{0}\n{1}".format(type(e).__name__, str(e)) | |
| raise ApiException(status=0, reason=msg) | |
| if _preload_content: | |
| r = RESTResponse(r) | |
| # log response body | |
| logger.debug("response body: %s", r.data) | |
| if not 200 <= r.status <= 299: | |
| if r.status == 400: | |
| raise BadRequestException(http_resp=r) | |
| if r.status == 401: | |
| raise UnauthorizedException(http_resp=r) | |
| if r.status == 403: | |
| raise ForbiddenException(http_resp=r) | |
| if r.status == 404: | |
| > raise NotFoundException(http_resp=r) | |
| E lakefs_sdk.exceptions.NotFoundException: (404) | |
| E Reason: Not Found | |
| E HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json', 'X-Content-Type-Options': 'nosniff', 'X-Request-Id': 'a6a1f8d3-7851-49df-a900-d786e74fcc6d', 'Date': 'Wed, 27 Mar 2024 12:26:58 GMT', 'Content-Length': '24'}) | |
| E HTTP response body: {"message":"not found"} | |
| ../venv/lib/python3.11/site-packages/lakefs_sdk/rest.py:232: NotFoundException | |
| The above exception was the direct cause of the following exception: | |
| lakefs_setup_branch = Branch(repository="test-repo", id="main") | |
| def test_pass(lakefs_setup_branch): | |
| # .prefix('local://mnt/data/test_resources/test_pass/', destination='datasets') \ | |
| # .prefix('s3://bucket1/data', destination='/') \ | |
| print(os.path.exists("/mnt/data/test_resources/test_pass/newest_pc2/flame_at_noctua2-naughty_subroutines.png")) | |
| lakefs_setup_branch.import_data(commit_message='added test data') \ | |
| .object("local:///mnt/data/test_resources/test_pass/newest_pc2/flame_at_noctua2-naughty_subroutines.png", | |
| "data/flame_at_noctua2-naughty_subroutines.png") \ | |
| > .run() | |
| testApp.py:41: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| ../venv/lib/python3.11/site-packages/lakefs/import_manager.py:164: in run | |
| return self.wait(**wait_kwargs) | |
| ../venv/lib/python3.11/site-packages/lakefs/import_manager.py:150: in wait | |
| res = asyncio.run(self._wait_for_completion(poll_interval)) | |
| /usr/lib/python3.11/asyncio/runners.py:190: in run | |
| return runner.run(main) | |
| /usr/lib/python3.11/asyncio/runners.py:118: in run | |
| return self._loop.run_until_complete(task) | |
| /usr/lib/python3.11/asyncio/base_events.py:653: in run_until_complete | |
| return future.result() | |
| ../venv/lib/python3.11/site-packages/lakefs/import_manager.py:125: in _wait_for_completion | |
| with api_exception_handler(): | |
| /usr/lib/python3.11/contextlib.py:155: in __exit__ | |
| self.gen.throw(typ, value, traceback) | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| custom_handler = None | |
| @contextmanager | |
| def api_exception_handler(custom_handler: Optional[Callable[[LakeFSException], LakeFSException]] = None): | |
| """ | |
| Contexts which converts lakefs_sdk API exceptions to LakeFS exceptions and handles them. | |
| :param custom_handler: Optional handler which can be used to provide custom behavior for specific exceptions. | |
| If custom_handler returns an exception, this function will raise the exception at the end of the | |
| custom_handler invocation. | |
| """ | |
| try: | |
| yield | |
| except lakefs_sdk.ApiException as e: | |
| lakefs_ex = _STATUS_CODE_TO_EXCEPTION.get(e.status, ServerException)(e.status, e.reason, e.body) | |
| if custom_handler is not None: | |
| lakefs_ex = custom_handler(lakefs_ex) | |
| if lakefs_ex is not None: | |
| > raise lakefs_ex from e | |
| E lakefs.exceptions.NotFoundException: code: 404, reason: Not Found, body: {'message': 'not found'} | |
| ../venv/lib/python3.11/site-packages/lakefs/exceptions.py:148: NotFoundException | |
| ============================== 1 failed in 0.71s =============================== | |
| Process finished with exit code 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment