コード例 #1
0
ファイル: server.py プロジェクト: nuodb/zima
def get_build(buildid):
    if not os.path.exists(os.path.join(BUILD_DIR,buildid)):
        # The build file isn't there, so try and cache again.
        try: #fail fast
            build_url = get_link(buildid)
        except NoSuchBuildException:
            return ("ERROR: no such build", 404)
        if build_url != None:
            cache_build(build_url, buildid)
        else:
            return ("Build artifact download URL is empty.")

    return send_from_directory(BUILD_DIR, buildid)
コード例 #2
0
ファイル: server.py プロジェクト: nuodb/zima
def enqueue_single_test(filename):
    branch = request.args.get('branch', 'master', type=str)
    parent_build_id = request.args.get('buildid', type=str)#bamboo id for NPB, etc
    queue = request.args.get('queue', 'default', type=str)
    try: #fail fast
        build_url = get_link(parent_build_id)
    except NoSuchBuildException:
        return ("ERROR: no such build", 404)
    try:
        with open(os.path.join(TEST_DIR,filename), 'r') as fd:
            test_def = fd.read()
    except:
        return ("ERROR: test description file not found", 404)
    app.logger.info(get_now()+ " calling submit_single with job: {}".format(filename))
    result = submit_single(filename, test_def, parent_build_id, get_result_dir(parent_build_id, branch), queue)
    return json.dumps(result)
コード例 #3
0
ファイル: server.py プロジェクト: nuodb/zima
def enqueue():
    suite = request.args.get('suite', '', type=str)#optional
    branch = request.args.get('branch', 'master', type=str)
    queue = request.args.get('queue', 'default', type=str)
    parent_build_id = request.args.get('buildid', type=str)#bamboo id for NPB, etc
    try: #fail fast
        build_url = get_link(parent_build_id)
    except NoSuchBuildException:
        return ("ERROR: no such build", 404)

    if build_url != None:
        # If we can find the build artifact download, try to cache a
        # copy of it.  If not we will try again when we call
        # get_build.
        thr = Thread(target=cache_build, args=[build_url, parent_build_id])
        thr.start()
    result = submit(suite, parent_build_id, get_result_dir(parent_build_id, branch), queue)
    return json.dumps(result)