Example #1
0
def main() -> int:
    parser = argparse.ArgumentParser()
    parser.add_argument('test_name', type=str)
    parser.add_argument('--clean-up-first', action='store_true', default=False)
    parser.add_argument('--bless', action='store_true', default=False)
    if 'PLZ_HOST' in os.environ:
        plz_host = os.environ['PLZ_HOST']
        if 'PLZ_PORT' not in os.environ:
            raise ValueError('PLZ_HOST is defined but PLZ_PORT is not!')
        plz_port = int(os.environ['PLZ_PORT'])
        network = get_network()
    else:
        plz_host = 'localhost'
        plz_port = 5123
        network = 'host'
        test_utils.print_warning(
            f'Using default controller host and port: {plz_host}:{plz_port} '
            '(outside docker)')

    options = parser.parse_args(sys.argv[1:])

    if options.clean_up_first:
        test_utils.cleanup(interrupted=False)

    signal.signal(signal.SIGTERM, test_utils.sig_cleanup)
    with test_utils.DoCleanupContextManager() as cleanup_context:
        try:
            success = run_end_to_end_test(network, plz_host, plz_port,
                                          options.test_name, options.bless)
            return 0 if success else 1
        except InterruptedError:
            cleanup_context.interrupted = True
            raise
def test_multiple_mxnet_integ(tmpdir):
    tmpdir = str(tmpdir)
    utils._download_file(
        tmpdir, "https://s3.amazonaws.com/model-server/inputs/kitten.jpg")
    model_urls = utils.filtered_urls(mxnet_models, utils.mxnet_model_urls)
    utils.start_test(tmpdir, model_urls, port='8080', model_type='mxnet')
    utils.cleanup(tmpdir)
def test_onnx_integ(tmpdir, model_data):
    tmpdir = str(tmpdir)
    model_urls = utils.filtered_urls([model_data], utils.onnx_model_urls)
    utils._download_file(
        tmpdir, "https://s3.amazonaws.com/model-server/inputs/kitten.jpg")
    utils.start_test(tmpdir, model_urls, port='8080', model_type='onnx')
    utils.cleanup(tmpdir)