-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
bugSomething isn't workingSomething isn't workingcontent: spherexContent related issues/PRs for notebooks with SPHEREx relevanceContent related issues/PRs for notebooks with SPHEREx relevance
Description
Ran into this in https://app.circleci.com/pipelines/github/Caltech-IPAC/irsa-tutorials/547/workflows/1645d631-a07c-4a5e-95ad-11f4858e976f/jobs/560 and also while I was testing a longer timeout limit for #164 on Fornax. The longer timeout limit did not prevent this Bad Gateway error.
tutorials/spherex/spherex_cutouts.md
- An exception occurred during code execution, halting further execution:
---------------------------------------------------------------------------
HTTPError Traceback (most recent call last)
Cell In[6], line 8
6 t1 = time.time()
7 for row in results_table_serial:
----> 8 process_cutout(row, ra, dec, cache=False)
9 print("Time to create cutouts in serial mode: {:2.2f} minutes.".format((time.time() - t1) / 60))
Cell In[5], line 18, in process_cutout(row, ra, dec, cache)
1 def process_cutout(row, ra, dec, cache):
2 '''
3 Downloads the cutouts given in a row of the table including all SPHEREx images overlapping with a position.
4
(...) 15 Turn this feature off by setting `cache = False`.
16 '''
---> 18 with fits.open(row["uri"], cache=cache) as hdulist:
19 # There are seven HDUs:
20 # 0 contains minimal metadata in the header and no data.
21 # 1 through 6 are: IMAGE, FLAGS, VARIANCE, ZODI, PSF, WCS-WAVE
22 header = hdulist[1].header
24 # Compute pixel coordinates corresponding to cutout position.
File ~/project/.tox/py312-buildhtml/lib/python3.12/site-packages/astropy/io/fits/hdu/hdulist.py:220, in fitsopen(name, mode, memmap, save_backup, cache, lazy_load_hdus, ignore_missing_simple, use_fsspec, fsspec_kwargs, decompress_in_memory, **kwargs)
217 if not name:
218 raise ValueError(f"Empty filename: {name!r}")
--> 220 return HDUList.fromfile(
221 name,
222 mode,
223 memmap,
224 save_backup,
225 cache,
226 lazy_load_hdus,
227 ignore_missing_simple,
228 use_fsspec=use_fsspec,
229 fsspec_kwargs=fsspec_kwargs,
230 decompress_in_memory=decompress_in_memory,
231 **kwargs,
232 )
File ~/project/.tox/py312-buildhtml/lib/python3.12/site-packages/astropy/io/fits/hdu/hdulist.py:484, in HDUList.fromfile(cls, fileobj, mode, memmap, save_backup, cache, lazy_load_hdus, ignore_missing_simple, **kwargs)
465 @classmethod
466 def fromfile(
467 cls,
(...) 475 **kwargs,
476 ):
477 """
478 Creates an `HDUList` instance from a file-like object.
479
(...) 482 documentation for details of the parameters accepted by this method).
483 """
--> 484 return cls._readfrom(
485 fileobj=fileobj,
486 mode=mode,
487 memmap=memmap,
488 save_backup=save_backup,
489 cache=cache,
490 ignore_missing_simple=ignore_missing_simple,
491 lazy_load_hdus=lazy_load_hdus,
492 **kwargs,
493 )
File ~/project/.tox/py312-buildhtml/lib/python3.12/site-packages/astropy/io/fits/hdu/hdulist.py:1186, in HDUList._readfrom(cls, fileobj, data, mode, memmap, cache, lazy_load_hdus, ignore_missing_simple, use_fsspec, fsspec_kwargs, decompress_in_memory, **kwargs)
1183 if fileobj is not None:
1184 if not isinstance(fileobj, _File):
1185 # instantiate a FITS file object (ffo)
-> 1186 fileobj = _File(
1187 fileobj,
1188 mode=mode,
1189 memmap=memmap,
1190 cache=cache,
1191 use_fsspec=use_fsspec,
1192 fsspec_kwargs=fsspec_kwargs,
1193 decompress_in_memory=decompress_in_memory,
1194 )
1195 # The Astropy mode is determined by the _File initializer if the
1196 # supplied mode was None
1197 mode = fileobj.mode
File ~/project/.tox/py312-buildhtml/lib/python3.12/site-packages/astropy/io/fits/file.py:220, in _File.__init__(self, fileobj, mode, memmap, overwrite, cache, use_fsspec, fsspec_kwargs, decompress_in_memory)
214 # Handle raw URLs
215 if (
216 isinstance(fileobj, (str, bytes))
217 and mode not in ("ostream", "append", "update")
218 and _is_url(fileobj)
219 ):
--> 220 self.name = download_file(fileobj, cache=cache)
221 # Handle responses from URL requests that have already been opened
222 elif isinstance(fileobj, http.client.HTTPResponse):
File ~/project/.tox/py312-buildhtml/lib/python3.12/site-packages/astropy/utils/data.py:1584, in download_file(remote_url, cache, show_progress, timeout, sources, pkgname, http_headers, ssl_context, allow_insecure)
1578 raise KeyError(
1579 f"No sources listed and file {remote_url} not in cache! "
1580 "Please include primary URL in sources if you want it to be "
1581 "included as a valid source."
1582 )
1583 elif len(sources) == 1:
-> 1584 raise errors[sources[0]]
1585 else:
1586 raise urllib.error.URLError(
1587 f"Unable to open any source! Exceptions were {errors}"
1588 ) from errors[sources[0]]
File ~/project/.tox/py312-buildhtml/lib/python3.12/site-packages/astropy/utils/data.py:1548, in download_file(remote_url, cache, show_progress, timeout, sources, pkgname, http_headers, ssl_context, allow_insecure)
1546 for source_url in sources:
1547 try:
-> 1548 f_name = _download_file_from_source(
1549 source_url,
1550 timeout=timeout,
1551 show_progress=show_progress,
1552 cache=cache,
1553 remote_url=remote_url,
1554 pkgname=pkgname,
1555 http_headers=http_headers,
1556 ssl_context=ssl_context,
1557 allow_insecure=allow_insecure,
1558 )
1559 # Success!
1560 break
File ~/project/.tox/py312-buildhtml/lib/python3.12/site-packages/astropy/utils/data.py:1332, in _download_file_from_source(source_url, show_progress, timeout, remote_url, cache, pkgname, http_headers, ftp_tls, ssl_context, allow_insecure)
1329 else:
1330 raise
-> 1332 with _try_url_open(
1333 source_url,
1334 timeout=timeout,
1335 http_headers=http_headers,
1336 ftp_tls=ftp_tls,
1337 ssl_context=ssl_context,
1338 allow_insecure=allow_insecure,
1339 ) as remote:
1340 info = remote.info()
1341 try:
File ~/project/.tox/py312-buildhtml/lib/python3.12/site-packages/astropy/utils/data.py:1246, in _try_url_open(source_url, timeout, http_headers, ftp_tls, ssl_context, allow_insecure)
1243 req = urllib.request.Request(source_url, headers=http_headers)
1245 try:
-> 1246 return urlopener.open(req, timeout=timeout)
1247 except urllib.error.URLError as exc:
1248 reason = exc.reason
File ~/.pyenv/versions/3.12.12/lib/python3.12/urllib/request.py:521, in OpenerDirector.open(self, fullurl, data, timeout)
519 for processor in self.process_response.get(protocol, []):
520 meth = getattr(processor, meth_name)
--> 521 response = meth(req, response)
523 return response
File ~/.pyenv/versions/3.12.12/lib/python3.12/urllib/request.py:630, in HTTPErrorProcessor.http_response(self, request, response)
627 # According to RFC 2616, "2xx" code indicates that the client's
628 # request was successfully received, understood, and accepted.
629 if not (200 <= code < 300):
--> 630 response = self.parent.error(
631 'http', request, response, code, msg, hdrs)
633 return response
File ~/.pyenv/versions/3.12.12/lib/python3.12/urllib/request.py:559, in OpenerDirector.error(self, proto, *args)
557 if http_err:
558 args = (dict, 'default', 'http_error_default') + orig_args
--> 559 return self._call_chain(*args)
File ~/.pyenv/versions/3.12.12/lib/python3.12/urllib/request.py:492, in OpenerDirector._call_chain(self, chain, kind, meth_name, *args)
490 for handler in handlers:
491 func = getattr(handler, meth_name)
--> 492 result = func(*args)
493 if result is not None:
494 return result
File ~/.pyenv/versions/3.12.12/lib/python3.12/urllib/request.py:639, in HTTPDefaultErrorHandler.http_error_default(self, req, fp, code, msg, hdrs)
638 def http_error_default(self, req, fp, code, msg, hdrs):
--> 639 raise HTTPError(req.full_url, code, msg, hdrs, fp)
HTTPError: HTTP Error 502: Bad GatewayMetadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcontent: spherexContent related issues/PRs for notebooks with SPHEREx relevanceContent related issues/PRs for notebooks with SPHEREx relevance