def feedQueue(step, scriptPath, optionParser=None):
    """
    Process a queue file
    """
    # Import custom modules
    from fp.lib import parameter_store, folder_store
    # If there is no option parser, build one
    if not optionParser:
        optionParser = buildOptionParser()
    # Add usage
    optionParser.usage = '%prog [options] queuePath'
    # Add options
    optionParser.add_option('-0', '--database', dest='via_database', action='store_true',
        help='use the database', default=False)
    optionParser.add_option('-d', '--directory', dest='directory', metavar='DIRECTORY',
        help='save results in DIRECTORY', default='.')
    optionParser.add_option('-t', '--test', dest='is_test', action='store_true',
        help='test the queuePath without running it', default=False)
    # Parse
    options, arguments = optionParser.parse_args()
    # If the user did not supply the right number of arguments,
    if len(arguments) != 1:
        # Show help and exit
        return optionParser.print_help()
    # Connect
    if options.via_database:
        connect(options)
    # Extract
    queuePath = arguments[0]
    try: 
        # Load information
        parameterByTaskByName = store.loadQueue(queuePath, parameter_store.convertByName)
        # Initialize
        testFolderPath = os.path.join(options.directory, 'test')
        if options.is_test: 
            options.directory = store.makeFolderSafely(testFolderPath)
        folderStore = folder_store.Store(options.directory)
        # Step through each task
        for taskName, parameterByName in parameterByTaskByName.iteritems():
            step(taskName, parameterByName, folderStore, options)
    except (store.QueueError, folder_store.FolderError, ScriptError), scriptError:
        return '%s %s\n%s' % (store.extractFileBaseName(scriptPath), queuePath, scriptError)
            plotPathByIndexByName[resultIndex]['%s_patchPerformanceByRegion' % sourceIndex] = targetName
        # Plot iteration history
        errorPacks = eval(result['classifiers']['performance']['iteration history'])
        targetName = '%s_classifierIterationHistory.png' % resultIndex
        classifier_cnn.plotIterationHistory(expandPath(targetName), errorPacks)
        plotPathByIndexByName[resultIndex]['classifierIterationHistory'] = targetName
    # Return
    return plotPathByIndexByName


# If we are running the script from the command-line,
if __name__ == '__main__':
    # Load
    hasLocations = False
    scriptPath = os.path.dirname(os.path.abspath(__file__))
    resultFolderPath = store.makeFolderSafely('9-results')
    def expandPath(path):
        return os.path.join(resultFolderPath, path)
    print 'Loading queues...'
    queueReader = QueueReader()
    print 'Loading results...'
    results = loadResults()
    print 'Loading paths...'
    paths = loadPaths()
    print 'Plotting results...'
    plotPathByIndexByName = plotResults(results, expandPath)
    lookup = mako.lookup.TemplateLookup(directories=[os.path.join(scriptPath, 'templates')])
    def renderTemplate(templateName):
        template = lookup.get_template(templateName + '.mako')
        if templateName.startswith('multiple'):
            open(expandPath('%s.html' % templateName), 'wt').write(template.render(