Ejemplo n.º 1
0
def run(tid, index, conn, trans_count, args=None):
    conn.troff()
    resp = conn.create("InCSE1", iotdm.application, str(tid))
    conn.tron()
    resid = iotdm.resid(resp)
    for i in range(0, trans_count):
        # create an AE
        resp = conn.retrieve(resid)
Ejemplo n.º 2
0
def run(tid, index, conn, trans_count, args=None):
    conn.troff()
    for i in range(0, trans_count):
        resp = conn.create("InCSE1", iotdm.application, "%d-%d" % (tid, i))
    conn.tron()
    resid = iotdm.resid(resp)
    for i in range(0, trans_count):
        # create an AE
        resp = conn.delete("%d-%d" % (tid, i))
Ejemplo n.º 3
0
def test(c,n,tid):
	ce = 0
	ct = 0
	re = 0
	rt = 0
	ue = 0
	ut = 0
	de = 0
	dt = 0
	resid = None
	print "start test [%d]" % (tid)
	for i in range(0, n):
		# create an AE
		q = c.create("InCSE1", iotdm.application)
		if fail(q):
			ce += 1
			#print "error [%d] during create (%d of %d)" % (tid, i, n)
			#time.sleep(1)
			continue
		else:
			resid = iotdm.resid(q)
			ct += 1

		if resid is None:
			continue

		# retrieve the contentInstance we just created
		q = c.retrieve(resid)
		if fail(q):
			re += 1
			#print "error [%d] during retrieve (%d of %d)" % (tid, i, n)
			#time.sleep(1)
		else:
			rt += 1

		# update the container with a new label "b"
		q = c.update(resid, attr={"lbl":["b"]})
		if fail(q):
			ue += 1
			#print "error [%d] during update (%d of %d)" % (tid, i, n)
			#time.sleep(1)
		else:
			ut += 1

		# delete the contentInstance
		if fail(q):
			de += 1
			#print "error [%d] during delete (%d of %d)" % (tid, i, n)
			#time.sleep(1)
		else:
			dt += 1

	print "[%d] attempted CRUD's : %d" % (tid, n)
	print "[%d]   total creates : %6d errors : %6d" % (tid, ct, ce)
	print "[%d] total retrieves : %6d errors : %6d" % (tid, rt, re)
	print "[%d]   total updates : %6d errors : %6d" % (tid, ut, ue)
	print "[%d]   total deletes : %6d errors : %6d" % (tid, dt, de)
Ejemplo n.º 4
0
def test(queue, host, a, n):
	cerr = 0
	cttl = 0
	rerr = 0
	rttl = 0
	uerr = 0
	uttl = 0
	derr = 0
	dttl = 0

	resid = None
	tid = os.getpid()

	c = iotdm.connect(host, auth=a)

	if c is None:
		print "- can't connect :", c.error
		return

	queue.put([tid, "start", time.time()])

	for i in range(0, n):
		# create an AE
		q = c.create("InCSE1", iotdm.application)
		if fail(q):
			cerr += 1
			continue
		else:
			resid = iotdm.resid(q)
			cttl += 1

		if resid is None:
			continue

		# retrieve the contentInstance we just created
		q = c.retrieve(resid)
		if fail(q):
			rerr += 1
		else:
			rttl += 1

		# update the container with a new label "b"
		q = c.update(resid, attr={"lbl":["b"]})
		if fail(q):
			uerr += 1
		else:
			uttl += 1

		# delete the contentInstance
		q = c.delete(resid)
		if fail(q):
			derr += 1
		else:
			dttl += 1

	queue.put([tid, "end", time.time(), n, cttl, cerr, rttl, rerr, uttl, uerr, dttl, derr])
Ejemplo n.º 5
0
def run(tid, index, conn, trans_count, args=None):
	for i in range(0, trans_count):
		# create an AE
		resp = conn.create("InCSE1", iotdm.application)
		if iotdm.fail(resp): continue
		resid = iotdm.resid(resp)
		if resid is None: continue

		# retrieve the resource we just created
		resp = conn.retrieve(resid)

		# update the resource with a new label "b"
		resp = conn.update(resid, attr={"lbl":["b"]})

		# delete the resource
		resp = conn.delete(resid)
