2014-12-04 19:06:16,938 INFO  [root][MainThread] 
http://localhost:6543/resources/pages/00000001-0000-0000-0002-000000000001/annotations

2014-12-04 19:06:16,938 INFO  [root][MainThread] 
http://localhost:6543/resources/pages/00000001-0000-0000-0002-000000000001/annotations

2014-12-04 19:06:17,594 INFO  [root][MainThread] [0] Thread exited, failure 
= 0

2014-12-04 19:06:17,595 INFO  [root][MainThread] 
http://localhost:6543/resources/pages/00000001-0000-0000-0002-000000000001/annotations

2014-12-04 19:06:18,147 INFO  [root][MainThread] [1] Thread exited, failure 
= 0

2014-12-04 19:06:18,148 INFO  [root][MainThread] 
http://localhost:6543/resources/pages/00000001-0000-0000-0002-000000000001/annotations

2014-12-04 19:06:18,271 INFO  [root][MainThread] [0] Thread exited, failure 
= 1

2014-12-04 19:06:18,272 INFO  [root][MainThread] 
http://localhost:6543/resources/pages/00000001-0000-0000-0002-000000000001/annotations

2014-12-04 19:06:18,407 INFO  [root][MainThread] [1] Thread exited, failure 
= 1

2014-12-04 19:06:18,408 INFO  [root][MainThread] 
http://localhost:6543/resources/pages/00000001-0000-0000-0002-000000000001/annotations

2014-12-04 19:06:18,502 INFO  [root][MainThread] [0] Thread exited, failure 
= 2

2014-12-04 19:06:18,503 INFO  [root][MainThread] 
http://localhost:6543/resources/pages/00000001-0000-0000-0002-000000000001/annotations

2014-12-04 19:06:18,597 INFO  [root][MainThread] [1] Thread exited, failure 
= 2

2014-12-04 19:06:18,597 INFO  [root][MainThread] 
http://localhost:6543/resources/pages/00000001-0000-0000-0002-000000000001/annotations

2014-12-04 19:06:18,691 INFO  [root][MainThread] [0] Thread exited, failure 
= 3

2014-12-04 19:06:18,733 INFO  [root][MainThread] [1] Thread exited, failure 
= 3


############### test case


def test_reproduce(self):

        from multiprocessing import Process

        

        pool = []

        loops = 4


        for i in range(2):

            proc = 
Process(target=ConcurrencyTransactions.insert_annotation, 
args=(self.page_uuid, loops, i))

            pool.append(proc)

        for proc in pool:

            proc.start()

        for proc in pool:

            proc.join()

        logging.info('Main thread exited.')

        pass


    @classmethod

    def insert_annotation(cls, page_uuid, loops, pid):

        import requests

        import simplejson

        from logging import info

        failure_count = 0

        request_json_template = simplejson.dumps({ 'payload' : [load_json(15
)]})

        for i in range(loops):

            request_json = replace_uuid(request_json_template, 
'0000000F-0000-0000-0002-000000000001')


            request_url = 
'http://localhost:6543/resources/pages/{}/annotations'.format(page_uuid)

            info(request_url)

            response = requests.post(request_url,

                          headers={'Content-Type':'application/json'},

                          data=request_json)

            if response.status_code != 200:

                failure_count += 1        

            info('[%d] Thread exited, failure = %d' % (pid, failure_count))

        return    


annotations is pnotes and pages is pdocuments

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to