Package glue :: Module datafind
[hide private]
[frames] | no frames]

Module datafind

source code

The client library for the LIGO Data Replicator (LDR) service.

The DataFind service allows users to query for the location of Gravitational-Wave Frame (GWF) files containing data from the current LIGO and Virgo gravitational-wave detectors.

This module defines the GWDataFindHTTPConnection and GWDataFindHTTPSConnection class objects, for connecting to an LDR server in open and authenticated access modes respectively. The authenticated GWDataFindHTTPSConnection connection requires users have a valid X509 certificate that is registered with the server in question.

A new connection can be opened as follows:

>>> from glue.datafind import GWDataFindHTTPConnection
>>> connection = GWDataFindHTTPConnection(host, port)

and similar for the HTTPS version.

Users on the LIGO Data Grid (LDG) can connect without giving the name of the relevant host, so long as the LIGO_DATAFIND_SERVER environment variable is defined:

>>> connection = GWDataFindHTTPConnection()

Queries for frames can be made using the find_frame_urls method of the relevant connection:

>>> cache = connection.find_frame_urls('L', 'L1_R', 1093564816, 1093651216)

By default, the returned Cache object includes both gsiftp and local file versions of each frame, but the urlfile keyword argument can be given to return only one of those:

>>> cache = connection.find_frame_urls('L', 'L1_R', 1093564816, 1093651216, urltype='file')

See the documentation for each connection method for more detailed examples.


Version: 8cbd1b7187ce3ed9a825d6ed11cc432f3cfde9a5

Date: 2017-12-05 15:29:36 +0000

Author: Duncan Macleod <duncan.macleod@ligo.org>

Classes [hide private]
  GWDataFindHTTPConnection
Connection to LIGO data replicator service using HTTP.
  GWDataFindHTTPSConnection
Secured connection to LIGO data replicator service using HTTPS.
  TestLDR
Small suite of test functions.
Functions [hide private]
 
find_credential()
Locate the users X509 certificate and key files
source code
 
find_server()
Find the default server host from the environment
source code
 
validate_proxy(path)
Validate the users X509 proxy certificate
source code
Variables [hide private]
  __credits__ = 'Scott Koranda <scott.koranda@ligo.org>'
  __package__ = 'glue'
  _server_env = 'LIGO_DATAFIND_SERVER'
  _url_prefix = '/LDR/services/data/v1'
Function Details [hide private]

find_credential()

source code 

Locate the users X509 certificate and key files

This method uses the X509_USER_CERT and X509_USER_KEY to locate valid proxy information. If those are not found, the standard location in /tmp/ is searched.

Raises:
  • RuntimeError - if the proxy found via either method cannot be validated
  • RuntimeError - if the cert and key files cannot be located

find_server()

source code 

Find the default server host from the environment

This method uses the LIGO_DATAFIND_SERVER variable to construct a (host, port) tuple.

Returns:
(host, port): the str host name and int port number
Raises:
  • RuntimeError - if the LIGO_DATAFIND_SERVER environment variable is not set

validate_proxy(path)

source code 

Validate the users X509 proxy certificate

Tests that the proxy certificate is RFC 3820 compliant and that it is valid for at least the next 15 minutes.

Returns:
True if the certificate validates
Raises:
  • RuntimeError - if the certificate cannot be validated