#!/usr/bin/env python
#ckwg +5
# Copyright 2011 by Kitware, Inc. All Rights Reserved. Please refer to
# KITWARE_LICENSE.TXT for licensing information, or contact General Counsel,
# Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065.


def log(msg):
    import sys
    sys.stderr.write("%s\n" % msg)


def ensure_exception(action, func, *args):
    got_exception = False

    try:
        func(*args)
    except:
        got_exception = True

    if not got_exception:
        log("Error: Did not get exception when %s" % action)


def main(testname):
    #else:
    log("Error: No such test '%s'" % testname)


if __name__ == '__main__':
    import os
    import sys

    if not len(sys.argv) == 4:
        log("Error: Expected three arguments")
        sys.exit(1)

    testname = sys.argv[1]

    os.chdir(sys.argv[2])

    sys.path.append(sys.argv[3])

    try:
        main(testname)
    except BaseException as e:
        log("Error: Unexpected exception: %s" % str(e))

@@ -527,24 +527,635 @@
 %25 action)%0A%0A%0A
+def create_process(type, conf):%0A    from vistk.pipeline import modules%0A    from vistk.pipeline import process_registry%0A%0A    modules.load_known_modules()%0A%0A    reg = process_registry.ProcessRegistry.self()%0A%0A    p = reg.create_process(type, conf)%0A%0A    return p%0A%0A%0Adef run_pipeline(conf, pipe):%0A    from vistk.pipeline import config%0A    from vistk.pipeline import modules%0A    from vistk.pipeline import schedule_registry%0A%0A    modules.load_known_modules()%0A%0A    reg = schedule_registry.ScheduleRegistry.self()%0A%0A    sched_type = 'sync'%0A%0A    s = reg.create_schedule(sched_type, conf, pipe)%0A%0A    s.start()%0A    s.wait()%0A%0A%0A
 def main(tes

Add utility methods for running pipelines