Commit 4882ce8c authored by Alexander Pace's avatar Alexander Pace

RAVEN and TLS changes

Added support for time/space_coinc_far RAVEN fields for superevents.
Removed restriction that limited TLS to 1.0. Necessary to upgrade TLS
version support on the server-side.
parent 5b53da72
Pipeline #131598 passed with stages
in 4 minutes and 38 seconds
ligo-gracedb (2.6.0-1) unstable; urgency=low
* Added time/space_coinc_far fields to support RAVEN
* Testing and packaging changes.
-- Alexander E. Pace <alexander.pace@ligo.org> Thu, 04 Jun 2020 19:59:39 +0000
ligo-gracedb (2.5.0-1) unstable; urgency=low
* Add RAVEN fields to updateSuperevent
......
Changelog
=========
2.6.0 (June 04, 2020)
-------------------------
- Added time/space_coinc_far fields to support RAVEN
- Testing and packaging changes.
2.5.0 (November 25, 2019)
-------------------------
......
%define name ligo-gracedb
%define version 2.5.0
%define unmangled_version 2.5.0
%define version 2.6.0
%define unmangled_version 2.6.0
%define release 1
Summary: Gravity Wave Candidate Event Database
......
......@@ -278,7 +278,7 @@ class GsiRest(object):
def set_up_connector(self, host, port, proxy_host, proxy_port):
# Prepare SSL context
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS)
if (self.auth_type == 'x509'):
try:
ssl_context.load_cert_chain(self.credentials['cert_file'],
......@@ -1225,7 +1225,7 @@ class GraceDb(GsiRest):
def updateSuperevent(self, superevent_id, t_start=None, t_0=None,
t_end=None, preferred_event=None, em_type=None,
coinc_far=None):
time_coinc_far=None, space_coinc_far=None):
r"""Update a superevent's parameters.
The same permission restrictions apply as for
......@@ -1249,9 +1249,14 @@ class GraceDb(GsiRest):
em_type (:obj:`str`, optional): name of coincident EM search
for "preferred" EM coincident event. Defined by analyst or
pipeline (e.g., RAVEN). Default is null for new superevents.
coinc_far (:obj:`float`, optional): new value for coincident FAR
with preferred EM coincident event. Defined by analyst or
pipeline (e.g., RAVEN). Default is null for new superevents.
time_coinc_far (:obj:`float`, optional): new value for temporal
coincident FAR with preferred EM coincident event. Defined by
analyst or pipeline (e.g., RAVEN). Default is null for new
superevents.
space_coinc_far (:obj:`float`, optional): new value for temporal
coincident FAR with preferred EM coincident event. Defined by
analyst or pipeline (e.g., RAVEN). Default is null for new
superevents.
Returns:
:class:`httplib.HTTPResponse`
......@@ -1269,9 +1274,10 @@ class GraceDb(GsiRest):
""" # noqa: W605
# Make sure that at least one parameter is provided
if not (t_start or t_0 or t_end or preferred_event
or em_type or coinc_far):
or em_type or time_coinc_far or space_coinc_far):
raise ValueError('Provide at least one of t_start, t_0, t_end, '
'preferred_event, em_type, or coinc_far')
'preferred_event, em_type, time_coinc_far, '
'or space_coinc_far')
request_body = {}
if t_start is not None:
......@@ -1284,8 +1290,10 @@ class GraceDb(GsiRest):
request_body['preferred_event'] = preferred_event
if em_type is not None:
request_body['em_type'] = em_type
if coinc_far is not None:
request_body['coinc_far'] = coinc_far
if time_coinc_far is not None:
request_body['time_coinc_far'] = time_coinc_far
if space_coinc_far is not None:
request_body['space_coinc_far'] = space_coinc_far
template = self.templates['superevent-detail-template']
uri = template.format(superevent_id=superevent_id)
return self.patch(uri, body=request_body)
......
......@@ -90,7 +90,10 @@ def test_creation_with_labels(client, create_event):
{'t_start': 1024, 't_0': 2048, 't_end': 4096, 'preferred_event': True,
'em_type': 'EM_TYPE_TEST'},
{'t_start': 1025, 't_0': 2049, 't_end': 4097, 'preferred_event': True,
'em_type': 'EM_TYPE_TEST', 'coinc_far': 1234.0},
'em_type': 'EM_TYPE_TEST', 'time_coinc_far': 1234.0},
{'t_start': 1025, 't_0': 2049, 't_end': 4097, 'preferred_event': True,
'em_type': 'EM_TYPE_TEST', 'time_coinc_far': 1234.0,
'space_coinc_far': 12345.0},
]
)
def test_update(client, create_event, create_superevent, params):
......
......@@ -330,7 +330,7 @@ def test_creation_args(
def test_update_no_args(safe_client):
err_msg = ('Provide at least one of t_start, t_0, t_end, preferred_event, '
'em_type, or coinc_far')
'em_type, time_coinc_far, or space_coinc_far')
with pytest.raises(ValueError, match=err_msg):
safe_client.updateSuperevent('S181224a')
......@@ -343,9 +343,10 @@ def test_update_no_args(safe_client):
{'t_end': 3},
{'preferred_event': 'G0001'},
{'em_type': 'EM_TEST'},
{'coinc_far': '4'},
{'time_coinc_far': 4},
{'space_coinc_far': 5},
{'t_start': 1, 't_0': 2, 't_end': 3, 'preferred_event': 'G0001',
'em_type': 'EM_TEST', 'coinc_far': '4'},
'em_type': 'EM_TEST', 'time_coinc_far': 4, 'space_coinc_far': 5},
]
)
def test_update_args(safe_client, update_kwargs):
......
......@@ -120,7 +120,7 @@ def test_creation_args(
def test_update_no_args(safe_client):
err_msg = ('Provide at least one of t_start, t_0, t_end, preferred_event, '
'em_type, or coinc_far')
'em_type, time_coinc_far, or space_coinc_far')
with pytest.raises(ValueError, match=err_msg):
safe_client.updateSuperevent('S181224a')
......@@ -133,9 +133,10 @@ def test_update_no_args(safe_client):
{'t_end': 3},
{'preferred_event': 'G0001'},
{'em_type': 'EM_TEST'},
{'coinc_far': '4'},
{'time_coinc_far': 4},
{'space_coinc_far': 5},
{'t_start': 111, 't_0': 222, 't_end': 333, 'preferred_event': 'G0001',
'em_type': 'EM_TEST', 'coinc_far': '4'},
'em_type': 'EM_TEST', 'time_coinc_far': 4, 'space_coinc_far': 5},
]
)
def test_update_args(safe_client, update_kwargs):
......
__version__ = '2.5.0'
__version__ = '2.6.0'
......@@ -43,14 +43,20 @@ with open(readme_file, 'rb') as f:
tests_require = []
# Add pytest requirement - 5.0.0+ only supports Python 3.5+
pytest_requirement = 'pytest>=3.1.0'
pyparsing_requirement = 'pyparsing==2.4.7'
zipp_requirement = 'zipp==0.6.0'
it_requirement = 'more-itertools==5.0.0'
if sys.version_info < (3, 5):
pytest_requirement += ',<5.0.0'
tests_require.append(pytest_requirement)
tests_require.append(pyparsing_requirement)
tests_require.append(zipp_requirement)
tests_require.append(it_requirement)
tests_require.append('pytest-cov')
# Add mock for Python 2
if sys.version_info.major < 3:
tests_require.append('mock>=2.0.0')
tests_require.append('mock==3.0.5')
# Only install setup_requires for the specific command being used
SETUP_REQUIRES = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment