Safe Haskell | None |
---|---|
Language | Haskell2010 |
Google Fusion Table upload of benchmark data.
This module must be used in conjunction with the main "hsbencher" package, e.g. "import HSBencher".
- defaultFusionPlugin :: FusionPlug
- getTableId :: OAuth2Client -> String -> BenchM (TableId, [String])
- findTableId :: OAuth2Client -> String -> BenchM (Maybe TableId)
- makeTable :: OAuth2Client -> String -> BenchM TableId
- ensureColumns :: OAuth2Client -> TableId -> [(String, CellType)] -> BenchM [String]
- data FusionConfig = FusionConfig {}
- stdRetry :: String -> OAuth2Client -> OAuth2Tokens -> IO a -> BenchM (Maybe a)
- fusionSchema :: [(String, CellType)]
- resultToTuple :: BenchmarkResult -> [(String, String)]
- type PreppedTuple = [(String, String)]
- type Schema = [String]
- authenticate :: BenchM (OAuth2Tokens, OAuth2Client, TableId)
- prepBenchResult :: Schema -> BenchmarkResult -> PreppedTuple
- uploadRows :: [PreppedTuple] -> BenchM Bool
- uploadBenchResult :: BenchmarkResult -> BenchM ()
- data FusionPlug
- data FusionCmdLnFlag
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.
FusionConfig | |
|
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.
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.
Eq FusionPlug | |
Ord FusionPlug | |
Read FusionPlug | |
Show FusionPlug | |
Default FusionPlug | This is the same as defaultFusionPlugin |
Plugin FusionPlug | |
type PlugConf FusionPlug = FusionConfig | |
type PlugFlag FusionPlug = FusionCmdLnFlag |
data FusionCmdLnFlag Source
Parsed command line options provided by the user initiating benchmarking.