Ejemplo n.º 6
0
print "* connect to iotdm and clear tree"
c = iotdm.connect(host, auth=(user, pw))
c.kill()
print "* delete complete... delaying 2 seconds for iotdm to settle"
time.sleep(2)

t1 = time.time()

print "* depth.py start @ %8.8f" % (t1)

print "* make top AE *"
x = c.create("InCSE1", iotdm.application)
if fail(x):
	print "* can't create top AE"
	exit()
ae = iotdm.resid(x)
print "* top AE ID", ae

print "* make top container *"
x = c.create(ae, iotdm.container)
if fail(x):
	print "* can't create top container"
	exit()
co = iotdm.resid(x)
print "* top container ID", co

ttl = 2 # keep a resource creation total... padded for the top containers

cot = 0 # container create total
cit = 0 # contentInstance create total
Ejemplo n.º 7
0
def resid(x):
    return iotdm.resid(x)
Ejemplo n.º 8
0
def test(queue, base_time, host, a, trans_count):
    tid = os.getpid()
    queue.put([tid, "start"])

    ce = True
    re = True
    ue = True
    de = True

    if os.environ.get("CRUD"):
        tmp = str.upper(os.environ.get("CRUD"))
        if "C" not in tmp:
            ce = None
        if "R" not in tmp:
            re = None
        if "U" not in tmp:
            ue = None
        if "D" not in tmp:
            de = None

    name = ""
    if ce:
        name += "C"
    if re:
        name += "R"
    if ue:
        name += "U"
    if de:
        name += "D"

    crtt = []
    rrtt = []
    urtt = []
    drtt = []

    cts = []
    rts = []
    uts = []
    dts = []

    resid = None

    conn = iotdm.connect(host, auth=a)

    if conn is None:
        print "- can't connect :", conn.error
        return

        # make a resource in case create is disabled
    resid = "InCSE1/tid%d" % (tid)
    if not ce:
        conn.create("InCSE1", iotdm.application, str(tid))

    t0 = time.time()

    for i in range(0, trans_count):
        if ce:
            # create an AE
            nt = btime()
            resp = conn.create("InCSE1", iotdm.application)
            if fail(resp):
                continue
            resid = iotdm.resid(resp)
            if elap(resp):
                crtt.append(elap(resp))
                cts.append(nt - base_time)
            if resid is None:
                continue

        if re:
            # retrieve the resource we just created
            nt = btime()
            resp = conn.retrieve(resid)
            if elap(resp):
                rrtt.append(elap(resp))
                rts.append(nt - base_time)

        if ue:
            # update the resource with a new label "b"
            nt = btime()
            resp = conn.update(resid, attr={"lbl": ["b"]})
            if elap(resp):
                urtt.append(elap(resp))
                uts.append(nt - base_time)

        if de:
            # delete the resource
            nt = btime()
            resp = conn.delete(resid)
            if elap(resp):
                drtt.append(elap(resp))
                dts.append(nt - base_time)

    t1 = time.time()

    file = "b1-save.%d" % (tid)
    pickle.dump([tid, "end", t0, t1, crtt, cts, rrtt, rts, urtt, uts, drtt, dts], open(file, "wb"))
    queue.put([tid, "end", file])
Ejemplo n.º 9
0
def btime():
    return time.time()


bt = btime()

for i in range(0, n):
    # create an AE
    nt = btime()
    q = c.create("InCSE1", iotdm.application)
    if fail(q):
        continue
    if elap(q):
        crtt.append(elap(q))
        cts.append(nt - bt)
    resid = iotdm.resid(q)

    # retrieve the AE we just created
    nt = btime()
    q = c.retrieve(resid)
    if elap(q):
        rrtt.append(elap(q))
        rts.append(nt - bt)

        # update the container with a new label "b"
    nt = btime()
    q = c.update(resid, attr={"lbl": ["b"]})
    if elap(q):
        urtt.append(elap(q))
        uts.append(nt - bt)