astropy / astropy/astroquery

BUG: eso.query_instrument help leaves unclosed sockets

Open
#2,539 0 comments 0 reactions 0 assignees View on GitHub
bug eso
Dominant language
Python
Stars
791
Forks
451
Avg merge
1d 3h
Merged PRs (30d)
4

Description

This happens for a number of instruments, I'm working around them for #2520, but this issue needs a proper fix

```
========================================================================== short test summary info ===========================================================================
FAILED astroquery/eso/tests/test_eso_remote.py::TestEso::test_SgrAstar_remotevslocal - pytest.PytestUnraisableExceptionWarning: Exception ignored in: , func = . at 0x133b61120>, when = 'call'
reraise = (, )

@classmethod
def from_call(
cls,
func: "Callable[[], TResult]",
when: "Literal['collect', 'setup', 'call', 'teardown']",
reraise: Optional[
Union[Type[BaseException], Tuple[Type[BaseException], ...]]
] = None,
) -> "CallInfo[TResult]":
"""Call func, wrapping the result in a CallInfo.

:param func:
The function to call. Called without arguments.
:param when:
The phase in which the function is called.
:param reraise:
Exception or exceptions that shall propagate if raised by the
function, instead of being wrapped in the CallInfo.
"""
excinfo = None
start = timing.time()
precise_start = timing.perf_counter()
try:
> result: Optional[TResult] = func()

/Users/bsipocz/.pyenv/versions/3.10.0/lib/python3.10/site-packages/_pytest/runner.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Users/bsipocz/.pyenv/versions/3.10.0/lib/python3.10/site-packages/_pytest/runner.py:259: in
lambda: ihook(item=item, **kwds), when=when, reraise=reraise
/Users/bsipocz/.pyenv/versions/3.10.0/lib/python3.10/site-packages/pluggy/_hooks.py:265: in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
/Users/bsipocz/.pyenv/versions/3.10.0/lib/python3.10/site-packages/pluggy/_manager.py:80: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/Users/bsipocz/.pyenv/versions/3.10.0/lib/python3.10/site-packages/_pytest/unraisableexception.py:88: in pytest_runtest_call
yield from unraisable_exception_runtest_hook()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

def unraisable_exception_runtest_hook() -> Generator[None, None, None]:
with catch_unraisable_exception() as cm:
yield
if cm.unraisable:
if cm.unraisable.err_msg is not None:
err_msg = cm.unraisable.err_msg
else:
err_msg = "Exception ignored in"
msg = f"{err_msg}: {cm.unraisable.object!r}\n\n"
msg += "".join(
traceback.format_exception(
cm.unraisable.exc_type,
cm.unraisable.exc_value,
cm.unraisable.exc_traceback,
)
)
> warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
E pytest.PytestUnraisableExceptionWarning: Exception ignored in:
E
E Traceback (most recent call last):
E File "/Users/bsipocz/.pyenv/versions/3.10.0/lib/python3.10/site-packages/bs4/element.py", line 311, in replace_with
E if any(x is self.parent for x in args):
E ResourceWarning: unclosed

/Users/bsipocz/.pyenv/versions/3.10.0/lib/python3.10/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning
---------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------
INFO: List of accepted column_filters parameters. [astroquery.eso.core]
INFO: The presence of a column in the result table can be controlled if prefixed with a [ ] checkbox. [astroquery.eso.core]
INFO: The default columns in the result table are shown as already ticked: [x]. [astroquery.eso.core]

Target Information
------------------
target:
resolver: simbad (SIMBAD name), ned (NED name), none (OBJECT as specified by the observer)
coord_sys: eq (Equatorial (FK5)), gal (Galactic)
coord1:
coord2:
box:
format: sexagesimal (Sexagesimal), decimal (Decimal)
[x] wdb_input_file:

Observation and proposal parameters
-----------------------------------
[ ] night:
stime:
starttime: 00 (00 hrs [UT]), 01 (01 hrs [UT]), 02 (02 hrs [UT]), 03 (03 hrs [UT]), 04 (04 hrs [UT]), 05 (05 hrs [UT]), 06 (06 hrs [UT]), 07 (07 hrs [UT]), 08 (08 hrs [UT]), 09 (09 hrs [UT]), 10 (10 hrs [UT]), 11 (11 hrs [UT]), 12 (12 hrs [UT]), 13 (13 hrs [UT]), 14 (14 hrs [UT]), 15 (15 hrs [UT]), 16 (16 hrs [UT]), 17 (17 hrs [UT]), 18 (18 hrs [UT]), 19 (19 hrs [UT]), 20 (20 hrs [UT]), 21 (21 hrs [UT]), 22 (22 hrs [UT]), 23 (23 hrs [UT]), 24 (24 hrs [UT])
etime:
endtime: 00 (00 hrs [UT]), 01 (01 hrs [UT]), 02 (02 hrs [UT]), 03 (03 hrs [UT]), 04 (04 hrs [UT]), 05 (05 hrs [UT]), 06 (06 hrs [UT]), 07 (07 hrs [UT]), 08 (08 hrs [UT]), 09 (09 hrs [UT]), 10 (10 hrs [UT]), 11 (11 hrs [UT]), 12 (12 hrs [UT]), 13 (13 hrs [UT]), 14 (14 hrs [UT]), 15 (15 hrs [UT]), 16 (16 hrs [UT]), 17 (17 hrs [UT]), 18 (18 hrs [UT]), 19 (19 hrs [UT]), 20 (20 hrs [UT]), 21 (21 hrs [UT]), 22 (22 hrs [UT]), 23 (23 hrs [UT]), 24 (24 hrs [UT])
[x] prog_id:
[ ] prog_type: % (Any), 0 (Normal), 1 (GTO), 2 (DDT), 3 (ToO), 4 (Large), 5 (Short), 6 (Calibration)
[ ] obs_mode: % (All modes), s (Service), v (Visitor)
[ ] pi_coi:
pi_coi_name: PI_only (as PI only), none (as PI or CoI)
[ ] prog_title:

Generic File Information
------------------------
[x] dp_id:
[x] ob_id:
[x] obs_targ_name:
[x] exptime:
[x] dp_cat: % (Any), ACQUISITION (ACQUISITION), CALIB (CALIB), SCIENCE (SCIENCE)
[x] dp_type: % (Any), BACKGROUND (BACKGROUND), DARK (DARK), FLAT,OFF (FLAT,OFF), KAPPA% (Any KAPPA), KAPPA,BACKGROUND (KAPPA,BACKGROUND), KAPPA,LAMP (KAPPA,LAMP), LAMP (LAMP), LAMP,NOFRINGE (LAMP,NOFRINGE), OBJECT OR OBJECT,RMNREC (OBJECT and OBJECT,RMNREC), OBJECT (OBJECT), OBJECT,RMNREC (OBJECT,RMNREC), SEARCH,SKY (SEARCH,SKY), SEARCH,STD (SEARCH,STD), SKY (SKY), STD OR STD,RMNREC (STD and STD,RMNREC), STD (STD), STD,RMNREC (STD,RMNREC), WAVE% (Any WAVE), WAVE,LAMP,FOIL (WAVE,LAMP,FOIL), WAVE,LAMP,PINHOLE (WAVE,LAMP,PINHOLE), WAVE,LAMP,SLIT (WAVE,LAMP,SLIT)
dp_type_user:
[x] dp_tech: % (Any), IMAGE (IMAGE), IMAGE,BASIC (IMAGE,BASIC), INTERFEROMETRY (INTERFEROMETRY), SPECTRUM (SPECTRUM)
[ ] tpl_id:
[ ] tpl_nexp:
[x] tpl_start:

Instrument Specific Information
-------------------------------
[x] tel_id: % (Any), ESO-VLTI-U1234 (4 UTs), ESO-VLTI-A1234 (4 ATs)
[x] det_name: % (Any), SQLNULL OR MATISSE-LM (MATISSE-LM), SQLNULL OR MATISSE-N (MATISSE-N)
[x] ins_mode: % (Any), HI-SENS (HI-SENS), HYBRID (HYBRID), IMAGING (IMAGING), SI-PHOT (SI-PHOT)
[x] det_read_curname: % (Any), SCI-HIGH-GAIN (SCI-HIGH-GAIN), SCI-LOW-GAIN (SCI-LOW-GAIN), SCI-FAST-SPEED (SCI-FAST-SPEED), SCI-SLOW-SPEED (SCI-SLOW-SPEED)
[x] det_seq1_dit:
[ ] det_win_mtrs2:
[ ] det_win_mtrh2:
[x] det_ndit:
[ ] photometric_slider: % (Any), INTER (INTER), PHOTO (PHOTO)
[x] dispersive_element: % (Any), HIGH (HIGH), HIGH+ (HIGH+), LOW (LOW), MED (MED), OPEN (OPEN)
[x] filter: % (Any), L (L), L- (L-), LM (LM), M (M), N (N), N- (N-), OPEN (OPEN)
[ ] polarizer: % (Any), DARK (DARK), OPEN (OPEN)
[ ] spatial_filter: % (Any), 0.66x5.5 (0.66x5.5), 1.00 (1.00), 1.00x5 (1.00x5), 1.50 (1.50), 1.50x5.5 (1.50x5.5), 2.00 (2.00), 2.00x5 (2.00x5), DIAPH (DIAPH), DIST1 (DIST1), DIST2 (DIST2)
[x] ins_bcd1_name: % (Any), IN (IN), OUT (OUT)
[x] ins_bcd2_name: % (Any), IN (IN), OUT (OUT)
[ ] del_ft_sensor: % (Any), GRAVITY (GRAVITY), MATISSE (MATISSE)
[ ] iss_chop_st: % (Any), F (False), T (True)
[ ] iss_chop_freq:
[ ] iss_conf_station1: % (Any), U1 (UT1), U2 (UT2), U3 (UT3), U4 (UT4), A0 (A0), A1 (A1), B0 (B0), B1 (B1), B2 (B2), B3 (B3), B4 (B4), B5 (B5), C0 (C0), C1 (C1), C2 (C2), C3 (C3), D0 (D0), D1 (D1), D2 (D2), E0 (E0), G0 (G0), G1 (G1), G2 (G2), H0 (H0), I1 (I1), J1 (J1), J2 (J2), J3 (J3), J4 (J4), J5 (J5), J6 (J6), K0 (K0), L0 (L0), M0 (M0)
[ ] iss_conf_station2: % (Any), U1 (UT1), U2 (UT2), U3 (UT3), U4 (UT4), A0 (A0), A1 (A1), B0 (B0), B1 (B1), B2 (B2), B3 (B3), B4 (B4), B5 (B5), C0 (C0), C1 (C1), C2 (C2), C3 (C3), D0 (D0), D1 (D1), D2 (D2), E0 (E0), G0 (G0), G1 (G1), G2 (G2), H0 (H0), I1 (I1), J1 (J1), J2 (J2), J3 (J3), J4 (J4), J5 (J5), J6 (J6), K0 (K0), L0 (L0), M0 (M0)
[ ] iss_conf_station3: % (Any), U1 (UT1), U2 (UT2), U3 (UT3), U4 (UT4), A0 (A0), A1 (A1), B0 (B0), B1 (B1), B2 (B2), B3 (B3), B4 (B4), B5 (B5), C0 (C0), C1 (C1), C2 (C2), C3 (C3), D0 (D0), D1 (D1), D2 (D2), E0 (E0), G0 (G0), G1 (G1), G2 (G2), H0 (H0), I1 (I1), J1 (J1), J2 (J2), J3 (J3), J4 (J4), J5 (J5), J6 (J6), K0 (K0), L0 (L0), M0 (M0)
[ ] iss_conf_station4: % (Any), U1 (UT1), U2 (UT2), U3 (UT3), U4 (UT4), A0 (A0), A1 (A1), B0 (B0), B1 (B1), B2 (B2), B3 (B3), B4 (B4), B5 (B5), C0 (C0), C1 (C1), C2 (C2), C3 (C3), D0 (D0), D1 (D1), D2 (D2), E0 (E0), G0 (G0), G1 (G1), G2 (G2), H0 (H0), I1 (I1), J1 (J1), J2 (J2), J3 (J3), J4 (J4), J5 (J5), J6 (J6), K0 (K0), L0 (L0), M0 (M0)

Ambient Parameters
------------------
[x] fwhm_avg:
[ ] airmass_range:
[ ] night_flag: % (Any), 0 (Night), 1 (Twilight), 2 (Daytime)
[ ] moon_illu:

Result set
----------
order: (nothing (faster)), dp_id (Observation Time), dp_cat (DPR.CATG), dp_tech (DPR.TECH), tpl_start (TPL.START), ob_id asc (OB.ID (ascending)), ob_id desc (OB.ID (descending)), period asc,prog_id asc (Period and Run ID (earliest first)), period desc,prog_id desc (Period and Run ID (latest first))
----------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------
INFO astroquery:core.py:952 List of accepted column_filters parameters.
INFO astroquery:core.py:953 The presence of a column in the result table can be controlled if prefixed with a [ ] checkbox.
INFO astroquery:core.py:955 The default columns in the result table are shown as already ticked: [x].

```

Contributor guide

Open the contributing guide

Research direction

Start by running the ESO tests in astroquery/eso/tests/test_eso_remote.py, especially TestEso.test_help for the affected instruments and test_SgrAstar_remotevslocal. Trace those tests into the eso.query_instrument entry point to identify the resource lifetime involved. Done means the affected tests complete without unclosed-socket ResourceWarnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.