Output Types

StashCache Tester can produce different outputs by subclassing the GeneralOutput class.

class stashcache_tester.output.generalOutput.GeneralOutput(sitesData)

The GeneralOuptut class should be subclassed by the output plugin.

Parameters:sitesData (dict) – The data from sites in the form of a dictionary. The keys should be the sites, and the values should be an array of times for the transfers.

An example structure for sitesData is:

sitesData = {
    "UCSDT2": [
        {'starttime': "140192910", 'endtime': "140204950", 'successful': True}, 
        {'starttime': "140105910", ...}
    ], 
    "Nebraska": [
        {'starttime': ...}]}
        ...

The initialize function should also be used to initialize any structures required for processing.

startProcessing()

This is called when the the output plugin should begin processing the sitesData data.

Example Outputs Processors

An example of an output processor is the MatplotlibOutput processor.

class stashcache_tester.output.matplotlibOutput.MatplotlibOutput(sitesData)
startProcessing()

This function will create plots using python’s matplotlib. Currently, it will make:

  1. A violin plot of the distribution of download times for each site given in sitesData.

A violin plot example:

_images/matploblib-violinplot.png

And another example, the GithubOutput processor.

class stashcache_tester.output.githubOutput.GithubOutput(sitesData)
Parameters:sitesData (dict) – Dictionary described in sitesData.

This class summarizes and uploads the download data to a github account. The data will be stored in a file named data.json in the git repo under the directory in the configuration. The format of data.json is:

{
    "20150911": [
        {
            "average": 364.76526180827,
            "name": "Tusker"
        },
        {
            "average": 75.99734924610296,
            "name": "UCSDT2"
        },
        ...
    ], 
    "20150913": [
        {
            "average": 239.02169168535966,
            "name": "Tusker"
        },
        ...
    ],
    ...
}

Github output requires an SSH key to be added to the github repository which is pointed to by the repo configuration option.

Github output requires additional configuration options in the main configuration in the section [github]. An example configuration could be:

[github]
repo = StashCache/stashcache.github.io.git
branch = master
directory = data
ssh_key = /home/user/.ssh/id_rsa

The configuration is:

repo
The git repo to commit the data to.
branch
The branch to install repo.
directory
The directory to put the data summarized files into.
maxdays
The maximum number of days to keep data. Default=30
ssh_key
Path to SSH key to use when checking out and pushing to the repository.
startProcessing()

Begin summarizing the data.