Project

General

Profile

Striped Web Sever API

Main URL head: http://dbweb5.fnal.gov:9090/striped/app

REST API Endpoints

Available row group ids

URL: <head>/rgids

Parameters:

  • ds=<dataset name>

Returns JSON list of available row group ids.

Example: http://dbweb5.fnal.gov:9090/striped/app/rgids?ds=QCD_HT1000to1500_13TeV_2

Row group info

URL: <head>/rginfo

Parameters:

  • ds=<dataset name>
  • rgid=<row group id>

Returns JSON representation of structure like this:

{
  "RGID": 35, 
  "BeginFile": 0, 
  "EndFile": 0, 
  "BeginEvent": 35000,
  "EndEvent": 35999, 
  "MinEventID": 35000, 
  "MaxEventID": 35999 
}

Example: http://dbweb5.fnal.gov:9090/striped/app/rginfo?ds=QCD_HT1000to1500_13TeV_2&rgid=4788

Get stripe data

URL: <head>/stripe

Parameters:

  • ds=<dataset name>
  • rgid=<row group id>
  • column=<column name>

Returns binary BLOB suitable to be consumed by the numpy.frombuffer():

import getopt, sys, urllib2
import numpy as np

Usage = """ 
cb.py [-d <dtype>] [-u <URL head>] <dataset name> <column> <rgid>
    default dtype is float-64bit, examples: f4, f8, i4
    default URL head is http://dbweb5.fnal.gov:9090/striped/app
""" 

URLHead = "http://dbweb5.fnal.gov:9090/striped/app" 
dtype = np.dtype("f8")

opts, args = getopt.getopt(sys.argv[1:], "d:u:")

for opt, val in opts:
    if opt == '-d':
        dtype = np.dtype(val)
    elif opt == '-u':
        URLHead = val

dataset, column, rgid = args

data = urllib2.urlopen(URLHead + "/stripe?ds=%s&column=%s&rgid=%s" % (dataset, column, rgid)).read()

arr = np.frombuffer(data, dtype=dtype)
print arr

Example: http://dbweb5.fnal.gov:9090/striped/app/stripe?ds=QCD_HT1000to1500_13TeV_2&rgid=4788&column=Photon.pt