Skip to content

Commit

Permalink
LCO Triggering (skyportal#1883)
Browse files Browse the repository at this point in the history
* Better matching of redirect routes

* Another try at LCO

* config modifications

* fix lint issues

* Add yaml for static requests

* Replace with test token

* Fix parsing of Tornado headers

* Fix test altdata

* Run CI on test branch

* Fix some issues with LCO request posting

* Record delete requests

* Restore test workflow

* Kyung's comments #1

* Add some information in test_api_server about cache file

* Kyung comments

* Remove debug

* Simplify regex matching

Co-authored-by: kshin <[email protected]>
Co-authored-by: Michael Coughlin <[email protected]>
  • Loading branch information
3 people authored May 10, 2021
1 parent b30e6ea commit 26d4056
Show file tree
Hide file tree
Showing 12 changed files with 1,764 additions and 13 deletions.
4 changes: 4 additions & 0 deletions config.yaml.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ app:
lt_host: 161.72.57.3
lt_port: 8080

lco_protocol: https
lco_host: observe.lco.global
lco_port: 443

# See https://stackoverflow.com/a/35604855 for syntax
# These are Javascript component routes
routes:
Expand Down
73 changes: 73 additions & 0 deletions data/db_demo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,24 @@ telescope:
skycam_link: http://telescope.livjm.ac.uk/data/archive/webfiles/QS/Latest/t_latest_hms.jpg
robotic: true
=id: LT
- diameter: 1.0
elevation: 2070.0
lat: 30.68
lon: -104.0151
nickname: LCO 1m Network
name: LCOGT1m
skycam_link: null
robotic: true
=id: LCOGT1m
- diameter: 2.0
elevation: 3052.0
lat: 20.7083
lon: -156.2571
nickname: LCO 2m Network
name: LCOGT2m
skycam_link: null
robotic: true
=id: LCOGT2m

instrument:
- name: ZTF
Expand Down Expand Up @@ -193,6 +211,33 @@ instrument:
telescope_id: =LT
api_classname: SPRATAPI
=id: SPRAT
- band: optical
name: Sinistro
telescope_id: =LCOGT1m
type: imager
filters: ['sdssu', 'sdssg', 'sdssr', 'sdssi', 'sdssz', 'desy']
api_classname: SINISTROAPI
=id: SINISTRO
- band: optical
name: SPECTRAL
telescope_id: =LCOGT2m
type: imager
filters: ['sdssu', 'sdssg', 'sdssr', 'sdssi', 'sdssz', 'desy']
api_classname: SPECTRALAPI
=id: SPECTRAL
- band: optical
name: FLOYDS
telescope_id: =LCOGT2m
type: spectrograph
api_classname: FLOYDSAPI
=id: FLOYDS
- band: optical
name: MUSCAT
telescope_id: =LCOGT2m
type: imager
filters: ['sdssg', 'sdssr', 'sdssi', 'sdssz']
api_classname: MUSCATAPI
=id: MUSCAT

allocation:
- pi: Michael Coughlin
Expand Down Expand Up @@ -226,6 +271,34 @@ allocation:
group_id: =program_A
instrument_id: =IOI
_altdata: '{"username": "fritz_bot", "password": "fX5uxZTDy3", "LT_proposalID": "GrowthTest"}'
- pi: Michael Coughlin
proposal_id: Spectral-001
start_date: "3020-02-12T00:00:00"
end_date: "3020-07-12T00:00:00"
hours_allocated: 100
group_id: =program_A
instrument_id: =SPECTRAL
- pi: Michael Coughlin
proposal_id: Sinistro-001
start_date: "3020-02-12T00:00:00"
end_date: "3020-07-12T00:00:00"
hours_allocated: 100
group_id: =program_A
instrument_id: =SINISTRO
- pi: Michael Coughlin
proposal_id: FLOYDS-001
start_date: "3020-02-12T00:00:00"
end_date: "3020-07-12T00:00:00"
hours_allocated: 100
group_id: =program_A
instrument_id: =FLOYDS
- pi: Michael Coughlin
proposal_id: MUSCAT-001
start_date: "3020-02-12T00:00:00"
end_date: "3020-07-12T00:00:00"
hours_allocated: 100
group_id: =program_A
instrument_id: =MUSCAT

candidates:
- id: 14gqr_unsaved_copy
Expand Down
25 changes: 23 additions & 2 deletions data/instruments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,29 @@
name: Sinistro
telescope_id: =LCOGT1m
type: imager
filters: ['sdssu', 'sdssg', 'sdssr', 'sdssi', 'desy',
'bessellb', 'bessellv', 'bessellr', 'besselli']
filters: ['sdssu', 'sdssg', 'sdssr', 'sdssi', 'sdssz', 'desy']
api_classname: SINISTROAPI
=id: SINISTRO
- band: optical
name: SPECTRAL
telescope_id: =LCOGT2m
type: imager
filters: ['sdssu', 'sdssg', 'sdssr', 'sdssi', 'sdssz', 'desy']
api_classname: SPECTRALAPI
=id: SPECTRAL
- band: optical
name: FLOYDS
telescope_id: =LCOGT2m
type: spectrograph
api_classname: FLOYDSAPI
=id: FLOYDS
- band: optical
name: MUSCAT
telescope_id: =LCOGT2m
type: imager
filters: ['sdssg', 'sdssr', 'sdssi', 'sdssz']
api_classname: MUSCATAPI
=id: MUSCAT
- band: optical
name: WFCCD
telescope_id: =DUP
Expand Down
9 changes: 9 additions & 0 deletions data/telescopes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,15 @@
skycam_link: null
robotic: true
=id: LCOGT1m
- diameter: 2.0
elevation: 3052.0
lat: 20.7083
lon: -156.2571
nickname: LCOGT 2m Network
name: LCOGT2m
skycam_link: null
robotic: true
=id: LCOGT2m
- diameter: 2.5
elevation: 2282.0
lat: -29.0033
Expand Down
161 changes: 161 additions & 0 deletions data/tests/test_server_recordings_static.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
interactions:
- request:
body:
'{"name": "cbbf7050a76247858a3084c5dabdc52c", "proposal": "TOM2020A-008",
"ipp_value": 1, "operator": "SINGLE", "observation_type": "NORMAL", "requests":
[{"configurations": [{"type": "EXPOSE", "instrument_type": "1M0-SCICAM-SINISTRO",
"constraints": {"max_airmass": 2, "min_lunar_distance": 30}, "target": {"name":
"cbbf7050a76247858a3084c5dabdc52c", "type": "ICRS", "ra": 123.813909, "dec":
-5.867007, "epoch": 2000}, "acquisition_config": {}, "guiding_config": {}, "instrument_configs":
[{"exposure_time": 300, "exposure_count": 1, "optical_elements": {"filter":
"gp"}}]}, {"type": "EXPOSE", "instrument_type": "1M0-SCICAM-SINISTRO", "constraints":
{"max_airmass": 2, "min_lunar_distance": 30}, "target": {"name": "cbbf7050a76247858a3084c5dabdc52c",
"type": "ICRS", "ra": 123.813909, "dec": -5.867007, "epoch": 2000}, "acquisition_config":
{}, "guiding_config": {}, "instrument_configs": [{"exposure_time": 300, "exposure_count":
1, "optical_elements": {"filter": "Y"}}]}], "windows": [{"start": "2021-04-16
00:00:00", "end": "2021-04-23 00:00:00"}], "location": {"telescope_class": "1m0"}}]}'
headers:
Accept:
- "*/*"
Accept-Encoding:
- gzip, deflate
Authorization:
- Token testtoken
Connection:
- keep-alive
Content-Length:
- "1094"
Content-Type:
- application/json
User-Agent:
- Python-urllib/3.8
method: POST
uri: https://observe.lco.global/api/requestgroups/
response:
body:
string: !!binary |
H4sIAAAAAAAA/+1VXW/aMBT9L34OyDYJCXmrurZCKlCVPuxDU+Q4Biwldmo7HRXiv+/ayVqmdd26
x6kSD+Z+nnPuvcoByQrlhMwIjWcRMuK+E9ZZlH85BA+NEzqlkwjVmjMntUL5ATlRC8t1KwpeMwvB
iDQYHSPEtdrIbWdC5HORJJ1mcUqC3zrDpPIdDqhh+4JJ04QadIwj1EhV1J1ipqikdUxxgfIJDh6I
7T3tjlkwq66ue7MVQqrtkwVKQA9lW2aE4o8/7GIP1gKMrPHNjwBXejRdI5QreuQ9ZLFvte2MKJxs
Qv8AQLdOclYXwN1nBAIbWTthgP+29fQbXUE82kC/YgN9BIqei3HdKQdSR6gEhPun12N4Ge2Y06YY
SqAX8H6NEOP3nbTSqzsgDjL2OavLy9N+Pfjfct92sgLVTsp4glqxGuUginhis1qiF8kf/76XY2Yr
XNicx9bXnJ/frqGq8hLliJflJsUJZumUxmmWZGyCs5gnFSsrnlAOkYaBSnQyzshkhmFPK8FRPkrG
2TTFOI1Qa2AbvXpBGh8dZvazOST1dkBX12w//BWt5jvYQNxP+vVNGSiQBR6tz+fnZ4vRer6cr+9u
V4BzcF58vFmtL14YoocktZHOT/0YnZ4H/Y/P49P7dbxfx9uug/qJfpOq0t/6tYN9N6ASopiSEY5H
ZHqHcR5+n30tVZ046eTE6StVw0cJ5WkWw8RKK8xDsBRKu2GpoEV43lwsP8yXVyhMWW6kqH7pS2ge
p+NZGtMJ9e25EZD7WlwSYDLORetYKWtgWbidEXana8ibgbgeqO3KRrr+bBq4iu2ulupN23DKbVB8
ubpdnF2HTRXGXxLYYC5X134Ksm2LB1Z3EEj8gP9EheBZoPIPahFCiU/1m6etPyZ0t1pALD4bYZyh
43c5DEUbjwgAAA==
headers:
Allow:
- GET, POST, HEAD, OPTIONS
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Length:
- "694"
Content-Type:
- application/json
Date:
- Fri, 16 Apr 2021 00:12:48 GMT
Server:
- nginx/1.19.1
Vary:
- Accept, Origin, Cookie, Accept-Encoding
X-Frame-Options:
- SAMEORIGIN
status:
code: 201
message: Created
- request:
body: null
headers:
Accept:
- "*/*"
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Host:
- localhost:64502
User-Agent:
- python-requests/2.25.1
method: GET
uri: https://observe.lco.global/api/requestgroups/
response:
body:
string:
"<html>\r\n<head><title>404 Not Found</title></head>\r\n<body>\r\n<center><h1>404
Not Found</h1></center>\r\n<hr><center>nginx/1.19.1</center>\r\n</body>\r\n</html>\r\n"
headers:
Connection:
- keep-alive
Content-Length:
- "153"
Content-Type:
- text/html
Date:
- Mon, 19 Apr 2021 16:31:45 GMT
Server:
- nginx/1.19.1
status:
code: 404
message: Not Found
- request:
body: null
headers:
Accept:
- "*/*"
Accept-Encoding:
- gzip, deflate
Authorization:
- Token testtoken
Connection:
- keep-alive
Content-Length:
- "0"
User-Agent:
- python-requests/2.25.1
method: POST
uri: https://observe.lco.global/api/requestgroups/1191249/cancel/
response:
body:
string: !!binary |
H4sIAAAAAAAA/+1VW2/aMBT+L34OyHHueUOMTkgFpsLDLpoi4xiwlNip47RUiP++Yydrmca29nWq
xIM51+/7zjnKCYkS5b6f+STMPKT5fcdb06L828l5SBiRmAQeqhSjRiiJ8hMyvOItUw0vWEVbCEZ+
jdHZQ0zJndh32kW+FImSOA0T3/lbo6mQtsMJ1fRYUKFrV4OMsYdqIYuqk1QXpWgNlYyjPMDOA7G9
pznQFsyyq6re3HIu5P7ZAiWgh2wbqrlkTz/t/AjWAoy0ts3PAFdYNF3NpSl65D1kfmxU22leGFG7
/g6AaoxgtCqAu81wBHaiMlwD/31j6deqhHi0g37FDvpw5L0UY6qTBqT20BYQHp9fT+6llaFG6WIo
ga7g/e4hyu470Qqr7oDYydjnrG5uLvv14P/Ifd+JElS7KGMJKkkrlIMo/JnNaomukj+/vpehes+N
25ynxtacT+/WUFVaiXLEtttdgiNMk5iESRqlNMBpyKKSbksWEQaRmoJKJBinfpBh2NOSM5SPonEa
JxgnHmo0bKNVz0ljo93MfjW7pN4O6KqKHoe/vFHsABuI+0n/fVMGCv4Cj9bT+XSyGK3ny/l6c7cC
nINz9vnTaj27MkQLSSgtjJ362bs8D/Ifn8eX9+t4v463XQexE30UslSP/drBvmtQCRFM/BEOR368
wTh3v6+2liwvnCS4cNpK5fBRQnmShjCxbcv1g7MUUplhqaCFe04ny+nsdvYBuTGLneDlb439OAfF
MY7DKLX9meaQfCWO5GEyzpKQRA4nZYw3hm5FBTQLc9C8PagK8jJQ1yJtu20tTH83NZzF/lAJ+aZ1
uCQ3SL5c3S0mt25VubanBDYYzMdbOwbRNMUDrToI9O2E/0XFx5mj8kq5sg2BxDT3kzGO4iAjNtfu
nmrtOaHNagGxeDLCOEXnH8y7xjKRCAAA
headers:
Allow:
- POST, OPTIONS
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Length:
- "708"
Content-Type:
- application/json
Date:
- Mon, 19 Apr 2021 22:48:17 GMT
Server:
- nginx/1.19.1
Vary:
- Accept, Origin, Cookie, Accept-Encoding
X-Frame-Options:
- SAMEORIGIN
status:
code: 200
message: OK
version: 1
1 change: 1 addition & 0 deletions skyportal/facility_apis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from .interface import FollowUpAPI, Listener
from .sedm import SEDMAPI, SEDMListener
from .lt import IOOAPI, IOIAPI, SPRATAPI
from .lco import SINISTROAPI, SPECTRALAPI, FLOYDSAPI, MUSCATAPI
Loading

0 comments on commit 26d4056

Please sign in to comment.