Example #1
0
def main(argv):

    backend = 'be/backend'
    first_doc = "1.1.0.1.0.1"
    docs = [] # connected docs
    outf = sys.stdout

    ### Parse argv
    import getopt
    opts, args = getopt.getopt(argv[1:], "a:o:b:dv:")

    for o in opts:
        if '-a' in o:
            first_doc = o[1]
        elif '-o' in o:
            outf = open(o[1], 'w')
        elif '-b' in o:
            backend = o[1]
        elif '-d' in o:
            udxexp.chatty += 1
        elif '-v' in o:
            udxexp.chatty = int(o[1])

    docs = [x88.Address(first_doc)]

    # allow docs added manually
    for a in args:
        docs.append(x88.Address(a))

    be_dir = os.path.dirname(backend)
    backend = os.path.basename(backend)
    cwd = os.getcwd()
    # must run from backend dir or else some request fail
    os.chdir(be_dir)

    ## Get 88.1 session
    if udxexp.chatty > 2:
        xs = x88.pipeconnect_debug(backend, sys.stderr)
    else:
        xs = x88.pipeconnect(backend)

    ### Find connections
    mutter(1, 'starting with', docs)
    links = find_connections(xs, docs)

    ## write dot file
    write_dot(outf, links)

    xs.quit()
Example #2
0
def main(argv):
    opts, args = getopt.getopt(argv[1:], "dt:a:")

    # defaults opt values
    tcp_addr = ()
    debug = 0
    doc_addr = "1.1.0.1.0.1"

    for opt in opts:
        if opt[0] == '-d':
            debug = True
        elif opt[0] == '-t':
            host, port = opt[1].split(':')
            tcp_addr = host, int(port)
        elif opt[0] == '-h':
            # todo: usage
            pass
        elif opt[0] == '-a':
            doc_addr = opt[1]

    os.chdir('bin/be')

    # get Xu session
    if debug and tcp_addr:
        ps = x88.DebugWrapper(x88.TcpStream(*tcp_addr), sys.stderr)
        xc = x88.DebugWrapper(x88.XuConn(ps), sys.stderr)
        xs = x88.DebugWrapper(x88.XuSession(xc), sys.stderr)

    elif debug:
        ps = x88.DebugWrapper(x88.PipeStream("./backend"), sys.stderr)
        xc = x88.DebugWrapper(x88.XuConn(ps), sys.stderr)
        xs = x88.DebugWrapper(x88.XuSession(xc), sys.stderr)

    elif tcp_addr:
        xs = x88.tcpconnect(*tcp_addr)

    else:
        xs = x88.pipeconnect("./backend")

    #addr = testcreatelink(xs)
    #tryout(xs, doc_addr)
    test2(xs, doc_addr)
Example #3
0
def main(argv):
    # parse argv
    import getopt
    opts, args = getopt.getopt(argv[1:], "vd:b:")

    backend = '../pyxi/be/backend'
    doc_list = None
    for o in opts:
        if '-b' in o:
            backend = o[1]
        elif '-d' in o:
            udxutil.chatty = int(o[1])
        elif '-v' in o:
            udxutil.chatty += 1

    # docids to examine
    docs = map(x88.Address, args)

    # backend location sanity...
    assert os.path.exists(backend)
    be_dir = os.path.dirname(backend)
    be = os.path.basename(backend)
    assert os.path.exists(os.path.join(be_dir, 'enf.enf'))

    cwd = os.getcwd()
    os.chdir(be_dir)

    # get x88 session
    if udxutil.chatty > 3:
        ps = x88.DebugWrapper(x88.PipeStream(be), sys.stderr)
        xc = x88.DebugWrapper(x88.XuConn(ps), sys.stderr)
        xs = x88.DebugWrapper(x88.XuSession(xc), sys.stderr)
    else:
        xs = x88.pipeconnect(be)

    # trace contents
    for docid in docs:
        print_trace2(xs, docid)

    xs.quit()
    os.chdir(cwd)
Example #4
0
def main(argv):
    # parse argv
    import getopt
    opts, args = getopt.getopt(argv[1:], "vd:b:")

    backend = '../pyxi/be/backend'
    doc_list = None
    for o in opts:
        if '-b' in o:
            backend = o[1]
        elif '-d' in o:
            udxutil.chatty = int(o[1])
        elif '-v' in o:
            udxutil.chatty += 1

    # docids to examine
    docs = map(x88.Address, args)

    # backend location sanity...
    assert os.path.exists(backend)
    be_dir = os.path.dirname(backend)
    be = os.path.basename(backend)
    assert os.path.exists(os.path.join(be_dir, 'enf.enf'))

    cwd = os.getcwd()
    os.chdir(be_dir)

    # get x88 session
    if udxutil.chatty>3:
        ps = x88.DebugWrapper(x88.PipeStream(be), sys.stderr)
        xc = x88.DebugWrapper(x88.XuConn(ps), sys.stderr)
        xs = x88.DebugWrapper(x88.XuSession(xc), sys.stderr)
    else:
        xs = x88.pipeconnect(be)

    # trace contents
    for docid in docs:
        print_trace2(xs, docid)

    xs.quit()
    os.chdir(cwd)