LCOGT / mop

Microlensing Observation Portal
GNU General Public License v3.0
0 stars 7 forks source link

Running TAP on local MOP without LCO username #153

Open mpgh opened 3 months ago

mpgh commented 3 months ago

When running MOP locally (branch dev) and running TAP using "python manage.py run_TAP all none" and without credentials in settings, the following error occurs:

"mop/toolbox/obs_control.py", line 33, in fetch_pending_lco_requestgroups "https://observe.lco.global/api/requestgroups/?state=PENDING&user=" + username) TypeError: can only concatenate str (not "NoneType") to str

mpgh commented 3 months ago

Potential fix, check if username is empty and avoid calling run_tap lines 62, 63 i.e.

response = obs_control.fetch_pending_lco_requestgroups() pending_obs = obs_control.parse_lco_requestgroups(response)

mpgh commented 3 months ago

related to this enhancement is also a suggestion to the exception handling, i.e. perhaps log the Exception via
except Exception as exception_message: logger.warning('runTAP: Cannot perform TAP for target ' + event.name + ' ' + str(exception_message))

KKruszynska commented 3 months ago

I added exception logging. In my local version of mop I have a my LCO username and a fake program number (LCO_USERNAME="kkruszynska", LCO_PROPOSAL_ID="KEY2023-aaaO"), which could be a "solution" to this problem.