Skip to content

LightCurve loading fails the first time (sometimes...) #43

@jejjohnson

Description

@jejjohnson

Issue

So when I first ran the command to fetch the light curve within a python script, I got a weird error message that gave me the impression that there was a network issue.

lcf = search_lightcurvefile('HD 222259 A', mission='TESS', sector=27).download_all()

But when I ran the same command, I didn't receive an error message.

Error Message

Details
Traceback (most recent call last):
  File "/opt/conda/envs/dotenv_gcp/lib/python3.8/site-packages/urllib3/connection.py", line 159, in _new_conn
    conn = connection.create_connection(
  File "/opt/conda/envs/dotenv_gcp/lib/python3.8/site-packages/urllib3/util/connection.py", line 61, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/opt/conda/envs/dotenv_gcp/lib/python3.8/socket.py", line 918, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/envs/dotenv_gcp/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/opt/conda/envs/dotenv_gcp/lib/python3.8/site-packages/urllib3/connectionpool.py", line 381, in _make_request
    self._validate_conn(conn)
  File "/opt/conda/envs/dotenv_gcp/lib/python3.8/site-packages/urllib3/connectionpool.py", line 978, in _validate_conn
    conn.connect()
  File "/opt/conda/envs/dotenv_gcp/lib/python3.8/site-packages/urllib3/connection.py", line 309, in connect
    conn = self._new_conn()
  File "/opt/conda/envs/dotenv_gcp/lib/python3.8/site-packages/urllib3/connection.py", line 171, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7eff9be05f40>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/envs/dotenv_gcp/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/opt/conda/envs/dotenv_gcp/lib/python3.8/site-packages/urllib3/connectionpool.py", line 726, in urlopen
    retries = retries.increment(
  File "/opt/conda/envs/dotenv_gcp/lib/python3.8/site-packages/urllib3/util/retry.py", line 446, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='mast.stsci.edu', port=443): Max retries exceeded with url: /api/v0.1/Download/file?uri=mast:TESS/product/tess2020186164531-s0027-0000000410214986-0189-a_fast-lc.fits (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7eff9be05f40>: Failed to establish a new connection: [Errno -2] Name or service not known'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "scripts/demo.py", line 56, in <module>
    main(args)
  File "scripts/demo.py", line 24, in main
    lcf = search_lightcurvefile(
  File "/opt/conda/envs/dotenv_gcp/lib/python3.8/site-packages/lightkurve/utils.py", line 479, in wrapper
    return f(*args, **kwargs)
  File "/opt/conda/envs/dotenv_gcp/lib/python3.8/site-packages/lightkurve/search.py", line 290, in download_all
    products.append(self._download_one(table=self.table[idx:idx+1],
  File "/opt/conda/envs/dotenv_gcp/lib/python3.8/site-packages/lightkurve/search.py", line 175, in _download_one
    path = Observations.download_products(table[:1], mrp_only=False,
  File "/opt/conda/envs/dotenv_gcp/lib/python3.8/site-packages/astroquery/mast/observations.py", line 699, in download_products
    manifest = self._download_files(products, base_dir, cache, cloud_only)
  File "/opt/conda/envs/dotenv_gcp/lib/python3.8/site-packages/astroquery/mast/observations.py", line 574, in _download_files
    self._download_file(data_url, local_path,
  File "/opt/conda/envs/dotenv_gcp/lib/python3.8/site-packages/astroquery/query.py", line 359, in _download_file
    response = self._session.request(method, url,
  File "/opt/conda/envs/dotenv_gcp/lib/python3.8/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/opt/conda/envs/dotenv_gcp/lib/python3.8/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/opt/conda/envs/dotenv_gcp/lib/python3.8/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='mast.stsci.edu', port=443): Max retries exceeded with url: /api/v0.1/Download/file?uri=mast:TESS/product/tess2020186164531-s0027-0000000410214986-0189-a_fast-lc.fits (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7eff9be05f40>: Failed to establish a new connection: [Errno -2] Name or service not known'))

Fix

Ran it a second time and didn't get an error. I haven't been able to recreate the issue. My worry is that this might show up during the DockerFile sweeps...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions