Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-10261: Create dispatch_verify.py CLI for uploading a verification job #10

Merged
merged 8 commits into from Apr 28, 2017

Conversation

jonathansick
Copy link
Member

dispatch_verify.py acts as an upload client to send verification job JSON fields to SQUASH.

Some features:

  • Can take multiple Job JSON files; each is merged
  • Metric definitions can be added to a Job, ensuring that units are consistent and normalized to the metric definition before sending to SQUASH.
  • Instead of, or in addition to, upload to SQUASH, dispatch_verify.py can also save the merged JSON document for later processing or archival. It can also print it out to standard output.
  • Using an --env=jenkins flag, Jenkins environment information is added to the Job metadata.
  • Using an --lsstsw flag, lsstsw package information is added to the Job metadata.
  • Both CLI flag and environment variable-based configuration is supported. The CLI flags override environment variables.

This code is adapted from https://github.com/lsst-sqre/post-qa

The idea is to provide a client library to support HTTP GET, POST, etc.
requests against the SQUASH API. This handles getting endpoints,
handling API version headers, logging, etc.

Data objects can use this API to implement data upload and download
methods. The idea is that the squash.py method itself will remain data
agnostic.

Adds `requests` as an EUPS dependency.

responses (https://github.com/getsentry/responses) is an optional
dependency to support unittests. Tests will skip is responses cannot be
imported. Eventually we shall try to ensure responses is systematically
available in the CI environment.
Job.dispatch() uploads the job to the SQUASH database via its HTTP API.
This API doesn't exist yet, so this method should be considered a
proof-of-concept.

Metrics and specifications should be uploaded separately since they're
not changing per-job, and can be considered separate resources.
The new lsst.verify.metadata sub-package will host tools for gathering
metadata from environments.

metadata/eupsmanifest.py is the first one, which parses the manifest.txt
file found in lsstsw builds.

A sample manifest.txt is included in tests/data/lsstsw/build (emulates
the directory structure of lsstsw).
Port from https://github.com/lsst-sqre/post-qa.

LsstswRepos provides an interface to repos.yaml and git repository
metadata in lsstsw. This includes the Git origin url of packages and the
currently-checked out Git branch.

Note I tried to mock the GitPython package to properly test the
LsstswRepo.get_package_branch() method, but couldn't get it to work yet.
get_jenkins_env() gather job metadata from the Jenkins CI execution
environment.
MetricSet, SpecificationSet and MeasurementSet gain __iadd__() and
update() methods. This provides a simple API for merging sets.

Also add Job.__iadd__ to merge Jobs

This provides a convenient API for merging Jobs, which comes up when
collecting several Jobs output from individual tasks for upload to
SQUASH.
These are a convenience APIs for inserting Metric instances from a
MetricSet into the Measurement.metric attribute of a measurement.

Job.reload_metrics_package adds metrics to Measurement instances, as
well as augmenting Job.metrics and Job.specs.

Adding metrics to measurement instances is useful because it helps us
normalize the units of measurements when serialized.

Add Job.reload_metrics_package
dispatch_verify.py is responsible for gathering Job JSON files, enriching
them with environment metadata, and either printing, writing, or HTTP
POSTing those Job documents to SQUASH.
@jonathansick jonathansick merged commit 795ae0f into master Apr 28, 2017
@ktlim ktlim deleted the tickets/DM-10261 branch August 25, 2018 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant