hsbencher-fusion-0.3.15.2: Backend for uploading benchmark data to Google Fusion Tables.

Safe HaskellNone
LanguageHaskell2010

HSBencher.Backend.Fusion

Contents

Description

Google Fusion Table upload of benchmark data.

This module must be used in conjunction with the main "hsbencher" package, e.g. "import HSBencher".

Synopsis

The plugin itself, what you probably want

defaultFusionPlugin :: FusionPlug Source

A default plugin. This binding provides future-proof way to get a default instance of the plugin, in the eventuality that more configuration options are added in the future.

Creating and finding tables

getTableId :: OAuth2Client -> String -> BenchM (TableId, [String]) Source

Get the table ID that has been cached on disk, or find the the table in the users Google Drive, or create a new table if needed.

This is a simple shorthand for combining findTableIdmakeTableensureColumns.

It adds columns if necessary and returns the permutation of columns found server side. It assumes the DEFAULT core table Schema and will not work for creating CUSTOM columns on the server side. Simple drop down to using the three finer grained routines if you want that.

findTableId :: OAuth2Client -> String -> BenchM (Maybe TableId) Source

Look for a table by name, returning its ID if it is present.

makeTable :: OAuth2Client -> String -> BenchM TableId Source

Make a new table, returning its ID. In the future this may provide failure recovery. But for now it simply produces an exception if anything goes wrong. And in particular there is no way to deal with multiple clients racing to perform a makeTable with the same name.

ensureColumns :: OAuth2Client -> TableId -> [(String, CellType)] -> BenchM [String] Source

Make sure that a minimal set of columns are present. This routine creates columns that are missing and returns the permutation of columns found on the server.

Details and configuration options.

data FusionConfig Source

Configuration options for Google Fusion Table uploading.

Constructors

FusionConfig 

Fields

fusionTableID :: Maybe TableId

This must be Just whenever doFusionUpload is true.

fusionClientID :: Maybe String
 
fusionClientSecret :: Maybe String
 
serverColumns :: [String]

Record the ordering of columns server side.

stdRetry :: String -> OAuth2Client -> OAuth2Tokens -> IO a -> BenchM (Maybe a) Source

The standard retry behavior when receiving HTTP network errors. Note that this can retry for quite a long while so it is only to be usedfrom batch applications.

fusionSchema :: [(String, CellType)] Source

A representaton used for creating tables. Must be isomorphic to BenchmarkResult. This could perhaps be generated automatically (e.g. from a Generic instance, or even by creating a default benchmarkResult and feeding it to resultToTuple).

Note, order is important here, because this is the preferred order we'd like to have it in the Fusion table.

resultToTuple :: BenchmarkResult -> [(String, String)]

Convert the Haskell representation of a benchmark result into a tuple for upload to a typical database backend.

Prepping and uploading tuples (rows)

type PreppedTuple = [(String, String)] Source

Tuples in the format expected on the server.

type Schema = [String] Source

The ordered set of column names that form a schema.

authenticate :: BenchM (OAuth2Tokens, OAuth2Client, TableId) Source

Check cached tokens, authenticate with server if necessary, and return a bundle of the commonly needed information to speak to the Fusion Table API.

prepBenchResult :: Schema -> BenchmarkResult -> PreppedTuple Source

Prepare a Benchmark result for upload, matching the given Schema in order and contents, which may mean adding empty fields. This function requires that the Schema already contain all columns in the benchmark result.

uploadRows :: [PreppedTuple] -> BenchM Bool Source

Upload raw tuples that are already in the format expected on the server. Returns True if the upload succeeded.

uploadBenchResult :: BenchmarkResult -> BenchM () Source

Deprecated: this is subsumed by the Plugin interface and uploadRows

Push the results from a single benchmark to the server.

data FusionPlug Source

The type of Fusion table plugins. Currently this is a singleton type; there is really only one fusion plugin.

data FusionCmdLnFlag Source

Parsed command line options provided by the user initiating benchmarking.