Skip to content
Snippets Groups Projects

Update DataSourceInfo API

Merged James Kennington requested to merge feature-datasource-api into master

Motivation

The datasource information utilities in gstlal.datasource were designed such that optparse command-line arg parsing was the primary means of initializing a GWDataSourceInfo object; a necessary step to build any pipeline using mkbasicsrc. The new api, via DataSourceInfo has several goals:

  1. Direct construction of datasources from Python literals
  2. Preserve compatibility with command-line args
  3. Provide convenience functions for constructing pipeline datasources directly in Python

Changes

This MR touches a lot of scripts, but should preserve existing functionality. The primary changes occur in a single module, gstlal.datasource, where the GWDataSourceInfo object and utilities have been deprecated in favor of the DataSourceInfo object and utilities. Feature-set is preserved but interface is improved, see examples below. Specific changes include:

  • New DataSourceInfo class with improved interface and backwards compat
  • Generalized command-line parsing utilities, such as datasource.parse_list_to_dict
  • New administrative utilities in gstlal.utilities.admin for:
    • Adding deprecation warnings to classes, functions, or methods
    • Adding copyright stubs to modules
  • Accompanying tests

Examples

Legacy: GWDataSourceInfo

args = [
'--data-source=frames',
'--frame-cache=/path/to/cache',
'--channel-name=H1=CHANNEL',
'--gps-start-time=1234567',
'--gps-end-time=1234568',
]
parser = optparse.OptionParser(description="test legacy mkbasicsrc")
datasource.append_options(parser)
options, filenames = parser.parse_args(args)
info = GWDataSourceInfo(options)

New api: DataSourceInfo

info = DataSourceInfo(data_source='frames',
                      frame_cache='path/to/cache',
                      gps_start_time=1234567,
                      gps_end_time=1234568,
                      channel_name={'H1': 'CHANNEL'})

Refactor and Drop-In Replacement

What was:

gw_data_source_info = datasource.GWDataSourceInfo(options)

Becomes:

gw_data_source_info = datasource.DataSourceInfo.from_optparse(options)
Edited by James Kennington

Merge request reports

Pipeline #263619 passed

Pipeline passed for 75fb7d8a on feature-datasource-api

Approved by

Merged by James KenningtonJames Kennington 3 years ago (Jul 29, 2021 2:29pm UTC)

Merge details

  • Changes merged into master with a73bacd7 (commits were squashed).
  • Deleted the source branch.

Pipeline #264334 passed

Pipeline passed for a73bacd7 on master

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • James Kennington added 4 commits

    added 4 commits

    • 7edb8bf4 - add utilities subpackage and admin module
    • 86c7c314 - add datasource tests for drop-in replacement interface
    • f0d3ab90 - revert admin.py
    • 6eef7f89 - add tests for drop-in-replacement

    Compare with previous version

  • James Kennington changed the description

    changed the description

  • James Kennington added 2 commits

    added 2 commits

    • 9264b976 - split tests for gstlal-ugly deps
    • dab9f9e9 - filter gstlal-ugly dep tests from gstlal pytest suite

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • James Kennington added 2 commits

    added 2 commits

    Compare with previous version

  • added 1 commit

    • 01b34999 - group legacy tests for gstlal-ugly dep

    Compare with previous version

  • James Kennington added 2 commits

    added 2 commits

    Compare with previous version

  • added 1 commit

    • 84c6e79c - mute doctests that output dicts (key order unstable)

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 2291a232 - clean detector constant values

    Compare with previous version

  • added 1 commit

    • 80901b57 - update attribute name for compatibility

    Compare with previous version

  • added 1 commit

    • 99423ad4 - fix channel-name vs state-channel-name behavior

    Compare with previous version

  • James Kennington added 9 commits

    added 9 commits

    • 93adbfb9 - add admin utilities for deprecation warnings
    • 13c46dd0 - add constants tests
    • f209e832 - add admin utils to package
    • 67a69197 - fully generalize old parsing utilities
    • c13d46aa - add string cleaning test tool
    • 5b4375a7 - add utility for adding copyright to modules
    • 322b84f5 - update datasource module for copyright
    • e32ef0f8 - shuffle and initial cleaning
    • f447e6ba - migrate usage of GWDataSourceInfo to DataSourceInfo

    Compare with previous version

  • James Kennington changed title from [Work in Progress] Update DataSourceInfo API to Update DataSourceInfo API

    changed title from [Work in Progress] Update DataSourceInfo API to Update DataSourceInfo API

  • James Kennington changed the description

    changed the description

  • added 1 commit

    • becb5f2c - remove subdirs arg from new gstlal.utilities makefile

    Compare with previous version

  • added 1 commit

    • 9d3d141c - add new subpackage to makefile

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 149d940f - update default for removed constant

    Compare with previous version

  • requested review from @patrick.godwin

  • James Kennington resolved all threads

    resolved all threads

  • added 1 commit

    • 085bcef0 - restore copyright file header

    Compare with previous version

  • Patrick Godwin
  • Patrick Godwin
  • Looks good, @james.kennington! Nice to see the extra test coverage and the extra functionality to allow building pipelines with the python API. Specific code review comments above. In addition, I see that some of the unit tests failed due to copyright-related functionality which would be good to address as well.

    Edited by Patrick Godwin
  • added 1 commit

    • 3e535b26 - comment out test of alternate copyright

    Compare with previous version

  • James Kennington added 2 commits

    added 2 commits

    Compare with previous version

  • James Kennington added 4 commits

    added 4 commits

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 8330ee9a - comment. out. the. doctests.

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • a7769a18 - keep frame cache file obj as part of state

    Compare with previous version

  • added 1 commit

    • 75fb7d8a - add test for persistence of cache path if not specified

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading