The exception that occurs when OCCweb is not operational is obscure:
During a time when OCCweb was undergoing maintenance I saw this:
In [5]: get_observations(8008) gives a weird error :
----> 1 get_observations(8008)
~/miniconda3/envs/ska3/lib/python3.8/site-packages/kadi/commands/observations.py in get_observations(obsid, start, stop, scenario, cmds)
319 if cmds is None:
320 if scenario not in OBSERVATIONS:
--> 321 cmds = get_cmds(scenario=scenario)
322 cmds_obs = cmds[cmds['tlmsid'] == 'OBS']
323 obsids = []
~/miniconda3/envs/ska3/lib/python3.8/site-packages/kadi/commands/commands_v2.py in get_cmds(start, stop, inclusive_stop, scenario, **kwargs)
212 else:
213 if scenario not in CMDS_RECENT:
--> 214 cmds_recent = update_archive_and_get_cmds_recent(
215 scenario, cache=True,
216 pars_dict=PARS_DICT, rev_pars_dict=REV_PARS_DICT)
~/miniconda3/envs/ska3/lib/python3.8/site-packages/kadi/commands/commands_v2.py in update_archive_and_get_cmds_recent(scenario, lookback, stop, cache, pars_dict, rev_pars_dict)
288
289 # Update loads table and download/archive backstop files from OCCweb
--> 290 loads = update_loads(scenario, cmd_events=cmd_events,
291 lookback=lookback, stop=stop)
292 logger.info(f'Including loads {", ".join(loads["name"])}')
~/miniconda3/envs/ska3/lib/python3.8/site-packages/kadi/commands/commands_v2.py in update_loads(scenario, cmd_events, lookback, stop)
858 loads_table = Table(loads_rows)
859 logger.info(f'Saving {len(loads_table)} loads to {loads_table_path}')
--> 860 loads_table.sort('cmd_start')
861 loads_table.write(loads_table_path, format='csv', overwrite=True)
862 loads_table.write(loads_table_path.with_suffix('.dat'), format='ascii.fixed_width',
~/miniconda3/envs/ska3/lib/python3.8/site-packages/astropy/table/table.py in sort(self, keys, reverse)
3270 keys = [keys]
3271
-> 3272 indexes = self.argsort(keys)
3273
3274 if reverse:
~/miniconda3/envs/ska3/lib/python3.8/site-packages/astropy/table/table.py in argsort(self, keys, kind, reverse)
3183 # use index sorted order if possible
3184 if keys is not None:
-> 3185 index = get_index(self, names=keys)
3186 if index is not None:
3187 idx = np.asarray(index.sorted_data())
~/miniconda3/envs/ska3/lib/python3.8/site-packages/astropy/table/index.py in get_index(table, table_copy, names)
630
631 if not names <= set(table.colnames):
--> 632 raise ValueError(f'{names} is not a subset of table columns')
633
634 for name in names:
ValueError: {'cmd_start'} is not a subset of table columns
A more direct test at the time showed a more obvious exception:
In [4]: from kadi.occweb import *
In [5]: get_occweb_dir('/')
---------------------------------------------------------------------------
HTTPError Traceback (most recent call last)
<ipython-input-5-52f987b5d995> in <module>
----> 1 get_occweb_dir('/')
~/git/kadi/kadi/occweb.py in get_occweb_dir(path, timeout, cache, user, password)
277 Table of directory entries
278 """
--> 279 html = get_occweb_page(path, timeout=timeout, cache=cache)
280 out = Table.read(html, format='ascii.html', guess=False)
281 del out['col0']
~/git/kadi/kadi/occweb.py in get_occweb_page(path, timeout, cache, binary, user, password)
245 auth = get_auth(user, password)
246 req = requests.get(url, auth=auth, timeout=timeout)
--> 247 req.raise_for_status() # raise exception if not 200
248
249 out = req.content if binary else req.text
~/miniconda3/envs/ska3/lib/python3.8/site-packages/requests/models.py in raise_for_status(self)
958
959 if http_error_msg:
--> 960 raise HTTPError(http_error_msg, response=self)
961
962 def close(self):
HTTPError: 403 Client Error: Forbidden for url: https://occweb.cfa.harvard.edu/
The exception that occurs when OCCweb is not operational is obscure:
During a time when OCCweb was undergoing maintenance I saw this:
A more direct test at the time showed a more obvious exception: