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.
But when I ran the same command, I didn't receive an error message.
Error Message
```bash
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: : 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(': 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
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(': 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...
My fear is that this might be a transient DNS issue or something else that's tricky to debug. Some things to consider:
we only need lightkurve to get the data for TESS targets for now; ideally we should create a small library of the TESS targets we most want to run through dot. The download time via lightkurve can be a few tens of seconds, which multiplied by hundreds or thousands of runs each with tens of CPUs equals non-negligible GCP costs. By contrast, the lookup via the Kepler LC bucket takes <5 sec.
Perhaps it was misguided of me to pitch a TESS target as our top prototype priority, perhaps we should swap it for a Kepler one so we can use (and demonstrate that we can successfully use) the Kepler LC bucket. May I suggest Kepler-411? Sorry to change gears.
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.
But when I ran the same command, I didn't receive an error message.
Error Message
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...