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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 馃幐 add --single-threaded flag to fetch azure #2561

Merged
merged 2 commits into from
Sep 19, 2023

Conversation

sunny0826
Copy link
Contributor

Add same flag --single-threaded for the Azure fetching script.

--single-threaded: Run in single-threaded mode. This is useful when multiple processes don't work well with the azure client due to ssl issues.

@iojw
Copy link
Collaborator

iojw commented Sep 15, 2023

@sunny0826 What exactly is the error that occurs with SSL? Can you share more details?

@sunny0826
Copy link
Contributor Author

Requesting too much data from api/retail/prices will most likely result in the following error:

...
Done fetching pricing germanywestcentral
Getting pricing for norwayeast
Done fetching pricing italynorth
Done fetching pricing norwayeast
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/Users/guoxudong_1/anaconda3/envs/sky-dev/lib/python3.8/site-packages/urllib3/connectionpool.py", line 711, in urlopen
    self._prepare_proxy(conn)
  File "/Users/guoxudong_1/anaconda3/envs/sky-dev/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1007, in _prepare_proxy
    conn.connect()
  File "/Users/guoxudong_1/anaconda3/envs/sky-dev/lib/python3.8/site-packages/urllib3/connection.py", line 419, in connect
    self.sock = ssl_wrap_socket(
  File "/Users/guoxudong_1/anaconda3/envs/sky-dev/lib/python3.8/site-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "/Users/guoxudong_1/anaconda3/envs/sky-dev/lib/python3.8/site-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/Users/guoxudong_1/anaconda3/envs/sky-dev/lib/python3.8/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/Users/guoxudong_1/anaconda3/envs/sky-dev/lib/python3.8/ssl.py", line 1073, in _create
    self.do_handshake()
  File "/Users/guoxudong_1/anaconda3/envs/sky-dev/lib/python3.8/ssl.py", line 1342, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:1131)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/guoxudong_1/anaconda3/envs/sky-dev/lib/python3.8/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
  File "/Users/guoxudong_1/anaconda3/envs/sky-dev/lib/python3.8/site-packages/urllib3/connectionpool.py", line 798, in urlopen
    retries = retries.increment(
  File "/Users/guoxudong_1/anaconda3/envs/sky-dev/lib/python3.8/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='prices.azure.com', port=443): Max retries exceeded with url: /api/retail/prices?$filter=serviceName%20eq%20%27Virtual%20Machines%27%20and%20priceType%20eq%20%27Consumption%27%20and%20armRegionName%20eq%20%27brazilsouth%27&$skip=1000 (Caused by SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1131)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/guoxudong_1/anaconda3/envs/sky-dev/lib/python3.8/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/Users/guoxudong_1/anaconda3/envs/sky-dev/lib/python3.8/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "/Users/guoxudong_1/ai/skypilot/sky/clouds/service_catalog/data_fetchers/fetch_azure.py", line 85, in get_pricing_df
    r = requests.get(url)
  File "/Users/guoxudong_1/anaconda3/envs/sky-dev/lib/python3.8/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
  File "/Users/guoxudong_1/anaconda3/envs/sky-dev/lib/python3.8/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Users/guoxudong_1/anaconda3/envs/sky-dev/lib/python3.8/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/guoxudong_1/anaconda3/envs/sky-dev/lib/python3.8/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/Users/guoxudong_1/anaconda3/envs/sky-dev/lib/python3.8/site-packages/requests/adapters.py", line 517, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='prices.azure.com', port=443): Max retries exceeded with url: /api/retail/prices?$filter=serviceName%20eq%20%27Virtual%20Machines%27%20and%20priceType%20eq%20%27Consumption%27%20and%20armRegionName%20eq%20%27brazilsouth%27&$skip=1000 (Caused by SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1131)')))
"""

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

Traceback (most recent call last):
  File "/Users/guoxudong_1/ai/skypilot/sky/clouds/service_catalog/data_fetchers/fetch_azure.py", line 155, in get_all_regions_instance_types_df
    dfs = dfs.get()
  File "/Users/guoxudong_1/anaconda3/envs/sky-dev/lib/python3.8/multiprocessing/pool.py", line 771, in get
    raise self._value
requests.exceptions.SSLError: None: Max retries exceeded with url: /api/retail/prices?$filter=serviceName%20eq%20%27Virtual%20Machines%27%20and%20priceType%20eq%20%27Consumption%27%20and%20armRegionName%20eq%20%27brazilsouth%27&$skip=1000 (Caused by None)

Copy link
Collaborator

@iojw iojw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @sunny0826! LGTM, just some minor copy fixes.

docs/source/reference/faq.rst Outdated Show resolved Hide resolved
docs/source/reference/faq.rst Outdated Show resolved Hide resolved
@iojw iojw merged commit f878d0f into skypilot-org:master Sep 19, 2023
18 checks passed
@sunny0826 sunny0826 deleted the feat/fetch-azure-single-threaded branch September 19, 2023 06:21
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

Successfully merging this pull request may close these issues.

None yet

2 participants