MongoBase starting guide


In [10]:
%load_ext autoreload
%autoreload 2
%matplotlib inline
import sys
import time
import threading
import multiprocessing
import datetime as dt
from mongobase.mongobase import MongoBase, db_context
from bson import ObjectId


The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload

ObjectId

First, let's talk about ObjectId.


In [11]:
x = ObjectId()
time.sleep(1)
y = ObjectId()
time.sleep(1)
z = ObjectId()

In [12]:
x


Out[12]:
ObjectId('5c821fd0b520d9a7d9820a5d')

In [13]:
str(x)


Out[13]:
'5c821fd0b520d9a7d9820a5d'

In [14]:
x.generation_time


Out[14]:
datetime.datetime(2019, 3, 8, 7, 54, 56, tzinfo=<bson.tz_util.FixedOffset object at 0x113e38550>)

In [15]:
y.generation_time


Out[15]:
datetime.datetime(2019, 3, 8, 7, 54, 57, tzinfo=<bson.tz_util.FixedOffset object at 0x113e38550>)

In [16]:
x < y and y < z


Out[16]:
True

Actually, ObjectId is usuful. It is unique, sortable and memory efficient.

http://api.mongodb.com/python/current/api/bson/objectid.html

An ObjectId is a 12-byte unique identifier consisting of:

a 4-byte value representing the seconds since the Unix epoch,
a 3-byte machine identifier,
a 2-byte process id, and
a 3-byte counter, starting with a random value.

And also ObjectId is fast for inserting or indexing. The index size is small.

https://github.com/Restuta/mongo.Guid-vs-ObjectId-performance

Define a database model

So now, we create a simple test collection with MongoBase.


In [17]:
class Bird(MongoBase):
    __collection__ = 'birds'
    __structure__ = {
        '_id': ObjectId,
        'name': str,
        'age': int,
        'is_able_to_fly': bool,
        'created': dt.datetime,
        'updated': dt.datetime
    }
    __required_fields__ = ['_id', 'name']
    __default_values__ = {
        '_id': ObjectId(),
        'is_able_to_fly': False,
        'created': dt.datetime.now(dt.timezone.utc),
        'updated': dt.datetime.now(dt.timezone.utc)
    }
    __validators__ = {}
    __indexed_keys__ = {}

The __structure__ part represents the definition of the model.

Basic instractions. (insert, update, find, remove)

Let's try basic instractions like inserts, updates, find and remove.

Firstly, let's begin with creating an instance to be stored.


In [18]:
chicken = Bird({'_id': ObjectId(), 'name': 'chicken', 'age': 3})

In [19]:
chicken


Out[19]:
{'_id': ObjectId('5c821fd2b520d9a7d9820a61'),
 'name': 'chicken',
 'age': 3,
 'is_able_to_fly': False,
 'created': datetime.datetime(2019, 3, 8, 7, 54, 58, 601376, tzinfo=datetime.timezone.utc),
 'updated': datetime.datetime(2019, 3, 8, 7, 54, 58, 601380, tzinfo=datetime.timezone.utc)}

In [20]:
chicken._id.generation_time


Out[20]:
datetime.datetime(2019, 3, 8, 7, 54, 58, tzinfo=<bson.tz_util.FixedOffset object at 0x113e38550>)

Good chicken. Let's save while it is fresh.


In [21]:
chicken.save()


Out[21]:
{'_id': ObjectId('5c821fd2b520d9a7d9820a61'),
 'name': 'chicken',
 'age': 3,
 'is_able_to_fly': False,
 'created': datetime.datetime(2019, 3, 8, 7, 54, 58, 601376, tzinfo=datetime.timezone.utc),
 'updated': datetime.datetime(2019, 3, 8, 7, 54, 58, 601380, tzinfo=datetime.timezone.utc)}

Chickens are considered to be unable to fly by default. We can let it be enable by updating.


In [22]:
chicken.is_able_to_fly


Out[22]:
False

In [23]:
chicken.is_able_to_fly = True
chicken.update()


Out[23]:
{'_id': ObjectId('5c821fd2b520d9a7d9820a61'),
 'name': 'chicken',
 'age': 3,
 'is_able_to_fly': True,
 'created': datetime.datetime(2019, 3, 8, 7, 54, 58, 601376, tzinfo=datetime.timezone.utc),
 'updated': datetime.datetime(2019, 3, 8, 7, 54, 58, 601380, tzinfo=datetime.timezone.utc)}

You would be able to see 'is_able_to_fly': True.

Chickens grow up in several ways.


In [24]:
chicken.age = 5
chicken = chicken.update()
assert chicken.age == 5, 'something wrong on update()'
chicken = Bird.findAndUpdateById(chicken._id, {'age': 6})
assert chicken.age == 6, 'something wrong on findAndUpdateById()'

Next let's try find methods.


In [25]:
mother_chicken = Bird({'_id': ObjectId(), 'name': 'mother chicken', 'age': 63})
mother_chicken.save()


Out[25]:
{'_id': ObjectId('5c821fd2b520d9a7d9820a62'),
 'name': 'mother chicken',
 'age': 63,
 'is_able_to_fly': False,
 'created': datetime.datetime(2019, 3, 8, 7, 54, 58, 601376, tzinfo=datetime.timezone.utc),
 'updated': datetime.datetime(2019, 3, 8, 7, 54, 58, 601380, tzinfo=datetime.timezone.utc)}

Now we can retrieve the same document from database.


In [26]:
Bird.findOne({'name': 'mother chicken'})


Out[26]:
{'_id': ObjectId('5c821fd2b520d9a7d9820a62'),
 'name': 'mother chicken',
 'age': 63,
 'is_able_to_fly': False,
 'created': datetime.datetime(2019, 3, 8, 7, 54, 58, 601000),
 'updated': datetime.datetime(2019, 3, 8, 7, 54, 58, 601000)}

It is the same chicken, isn't it? great. Let's clear (eat) it.


In [27]:
mother_chicken.remove()


Out[27]:
1

In [28]:
if not Bird.findOne({'_id': mother_chicken._id}):
    print('Yes. The mother chicken not found. Someone might ate it.')


Yes. The mother chicken not found. Someone might ate it.

Now we get all chickens which we stored so far.


In [29]:
all_chickens = Bird.find({'name': 'chicken'}, sort=[('_id', 1)])

In [30]:
len(all_chickens)


Out[30]:
1

Or we can count with count() method directly.


In [31]:
Bird.count({'name': 'chicken'})


Out[31]:
1

Let's check if the latest chicken is equal to the one which we just saved.


In [32]:
all_chickens[-1]._id.generation_time == chicken._id.generation_time


Out[32]:
True

Is that True, right?

Contextual database

MongoBase automatically creates mongodb client for each process.
But in some cases, some instances must be written or read for a different client or db.
If you use db context, it uses a designated database within the context.
Let's get try on it.


In [33]:
with db_context(db_uri='localhost', db_name='test') as db:
    print(db)
    flamingo = Bird({'_id': ObjectId(), 'name': 'flamingo', 'age': 20})
    flamingo.save(db=db)
    
    flamingo.age = 23
    flamingo = flamingo.update(db=db)
    assert flamingo.age == 23, 'something wrong on update()'
    flamingo = Bird.findAndUpdateById(flamingo._id, {'age': 24}, db=db)
    assert flamingo.age == 24, 'something wrong on findAndUpdateById()'
    
    n_flamingo = Bird.count({'name': 'flamingo'}, db=db)
    print(f'{n_flamingo} flamingo found in the test database.')

n_flamingo = Bird.count({'name': 'flamingo'})
print(f'{n_flamingo} flamingo found in the default database.')
assert n_flamingo == 0


Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True, connecttimeoutms=3000, serverselectiontimeoutms=3000, sockettimeoutms=300000, socketkeepalive=True, maxidletimems=40000, maxpoolsize=200, minpoolsize=10, waitqueuemultiple=12, waitqueuetimeoutms=100), 'test')
1 flamingo found in the test database.
0 flamingo found in the default database.

Bulk Operation

Many insert operations takes a large computing cost. Fortunately, MongoDB provides an operation named "bulk write".
It enables to insert many documents in one operation.

Bulk Insert


In [34]:
many_pigeon = []
for i in range(10000):
    many_pigeon += [Bird({'_id': ObjectId(), 'name': f'pigeon', 'age': i})]
print(many_pigeon[1])


{'_id': ObjectId('5c821fd3b520d9a7d9820a66'), 'name': 'pigeon', 'age': 1, 'is_able_to_fly': False, 'created': datetime.datetime(2019, 3, 8, 7, 54, 58, 601376, tzinfo=datetime.timezone.utc), 'updated': datetime.datetime(2019, 3, 8, 7, 54, 58, 601380, tzinfo=datetime.timezone.utc)}

In [35]:
%%time
Bird.bulk_insert(many_pigeon)


CPU times: user 99.1 ms, sys: 3.27 ms, total: 102 ms
Wall time: 127 ms
Out[35]:
10000

In [36]:
Bird.count({'name': 'pigeon'})


Out[36]:
10000

Bulk Update


In [37]:
updates = []
for pigeon in many_pigeon:
    pigeon.age *= 3
    updates += [pigeon]

In [38]:
%%time
print(len(updates))
Bird.bulk_update(updates)


10000
UpdateOne({'_id': ObjectId('5c821fd3b520d9a7d9820a65')}, {'$set': {'name': 'pigeon', 'age': 0, 'is_able_to_fly': False, 'created': datetime.datetime(2019, 3, 8, 7, 54, 58, 601376, tzinfo=datetime.timezone.utc), 'updated': datetime.datetime(2019, 3, 8, 7, 54, 59, 398739, tzinfo=datetime.timezone.utc)}}, False, None, None)
CPU times: user 247 ms, sys: 5.24 ms, total: 252 ms
Wall time: 475 ms

Check if all ages are updated


In [39]:
%%time
for i, pigeon in enumerate(many_pigeon):
    check = Bird.findOne({'_id': pigeon._id})
    assert check.age == i*3


CPU times: user 1.53 s, sys: 167 ms, total: 1.69 s
Wall time: 2.21 s

No error? Cool.


In [40]:
Bird.delete({'name': 'pigeon'})


Out[40]:
10000

Multi Threading and Processing


In [41]:
def breed(i):
    try:
        sparrow = Bird({'_id': ObjectId(), 'name': f'sparrow', 'age': 0})
        sparrow.save()
        sparrow.age += 1
        sparrow.update()
    except Exception as e:
        print(f'Exception occured. {e} in thread {threading.current_thread()}')
    else:
        print(f'{i} saved in thread {threading.current_thread()}.')

Threading (using the same memory space)

The threading module uses threads, the multiprocessing module uses processes. The difference is that threads run in the same memory space, while processes have separate memory. This makes it a bit harder to share objects between processes with multiprocessing. Since threads use the same memory, precautions have to be taken or two threads will write to the same memory at the same time. This is what the global interpreter lock is for.

https://stackoverflow.com/questions/3044580/multiprocessing-vs-threading-python


In [42]:
%%time
for i in range(1000):
    t = threading.Thread(target=breed, name=f'breed sparrow {i}', args=(i,))
    t.start()
    
Bird.delete({'name':'sparrow'})


7 saved in thread <Thread(breed sparrow 7, started 123145615044608)>.
6 saved in thread <Thread(breed sparrow 6, started 123145609789440)>.0 saved in thread <Thread(breed sparrow 0, started 123145573003264)>.1 saved in thread <Thread(breed sparrow 1, started 123145583513600)>.


4 saved in thread <Thread(breed sparrow 4, started 123145599279104)>.3 saved in thread <Thread(breed sparrow 3, started 123145594023936)>.5 saved in thread <Thread(breed sparrow 5, started 123145604534272)>.


8 saved in thread <Thread(breed sparrow 8, started 123145620299776)>.
2 saved in thread <Thread(breed sparrow 2, started 123145588768768)>.
9 saved in thread <Thread(breed sparrow 9, started 123145625554944)>.
14 saved in thread <Thread(breed sparrow 14, started 123145573003264)>.
12 saved in thread <Thread(breed sparrow 12, started 123145641320448)>.10 saved in thread <Thread(breed sparrow 10, started 123145630810112)>.

11 saved in thread <Thread(breed sparrow 11, started 123145636065280)>.15 saved in thread <Thread(breed sparrow 15, started 123145583513600)>.13 saved in thread <Thread(breed sparrow 13, started 123145615044608)>.


17 saved in thread <Thread(breed sparrow 17, started 123145588768768)>.
16 saved in thread <Thread(breed sparrow 16, started 123145594023936)>.
18 saved in thread <Thread(breed sparrow 18, started 123145599279104)>.
19 saved in thread <Thread(breed sparrow 19, started 123145604534272)>.
20 saved in thread <Thread(breed sparrow 20, started 123145609789440)>.
23 saved in thread <Thread(breed sparrow 23, started 123145615044608)>.21 saved in thread <Thread(breed sparrow 21, started 123145573003264)>.

24 saved in thread <Thread(breed sparrow 24, started 123145620299776)>.
22 saved in thread <Thread(breed sparrow 22, started 123145583513600)>.
26 saved in thread <Thread(breed sparrow 26, started 123145594023936)>.
25 saved in thread <Thread(breed sparrow 25, started 123145588768768)>.27 saved in thread <Thread(breed sparrow 27, started 123145599279104)>.

28 saved in thread <Thread(breed sparrow 28, started 123145604534272)>.29 saved in thread <Thread(breed sparrow 29, started 123145609789440)>.

31 saved in thread <Thread(breed sparrow 31, started 123145583513600)>.
30 saved in thread <Thread(breed sparrow 30, started 123145573003264)>.
33 saved in thread <Thread(breed sparrow 33, started 123145594023936)>.
32 saved in thread <Thread(breed sparrow 32, started 123145588768768)>.
35 saved in thread <Thread(breed sparrow 35, started 123145609789440)>.
37 saved in thread <Thread(breed sparrow 37, started 123145615044608)>.34 saved in thread <Thread(breed sparrow 34, started 123145599279104)>.36 saved in thread <Thread(breed sparrow 36, started 123145604534272)>.


39 saved in thread <Thread(breed sparrow 39, started 123145583513600)>.
40 saved in thread <Thread(breed sparrow 40, started 123145573003264)>.
38 saved in thread <Thread(breed sparrow 38, started 123145620299776)>.
43 saved in thread <Thread(breed sparrow 43, started 123145594023936)>.42 saved in thread <Thread(breed sparrow 42, started 123145588768768)>.44 saved in thread <Thread(breed sparrow 44, started 123145599279104)>.


41 saved in thread <Thread(breed sparrow 41, started 123145625554944)>.
45 saved in thread <Thread(breed sparrow 45, started 123145604534272)>.
46 saved in thread <Thread(breed sparrow 46, started 123145609789440)>.
47 saved in thread <Thread(breed sparrow 47, started 123145583513600)>.
49 saved in thread <Thread(breed sparrow 49, started 123145615044608)>.
48 saved in thread <Thread(breed sparrow 48, started 123145573003264)>.
50 saved in thread <Thread(breed sparrow 50, started 123145620299776)>.51 saved in thread <Thread(breed sparrow 51, started 123145594023936)>.

52 saved in thread <Thread(breed sparrow 52, started 123145588768768)>.53 saved in thread <Thread(breed sparrow 53, started 123145599279104)>.

55 saved in thread <Thread(breed sparrow 55, started 123145583513600)>.56 saved in thread <Thread(breed sparrow 56, started 123145609789440)>.

54 saved in thread <Thread(breed sparrow 54, started 123145604534272)>.
58 saved in thread <Thread(breed sparrow 58, started 123145573003264)>.
57 saved in thread <Thread(breed sparrow 57, started 123145615044608)>.
59 saved in thread <Thread(breed sparrow 59, started 123145625554944)>.
60 saved in thread <Thread(breed sparrow 60, started 123145594023936)>.62 saved in thread <Thread(breed sparrow 62, started 123145583513600)>.

63 saved in thread <Thread(breed sparrow 63, started 123145588768768)>.
61 saved in thread <Thread(breed sparrow 61, started 123145599279104)>.
64 saved in thread <Thread(breed sparrow 64, started 123145609789440)>.
65 saved in thread <Thread(breed sparrow 65, started 123145604534272)>.
66 saved in thread <Thread(breed sparrow 66, started 123145573003264)>.67 saved in thread <Thread(breed sparrow 67, started 123145615044608)>.
68 saved in thread <Thread(breed sparrow 68, started 123145620299776)>.

71 saved in thread <Thread(breed sparrow 71, started 123145588768768)>.69 saved in thread <Thread(breed sparrow 69, started 123145583513600)>.

70 saved in thread <Thread(breed sparrow 70, started 123145594023936)>.
74 saved in thread <Thread(breed sparrow 74, started 123145609789440)>.72 saved in thread <Thread(breed sparrow 72, started 123145599279104)>.

75 saved in thread <Thread(breed sparrow 75, started 123145625554944)>.
76 saved in thread <Thread(breed sparrow 76, started 123145573003264)>.73 saved in thread <Thread(breed sparrow 73, started 123145604534272)>.

78 saved in thread <Thread(breed sparrow 78, started 123145588768768)>.77 saved in thread <Thread(breed sparrow 77, started 123145583513600)>.

80 saved in thread <Thread(breed sparrow 80, started 123145615044608)>.
79 saved in thread <Thread(breed sparrow 79, started 123145594023936)>.
81 saved in thread <Thread(breed sparrow 81, started 123145620299776)>.
83 saved in thread <Thread(breed sparrow 83, started 123145609789440)>.
84 saved in thread <Thread(breed sparrow 84, started 123145573003264)>.82 saved in thread <Thread(breed sparrow 82, started 123145599279104)>.85 saved in thread <Thread(breed sparrow 85, started 123145604534272)>.


86 saved in thread <Thread(breed sparrow 86, started 123145625554944)>.89 saved in thread <Thread(breed sparrow 89, started 123145594023936)>.
87 saved in thread <Thread(breed sparrow 87, started 123145588768768)>.88 saved in thread <Thread(breed sparrow 88, started 123145583513600)>.


90 saved in thread <Thread(breed sparrow 90, started 123145615044608)>.
91 saved in thread <Thread(breed sparrow 91, started 123145620299776)>.
92 saved in thread <Thread(breed sparrow 92, started 123145630810112)>.
96 saved in thread <Thread(breed sparrow 96, started 123145604534272)>.95 saved in thread <Thread(breed sparrow 95, started 123145599279104)>.93 saved in thread <Thread(breed sparrow 93, started 123145609789440)>.

94 saved in thread <Thread(breed sparrow 94, started 123145573003264)>.

97 saved in thread <Thread(breed sparrow 97, started 123145588768768)>.
99 saved in thread <Thread(breed sparrow 99, started 123145594023936)>.
98 saved in thread <Thread(breed sparrow 98, started 123145583513600)>.
100 saved in thread <Thread(breed sparrow 100, started 123145615044608)>.
101 saved in thread <Thread(breed sparrow 101, started 123145620299776)>.
102 saved in thread <Thread(breed sparrow 102, started 123145609789440)>.
104 saved in thread <Thread(breed sparrow 104, started 123145588768768)>.
103 saved in thread <Thread(breed sparrow 103, started 123145573003264)>.
106 saved in thread <Thread(breed sparrow 106, started 123145594023936)>.
105 saved in thread <Thread(breed sparrow 105, started 123145599279104)>.
107 saved in thread <Thread(breed sparrow 107, started 123145604534272)>.
108 saved in thread <Thread(breed sparrow 108, started 123145583513600)>.
110 saved in thread <Thread(breed sparrow 110, started 123145588768768)>.109 saved in thread <Thread(breed sparrow 109, started 123145615044608)>.

111 saved in thread <Thread(breed sparrow 111, started 123145573003264)>.
112 saved in thread <Thread(breed sparrow 112, started 123145609789440)>.
114 saved in thread <Thread(breed sparrow 114, started 123145620299776)>.115 saved in thread <Thread(breed sparrow 115, started 123145599279104)>.

113 saved in thread <Thread(breed sparrow 113, started 123145594023936)>.
117 saved in thread <Thread(breed sparrow 117, started 123145583513600)>.116 saved in thread <Thread(breed sparrow 116, started 123145604534272)>.

119 saved in thread <Thread(breed sparrow 119, started 123145588768768)>.118 saved in thread <Thread(breed sparrow 118, started 123145573003264)>.120 saved in thread <Thread(breed sparrow 120, started 123145599279104)>.


123 saved in thread <Thread(breed sparrow 123, started 123145615044608)>.
121 saved in thread <Thread(breed sparrow 121, started 123145609789440)>.
124 saved in thread <Thread(breed sparrow 124, started 123145620299776)>.122 saved in thread <Thread(breed sparrow 122, started 123145594023936)>.

126 saved in thread <Thread(breed sparrow 126, started 123145604534272)>.
125 saved in thread <Thread(breed sparrow 125, started 123145583513600)>.
127 saved in thread <Thread(breed sparrow 127, started 123145625554944)>.128 saved in thread <Thread(breed sparrow 128, started 123145630810112)>.

129 saved in thread <Thread(breed sparrow 129, started 123145573003264)>.
132 saved in thread <Thread(breed sparrow 132, started 123145615044608)>.
130 saved in thread <Thread(breed sparrow 130, started 123145588768768)>.
133 saved in thread <Thread(breed sparrow 133, started 123145609789440)>.131 saved in thread <Thread(breed sparrow 131, started 123145599279104)>.134 saved in thread <Thread(breed sparrow 134, started 123145594023936)>.


136 saved in thread <Thread(breed sparrow 136, started 123145604534272)>.
137 saved in thread <Thread(breed sparrow 137, started 123145620299776)>.
135 saved in thread <Thread(breed sparrow 135, started 123145583513600)>.
138 saved in thread <Thread(breed sparrow 138, started 123145573003264)>.
143 saved in thread <Thread(breed sparrow 143, started 123145609789440)>.139 saved in thread <Thread(breed sparrow 139, started 123145625554944)>.

141 saved in thread <Thread(breed sparrow 141, started 123145599279104)>.
140 saved in thread <Thread(breed sparrow 140, started 123145588768768)>.142 saved in thread <Thread(breed sparrow 142, started 123145594023936)>.

144 saved in thread <Thread(breed sparrow 144, started 123145615044608)>.145 saved in thread <Thread(breed sparrow 145, started 123145604534272)>.
147 saved in thread <Thread(breed sparrow 147, started 123145573003264)>.

146 saved in thread <Thread(breed sparrow 146, started 123145583513600)>.148 saved in thread <Thread(breed sparrow 148, started 123145620299776)>.

149 saved in thread <Thread(breed sparrow 149, started 123145630810112)>.
150 saved in thread <Thread(breed sparrow 150, started 123145609789440)>.151 saved in thread <Thread(breed sparrow 151, started 123145588768768)>.

152 saved in thread <Thread(breed sparrow 152, started 123145594023936)>.
153 saved in thread <Thread(breed sparrow 153, started 123145573003264)>.
154 saved in thread <Thread(breed sparrow 154, started 123145583513600)>.
156 saved in thread <Thread(breed sparrow 156, started 123145604534272)>.
155 saved in thread <Thread(breed sparrow 155, started 123145599279104)>.157 saved in thread <Thread(breed sparrow 157, started 123145615044608)>.

158 saved in thread <Thread(breed sparrow 158, started 123145588768768)>.
159 saved in thread <Thread(breed sparrow 159, started 123145609789440)>.160 saved in thread <Thread(breed sparrow 160, started 123145620299776)>.

161 saved in thread <Thread(breed sparrow 161, started 123145594023936)>.
162 saved in thread <Thread(breed sparrow 162, started 123145573003264)>.
163 saved in thread <Thread(breed sparrow 163, started 123145583513600)>.
164 saved in thread <Thread(breed sparrow 164, started 123145599279104)>.
166 saved in thread <Thread(breed sparrow 166, started 123145604534272)>.
165 saved in thread <Thread(breed sparrow 165, started 123145588768768)>.
167 saved in thread <Thread(breed sparrow 167, started 123145609789440)>.
170 saved in thread <Thread(breed sparrow 170, started 123145620299776)>.168 saved in thread <Thread(breed sparrow 168, started 123145615044608)>.
169 saved in thread <Thread(breed sparrow 169, started 123145594023936)>.

171 saved in thread <Thread(breed sparrow 171, started 123145573003264)>.
172 saved in thread <Thread(breed sparrow 172, started 123145625554944)>.
173 saved in thread <Thread(breed sparrow 173, started 123145583513600)>.
174 saved in thread <Thread(breed sparrow 174, started 123145599279104)>.
176 saved in thread <Thread(breed sparrow 176, started 123145604534272)>.
179 saved in thread <Thread(breed sparrow 179, started 123145609789440)>.
177 saved in thread <Thread(breed sparrow 177, started 123145594023936)>.
178 saved in thread <Thread(breed sparrow 178, started 123145573003264)>.175 saved in thread <Thread(breed sparrow 175, started 123145588768768)>.

181 saved in thread <Thread(breed sparrow 181, started 123145620299776)>.
180 saved in thread <Thread(breed sparrow 180, started 123145615044608)>.
183 saved in thread <Thread(breed sparrow 183, started 123145599279104)>.
182 saved in thread <Thread(breed sparrow 182, started 123145583513600)>.
184 saved in thread <Thread(breed sparrow 184, started 123145594023936)>.
185 saved in thread <Thread(breed sparrow 185, started 123145573003264)>.186 saved in thread <Thread(breed sparrow 186, started 123145588768768)>.
188 saved in thread <Thread(breed sparrow 188, started 123145609789440)>.

189 saved in thread <Thread(breed sparrow 189, started 123145599279104)>.
187 saved in thread <Thread(breed sparrow 187, started 123145604534272)>.
191 saved in thread <Thread(breed sparrow 191, started 123145594023936)>.
190 saved in thread <Thread(breed sparrow 190, started 123145583513600)>.192 saved in thread <Thread(breed sparrow 192, started 123145615044608)>.

194 saved in thread <Thread(breed sparrow 194, started 123145588768768)>.
193 saved in thread <Thread(breed sparrow 193, started 123145573003264)>.
195 saved in thread <Thread(breed sparrow 195, started 123145599279104)>.197 saved in thread <Thread(breed sparrow 197, started 123145609789440)>.

196 saved in thread <Thread(breed sparrow 196, started 123145604534272)>.
198 saved in thread <Thread(breed sparrow 198, started 123145594023936)>.
199 saved in thread <Thread(breed sparrow 199, started 123145583513600)>.
200 saved in thread <Thread(breed sparrow 200, started 123145588768768)>.201 saved in thread <Thread(breed sparrow 201, started 123145573003264)>.

202 saved in thread <Thread(breed sparrow 202, started 123145615044608)>.204 saved in thread <Thread(breed sparrow 204, started 123145604534272)>.

203 saved in thread <Thread(breed sparrow 203, started 123145599279104)>.
206 saved in thread <Thread(breed sparrow 206, started 123145620299776)>.205 saved in thread <Thread(breed sparrow 205, started 123145609789440)>.

207 saved in thread <Thread(breed sparrow 207, started 123145594023936)>.
209 saved in thread <Thread(breed sparrow 209, started 123145625554944)>.
211 saved in thread <Thread(breed sparrow 211, started 123145588768768)>.
210 saved in thread <Thread(breed sparrow 210, started 123145573003264)>.
212 saved in thread <Thread(breed sparrow 212, started 123145615044608)>.208 saved in thread <Thread(breed sparrow 208, started 123145583513600)>.

213 saved in thread <Thread(breed sparrow 213, started 123145604534272)>.215 saved in thread <Thread(breed sparrow 215, started 123145609789440)>.

216 saved in thread <Thread(breed sparrow 216, started 123145594023936)>.
218 saved in thread <Thread(breed sparrow 218, started 123145588768768)>.217 saved in thread <Thread(breed sparrow 217, started 123145573003264)>.
214 saved in thread <Thread(breed sparrow 214, started 123145599279104)>.

219 saved in thread <Thread(breed sparrow 219, started 123145620299776)>.
220 saved in thread <Thread(breed sparrow 220, started 123145625554944)>.
222 saved in thread <Thread(breed sparrow 222, started 123145583513600)>.
221 saved in thread <Thread(breed sparrow 221, started 123145615044608)>.
224 saved in thread <Thread(breed sparrow 224, started 123145609789440)>.
223 saved in thread <Thread(breed sparrow 223, started 123145630810112)>.
226 saved in thread <Thread(breed sparrow 226, started 123145573003264)>.225 saved in thread <Thread(breed sparrow 225, started 123145594023936)>.

227 saved in thread <Thread(breed sparrow 227, started 123145588768768)>.
228 saved in thread <Thread(breed sparrow 228, started 123145583513600)>.
229 saved in thread <Thread(breed sparrow 229, started 123145599279104)>.
230 saved in thread <Thread(breed sparrow 230, started 123145604534272)>.
232 saved in thread <Thread(breed sparrow 232, started 123145615044608)>.
231 saved in thread <Thread(breed sparrow 231, started 123145609789440)>.
234 saved in thread <Thread(breed sparrow 234, started 123145573003264)>.
235 saved in thread <Thread(breed sparrow 235, started 123145583513600)>.233 saved in thread <Thread(breed sparrow 233, started 123145620299776)>.

236 saved in thread <Thread(breed sparrow 236, started 123145588768768)>.
237 saved in thread <Thread(breed sparrow 237, started 123145594023936)>.
238 saved in thread <Thread(breed sparrow 238, started 123145573003264)>.239 saved in thread <Thread(breed sparrow 239, started 123145583513600)>.

240 saved in thread <Thread(breed sparrow 240, started 123145599279104)>.
241 saved in thread <Thread(breed sparrow 241, started 123145588768768)>.
242 saved in thread <Thread(breed sparrow 242, started 123145604534272)>.
243 saved in thread <Thread(breed sparrow 243, started 123145609789440)>.
244 saved in thread <Thread(breed sparrow 244, started 123145615044608)>.
245 saved in thread <Thread(breed sparrow 245, started 123145594023936)>.
247 saved in thread <Thread(breed sparrow 247, started 123145573003264)>.
246 saved in thread <Thread(breed sparrow 246, started 123145620299776)>.
248 saved in thread <Thread(breed sparrow 248, started 123145583513600)>.
249 saved in thread <Thread(breed sparrow 249, started 123145599279104)>.252 saved in thread <Thread(breed sparrow 252, started 123145609789440)>.250 saved in thread <Thread(breed sparrow 250, started 123145588768768)>.251 saved in thread <Thread(breed sparrow 251, started 123145604534272)>.



255 saved in thread <Thread(breed sparrow 255, started 123145625554944)>.253 saved in thread <Thread(breed sparrow 253, started 123145615044608)>.

254 saved in thread <Thread(breed sparrow 254, started 123145594023936)>.
257 saved in thread <Thread(breed sparrow 257, started 123145620299776)>.
256 saved in thread <Thread(breed sparrow 256, started 123145573003264)>.
258 saved in thread <Thread(breed sparrow 258, started 123145583513600)>.
259 saved in thread <Thread(breed sparrow 259, started 123145588768768)>.260 saved in thread <Thread(breed sparrow 260, started 123145599279104)>.

261 saved in thread <Thread(breed sparrow 261, started 123145604534272)>.262 saved in thread <Thread(breed sparrow 262, started 123145609789440)>.

263 saved in thread <Thread(breed sparrow 263, started 123145625554944)>.
264 saved in thread <Thread(breed sparrow 264, started 123145594023936)>.
266 saved in thread <Thread(breed sparrow 266, started 123145583513600)>.265 saved in thread <Thread(breed sparrow 265, started 123145573003264)>.

267 saved in thread <Thread(breed sparrow 267, started 123145588768768)>.
268 saved in thread <Thread(breed sparrow 268, started 123145599279104)>.
269 saved in thread <Thread(breed sparrow 269, started 123145604534272)>.
270 saved in thread <Thread(breed sparrow 270, started 123145609789440)>.271 saved in thread <Thread(breed sparrow 271, started 123145615044608)>.

274 saved in thread <Thread(breed sparrow 274, started 123145583513600)>.272 saved in thread <Thread(breed sparrow 272, started 123145594023936)>.

273 saved in thread <Thread(breed sparrow 273, started 123145620299776)>.276 saved in thread <Thread(breed sparrow 276, started 123145573003264)>.

275 saved in thread <Thread(breed sparrow 275, started 123145625554944)>.
277 saved in thread <Thread(breed sparrow 277, started 123145588768768)>.
279 saved in thread <Thread(breed sparrow 279, started 123145604534272)>.
278 saved in thread <Thread(breed sparrow 278, started 123145599279104)>.280 saved in thread <Thread(breed sparrow 280, started 123145609789440)>.

281 saved in thread <Thread(breed sparrow 281, started 123145583513600)>.
282 saved in thread <Thread(breed sparrow 282, started 123145573003264)>.
283 saved in thread <Thread(breed sparrow 283, started 123145594023936)>.284 saved in thread <Thread(breed sparrow 284, started 123145615044608)>.
285 saved in thread <Thread(breed sparrow 285, started 123145620299776)>.
286 saved in thread <Thread(breed sparrow 286, started 123145588768768)>.

287 saved in thread <Thread(breed sparrow 287, started 123145604534272)>.
288 saved in thread <Thread(breed sparrow 288, started 123145599279104)>.
289 saved in thread <Thread(breed sparrow 289, started 123145609789440)>.
290 saved in thread <Thread(breed sparrow 290, started 123145583513600)>.
291 saved in thread <Thread(breed sparrow 291, started 123145625554944)>.
293 saved in thread <Thread(breed sparrow 293, started 123145630810112)>.
292 saved in thread <Thread(breed sparrow 292, started 123145573003264)>.
294 saved in thread <Thread(breed sparrow 294, started 123145588768768)>.
296 saved in thread <Thread(breed sparrow 296, started 123145599279104)>.
295 saved in thread <Thread(breed sparrow 295, started 123145594023936)>.
297 saved in thread <Thread(breed sparrow 297, started 123145604534272)>.
299 saved in thread <Thread(breed sparrow 299, started 123145609789440)>.298 saved in thread <Thread(breed sparrow 298, started 123145583513600)>.

300 saved in thread <Thread(breed sparrow 300, started 123145573003264)>.
301 saved in thread <Thread(breed sparrow 301, started 123145615044608)>.
302 saved in thread <Thread(breed sparrow 302, started 123145588768768)>.303 saved in thread <Thread(breed sparrow 303, started 123145599279104)>.
305 saved in thread <Thread(breed sparrow 305, started 123145604534272)>.

304 saved in thread <Thread(breed sparrow 304, started 123145594023936)>.
307 saved in thread <Thread(breed sparrow 307, started 123145583513600)>.
306 saved in thread <Thread(breed sparrow 306, started 123145620299776)>.
309 saved in thread <Thread(breed sparrow 309, started 123145609789440)>.308 saved in thread <Thread(breed sparrow 308, started 123145573003264)>.310 saved in thread <Thread(breed sparrow 310, started 123145625554944)>.

311 saved in thread <Thread(breed sparrow 311, started 123145615044608)>.

313 saved in thread <Thread(breed sparrow 313, started 123145599279104)>.
312 saved in thread <Thread(breed sparrow 312, started 123145588768768)>.
315 saved in thread <Thread(breed sparrow 315, started 123145583513600)>.314 saved in thread <Thread(breed sparrow 314, started 123145604534272)>.316 saved in thread <Thread(breed sparrow 316, started 123145594023936)>.


317 saved in thread <Thread(breed sparrow 317, started 123145609789440)>.
320 saved in thread <Thread(breed sparrow 320, started 123145588768768)>.
318 saved in thread <Thread(breed sparrow 318, started 123145573003264)>.
321 saved in thread <Thread(breed sparrow 321, started 123145583513600)>.
322 saved in thread <Thread(breed sparrow 322, started 123145594023936)>.
319 saved in thread <Thread(breed sparrow 319, started 123145599279104)>.
323 saved in thread <Thread(breed sparrow 323, started 123145604534272)>.324 saved in thread <Thread(breed sparrow 324, started 123145609789440)>.

325 saved in thread <Thread(breed sparrow 325, started 123145588768768)>.
326 saved in thread <Thread(breed sparrow 326, started 123145573003264)>.
327 saved in thread <Thread(breed sparrow 327, started 123145583513600)>.
329 saved in thread <Thread(breed sparrow 329, started 123145599279104)>.328 saved in thread <Thread(breed sparrow 328, started 123145594023936)>.330 saved in thread <Thread(breed sparrow 330, started 123145615044608)>.


331 saved in thread <Thread(breed sparrow 331, started 123145604534272)>.332 saved in thread <Thread(breed sparrow 332, started 123145588768768)>.

335 saved in thread <Thread(breed sparrow 335, started 123145573003264)>.
333 saved in thread <Thread(breed sparrow 333, started 123145609789440)>.
334 saved in thread <Thread(breed sparrow 334, started 123145620299776)>.
337 saved in thread <Thread(breed sparrow 337, started 123145594023936)>.336 saved in thread <Thread(breed sparrow 336, started 123145583513600)>.

339 saved in thread <Thread(breed sparrow 339, started 123145615044608)>.
340 saved in thread <Thread(breed sparrow 340, started 123145625554944)>.341 saved in thread <Thread(breed sparrow 341, started 123145588768768)>.
338 saved in thread <Thread(breed sparrow 338, started 123145599279104)>.

342 saved in thread <Thread(breed sparrow 342, started 123145573003264)>.
343 saved in thread <Thread(breed sparrow 343, started 123145604534272)>.
345 saved in thread <Thread(breed sparrow 345, started 123145620299776)>.344 saved in thread <Thread(breed sparrow 344, started 123145609789440)>.

346 saved in thread <Thread(breed sparrow 346, started 123145630810112)>.347 saved in thread <Thread(breed sparrow 347, started 123145583513600)>.
348 saved in thread <Thread(breed sparrow 348, started 123145594023936)>.

349 saved in thread <Thread(breed sparrow 349, started 123145588768768)>.
350 saved in thread <Thread(breed sparrow 350, started 123145573003264)>.
352 saved in thread <Thread(breed sparrow 352, started 123145604534272)>.351 saved in thread <Thread(breed sparrow 351, started 123145599279104)>.

353 saved in thread <Thread(breed sparrow 353, started 123145609789440)>.354 saved in thread <Thread(breed sparrow 354, started 123145583513600)>.

355 saved in thread <Thread(breed sparrow 355, started 123145615044608)>.
357 saved in thread <Thread(breed sparrow 357, started 123145588768768)>.356 saved in thread <Thread(breed sparrow 356, started 123145594023936)>.

358 saved in thread <Thread(breed sparrow 358, started 123145573003264)>.359 saved in thread <Thread(breed sparrow 359, started 123145620299776)>.

360 saved in thread <Thread(breed sparrow 360, started 123145599279104)>.361 saved in thread <Thread(breed sparrow 361, started 123145583513600)>.

362 saved in thread <Thread(breed sparrow 362, started 123145604534272)>.364 saved in thread <Thread(breed sparrow 364, started 123145594023936)>.363 saved in thread <Thread(breed sparrow 363, started 123145588768768)>.365 saved in thread <Thread(breed sparrow 365, started 123145573003264)>.



366 saved in thread <Thread(breed sparrow 366, started 123145599279104)>.367 saved in thread <Thread(breed sparrow 367, started 123145583513600)>.

369 saved in thread <Thread(breed sparrow 369, started 123145615044608)>.
368 saved in thread <Thread(breed sparrow 368, started 123145609789440)>.
373 saved in thread <Thread(breed sparrow 373, started 123145573003264)>.
370 saved in thread <Thread(breed sparrow 370, started 123145620299776)>.371 saved in thread <Thread(breed sparrow 371, started 123145625554944)>.

372 saved in thread <Thread(breed sparrow 372, started 123145630810112)>.375 saved in thread <Thread(breed sparrow 375, started 123145594023936)>.

374 saved in thread <Thread(breed sparrow 374, started 123145588768768)>.
376 saved in thread <Thread(breed sparrow 376, started 123145599279104)>.377 saved in thread <Thread(breed sparrow 377, started 123145583513600)>.

378 saved in thread <Thread(breed sparrow 378, started 123145604534272)>.
380 saved in thread <Thread(breed sparrow 380, started 123145609789440)>.
379 saved in thread <Thread(breed sparrow 379, started 123145573003264)>.
381 saved in thread <Thread(breed sparrow 381, started 123145594023936)>.
382 saved in thread <Thread(breed sparrow 382, started 123145615044608)>.
384 saved in thread <Thread(breed sparrow 384, started 123145588768768)>.383 saved in thread <Thread(breed sparrow 383, started 123145620299776)>.

385 saved in thread <Thread(breed sparrow 385, started 123145583513600)>.
386 saved in thread <Thread(breed sparrow 386, started 123145599279104)>.
387 saved in thread <Thread(breed sparrow 387, started 123145573003264)>.
388 saved in thread <Thread(breed sparrow 388, started 123145594023936)>.
391 saved in thread <Thread(breed sparrow 391, started 123145609789440)>.
389 saved in thread <Thread(breed sparrow 389, started 123145604534272)>.
390 saved in thread <Thread(breed sparrow 390, started 123145588768768)>.392 saved in thread <Thread(breed sparrow 392, started 123145615044608)>.

393 saved in thread <Thread(breed sparrow 393, started 123145620299776)>.
395 saved in thread <Thread(breed sparrow 395, started 123145599279104)>.
394 saved in thread <Thread(breed sparrow 394, started 123145583513600)>.396 saved in thread <Thread(breed sparrow 396, started 123145573003264)>.

397 saved in thread <Thread(breed sparrow 397, started 123145625554944)>.
399 saved in thread <Thread(breed sparrow 399, started 123145604534272)>.
400 saved in thread <Thread(breed sparrow 400, started 123145588768768)>.
398 saved in thread <Thread(breed sparrow 398, started 123145594023936)>.401 saved in thread <Thread(breed sparrow 401, started 123145609789440)>.

402 saved in thread <Thread(breed sparrow 402, started 123145599279104)>.404 saved in thread <Thread(breed sparrow 404, started 123145573003264)>.

403 saved in thread <Thread(breed sparrow 403, started 123145615044608)>.
405 saved in thread <Thread(breed sparrow 405, started 123145583513600)>.
407 saved in thread <Thread(breed sparrow 407, started 123145588768768)>.
410 saved in thread <Thread(breed sparrow 410, started 123145609789440)>.
412 saved in thread <Thread(breed sparrow 412, started 123145599279104)>.406 saved in thread <Thread(breed sparrow 406, started 123145620299776)>.

411 saved in thread <Thread(breed sparrow 411, started 123145573003264)>.409 saved in thread <Thread(breed sparrow 409, started 123145594023936)>.
408 saved in thread <Thread(breed sparrow 408, started 123145604534272)>.

413 saved in thread <Thread(breed sparrow 413, started 123145615044608)>.
415 saved in thread <Thread(breed sparrow 415, started 123145583513600)>.414 saved in thread <Thread(breed sparrow 414, started 123145625554944)>.

416 saved in thread <Thread(breed sparrow 416, started 123145588768768)>.
417 saved in thread <Thread(breed sparrow 417, started 123145609789440)>.
419 saved in thread <Thread(breed sparrow 419, started 123145594023936)>.418 saved in thread <Thread(breed sparrow 418, started 123145573003264)>.420 saved in thread <Thread(breed sparrow 420, started 123145599279104)>.


422 saved in thread <Thread(breed sparrow 422, started 123145615044608)>.421 saved in thread <Thread(breed sparrow 421, started 123145604534272)>.

423 saved in thread <Thread(breed sparrow 423, started 123145620299776)>.
424 saved in thread <Thread(breed sparrow 424, started 123145583513600)>.
425 saved in thread <Thread(breed sparrow 425, started 123145588768768)>.426 saved in thread <Thread(breed sparrow 426, started 123145609789440)>.
427 saved in thread <Thread(breed sparrow 427, started 123145625554944)>.

429 saved in thread <Thread(breed sparrow 429, started 123145599279104)>.
428 saved in thread <Thread(breed sparrow 428, started 123145630810112)>.
431 saved in thread <Thread(breed sparrow 431, started 123145594023936)>.
430 saved in thread <Thread(breed sparrow 430, started 123145573003264)>.
432 saved in thread <Thread(breed sparrow 432, started 123145583513600)>.
433 saved in thread <Thread(breed sparrow 433, started 123145588768768)>.
434 saved in thread <Thread(breed sparrow 434, started 123145604534272)>.
435 saved in thread <Thread(breed sparrow 435, started 123145599279104)>.
436 saved in thread <Thread(breed sparrow 436, started 123145609789440)>.438 saved in thread <Thread(breed sparrow 438, started 123145620299776)>.

437 saved in thread <Thread(breed sparrow 437, started 123145615044608)>.
439 saved in thread <Thread(breed sparrow 439, started 123145573003264)>.
440 saved in thread <Thread(breed sparrow 440, started 123145594023936)>.
442 saved in thread <Thread(breed sparrow 442, started 123145588768768)>.441 saved in thread <Thread(breed sparrow 441, started 123145583513600)>.

443 saved in thread <Thread(breed sparrow 443, started 123145599279104)>.
445 saved in thread <Thread(breed sparrow 445, started 123145609789440)>.
444 saved in thread <Thread(breed sparrow 444, started 123145604534272)>.
446 saved in thread <Thread(breed sparrow 446, started 123145615044608)>.
447 saved in thread <Thread(breed sparrow 447, started 123145573003264)>.
448 saved in thread <Thread(breed sparrow 448, started 123145594023936)>.
449 saved in thread <Thread(breed sparrow 449, started 123145583513600)>.450 saved in thread <Thread(breed sparrow 450, started 123145588768768)>.

451 saved in thread <Thread(breed sparrow 451, started 123145599279104)>.453 saved in thread <Thread(breed sparrow 453, started 123145573003264)>.
452 saved in thread <Thread(breed sparrow 452, started 123145604534272)>.

455 saved in thread <Thread(breed sparrow 455, started 123145615044608)>.
454 saved in thread <Thread(breed sparrow 454, started 123145609789440)>.
458 saved in thread <Thread(breed sparrow 458, started 123145625554944)>.457 saved in thread <Thread(breed sparrow 457, started 123145594023936)>.
456 saved in thread <Thread(breed sparrow 456, started 123145620299776)>.

459 saved in thread <Thread(breed sparrow 459, started 123145583513600)>.
460 saved in thread <Thread(breed sparrow 460, started 123145573003264)>.
462 saved in thread <Thread(breed sparrow 462, started 123145599279104)>.
461 saved in thread <Thread(breed sparrow 461, started 123145588768768)>.
464 saved in thread <Thread(breed sparrow 464, started 123145609789440)>.
465 saved in thread <Thread(breed sparrow 465, started 123145615044608)>.
463 saved in thread <Thread(breed sparrow 463, started 123145604534272)>.
466 saved in thread <Thread(breed sparrow 466, started 123145594023936)>.
468 saved in thread <Thread(breed sparrow 468, started 123145573003264)>.
467 saved in thread <Thread(breed sparrow 467, started 123145583513600)>.
469 saved in thread <Thread(breed sparrow 469, started 123145599279104)>.
471 saved in thread <Thread(breed sparrow 471, started 123145588768768)>.
470 saved in thread <Thread(breed sparrow 470, started 123145620299776)>.
472 saved in thread <Thread(breed sparrow 472, started 123145604534272)>.
473 saved in thread <Thread(breed sparrow 473, started 123145609789440)>.
475 saved in thread <Thread(breed sparrow 475, started 123145573003264)>.
474 saved in thread <Thread(breed sparrow 474, started 123145594023936)>.476 saved in thread <Thread(breed sparrow 476, started 123145615044608)>.477 saved in thread <Thread(breed sparrow 477, started 123145583513600)>.


478 saved in thread <Thread(breed sparrow 478, started 123145588768768)>.479 saved in thread <Thread(breed sparrow 479, started 123145599279104)>.

482 saved in thread <Thread(breed sparrow 482, started 123145609789440)>.480 saved in thread <Thread(breed sparrow 480, started 123145620299776)>.

481 saved in thread <Thread(breed sparrow 481, started 123145604534272)>.
483 saved in thread <Thread(breed sparrow 483, started 123145573003264)>.
484 saved in thread <Thread(breed sparrow 484, started 123145615044608)>.
486 saved in thread <Thread(breed sparrow 486, started 123145594023936)>.
485 saved in thread <Thread(breed sparrow 485, started 123145583513600)>.
487 saved in thread <Thread(breed sparrow 487, started 123145588768768)>.
488 saved in thread <Thread(breed sparrow 488, started 123145599279104)>.
489 saved in thread <Thread(breed sparrow 489, started 123145573003264)>.
490 saved in thread <Thread(breed sparrow 490, started 123145604534272)>.
491 saved in thread <Thread(breed sparrow 491, started 123145583513600)>.
494 saved in thread <Thread(breed sparrow 494, started 123145609789440)>.492 saved in thread <Thread(breed sparrow 492, started 123145588768768)>.

493 saved in thread <Thread(breed sparrow 493, started 123145594023936)>.
495 saved in thread <Thread(breed sparrow 495, started 123145599279104)>.
496 saved in thread <Thread(breed sparrow 496, started 123145615044608)>.
497 saved in thread <Thread(breed sparrow 497, started 123145573003264)>.498 saved in thread <Thread(breed sparrow 498, started 123145604534272)>.

499 saved in thread <Thread(breed sparrow 499, started 123145620299776)>.
502 saved in thread <Thread(breed sparrow 502, started 123145594023936)>.
501 saved in thread <Thread(breed sparrow 501, started 123145588768768)>.
500 saved in thread <Thread(breed sparrow 500, started 123145583513600)>.
503 saved in thread <Thread(breed sparrow 503, started 123145599279104)>.
504 saved in thread <Thread(breed sparrow 504, started 123145609789440)>.505 saved in thread <Thread(breed sparrow 505, started 123145615044608)>.

506 saved in thread <Thread(breed sparrow 506, started 123145625554944)>.
508 saved in thread <Thread(breed sparrow 508, started 123145604534272)>.
507 saved in thread <Thread(breed sparrow 507, started 123145573003264)>.
509 saved in thread <Thread(breed sparrow 509, started 123145620299776)>.
510 saved in thread <Thread(breed sparrow 510, started 123145588768768)>.
511 saved in thread <Thread(breed sparrow 511, started 123145583513600)>.
512 saved in thread <Thread(breed sparrow 512, started 123145594023936)>.
515 saved in thread <Thread(breed sparrow 515, started 123145615044608)>.513 saved in thread <Thread(breed sparrow 513, started 123145599279104)>.

514 saved in thread <Thread(breed sparrow 514, started 123145609789440)>.516 saved in thread <Thread(breed sparrow 516, started 123145604534272)>.

517 saved in thread <Thread(breed sparrow 517, started 123145573003264)>.
518 saved in thread <Thread(breed sparrow 518, started 123145583513600)>.
519 saved in thread <Thread(breed sparrow 519, started 123145588768768)>.
520 saved in thread <Thread(breed sparrow 520, started 123145594023936)>.524 saved in thread <Thread(breed sparrow 524, started 123145604534272)>.522 saved in thread <Thread(breed sparrow 522, started 123145615044608)>.


521 saved in thread <Thread(breed sparrow 521, started 123145620299776)>.
526 saved in thread <Thread(breed sparrow 526, started 123145583513600)>.523 saved in thread <Thread(breed sparrow 523, started 123145599279104)>.525 saved in thread <Thread(breed sparrow 525, started 123145573003264)>.


527 saved in thread <Thread(breed sparrow 527, started 123145609789440)>.528 saved in thread <Thread(breed sparrow 528, started 123145625554944)>.

529 saved in thread <Thread(breed sparrow 529, started 123145588768768)>.
530 saved in thread <Thread(breed sparrow 530, started 123145594023936)>.
532 saved in thread <Thread(breed sparrow 532, started 123145615044608)>.
531 saved in thread <Thread(breed sparrow 531, started 123145604534272)>.
533 saved in thread <Thread(breed sparrow 533, started 123145573003264)>.
535 saved in thread <Thread(breed sparrow 535, started 123145599279104)>.534 saved in thread <Thread(breed sparrow 534, started 123145583513600)>.

537 saved in thread <Thread(breed sparrow 537, started 123145588768768)>.536 saved in thread <Thread(breed sparrow 536, started 123145609789440)>.
538 saved in thread <Thread(breed sparrow 538, started 123145620299776)>.

540 saved in thread <Thread(breed sparrow 540, started 123145604534272)>.
539 saved in thread <Thread(breed sparrow 539, started 123145594023936)>.542 saved in thread <Thread(breed sparrow 542, started 123145583513600)>.

541 saved in thread <Thread(breed sparrow 541, started 123145573003264)>.
543 saved in thread <Thread(breed sparrow 543, started 123145599279104)>.544 saved in thread <Thread(breed sparrow 544, started 123145615044608)>.

545 saved in thread <Thread(breed sparrow 545, started 123145625554944)>.
546 saved in thread <Thread(breed sparrow 546, started 123145588768768)>.
547 saved in thread <Thread(breed sparrow 547, started 123145604534272)>.
551 saved in thread <Thread(breed sparrow 551, started 123145599279104)>.548 saved in thread <Thread(breed sparrow 548, started 123145583513600)>.549 saved in thread <Thread(breed sparrow 549, started 123145573003264)>.

550 saved in thread <Thread(breed sparrow 550, started 123145594023936)>.

554 saved in thread <Thread(breed sparrow 554, started 123145620299776)>.553 saved in thread <Thread(breed sparrow 553, started 123145615044608)>.

552 saved in thread <Thread(breed sparrow 552, started 123145609789440)>.
555 saved in thread <Thread(breed sparrow 555, started 123145588768768)>.
557 saved in thread <Thread(breed sparrow 557, started 123145604534272)>.558 saved in thread <Thread(breed sparrow 558, started 123145583513600)>.
556 saved in thread <Thread(breed sparrow 556, started 123145625554944)>.

560 saved in thread <Thread(breed sparrow 560, started 123145594023936)>.
559 saved in thread <Thread(breed sparrow 559, started 123145573003264)>.
561 saved in thread <Thread(breed sparrow 561, started 123145599279104)>.
562 saved in thread <Thread(breed sparrow 562, started 123145615044608)>.
563 saved in thread <Thread(breed sparrow 563, started 123145588768768)>.
564 saved in thread <Thread(breed sparrow 564, started 123145583513600)>.
565 saved in thread <Thread(breed sparrow 565, started 123145604534272)>.
566 saved in thread <Thread(breed sparrow 566, started 123145594023936)>.567 saved in thread <Thread(breed sparrow 567, started 123145573003264)>.

568 saved in thread <Thread(breed sparrow 568, started 123145599279104)>.
569 saved in thread <Thread(breed sparrow 569, started 123145609789440)>.
570 saved in thread <Thread(breed sparrow 570, started 123145620299776)>.
571 saved in thread <Thread(breed sparrow 571, started 123145615044608)>.574 saved in thread <Thread(breed sparrow 574, started 123145573003264)>.

572 saved in thread <Thread(breed sparrow 572, started 123145588768768)>.
573 saved in thread <Thread(breed sparrow 573, started 123145583513600)>.
575 saved in thread <Thread(breed sparrow 575, started 123145594023936)>.
578 saved in thread <Thread(breed sparrow 578, started 123145609789440)>.576 saved in thread <Thread(breed sparrow 576, started 123145599279104)>.
577 saved in thread <Thread(breed sparrow 577, started 123145604534272)>.

579 saved in thread <Thread(breed sparrow 579, started 123145620299776)>.581 saved in thread <Thread(breed sparrow 581, started 123145573003264)>.

583 saved in thread <Thread(breed sparrow 583, started 123145588768768)>.582 saved in thread <Thread(breed sparrow 582, started 123145583513600)>.580 saved in thread <Thread(breed sparrow 580, started 123145615044608)>.


585 saved in thread <Thread(breed sparrow 585, started 123145599279104)>.
584 saved in thread <Thread(breed sparrow 584, started 123145594023936)>.
586 saved in thread <Thread(breed sparrow 586, started 123145604534272)>.588 saved in thread <Thread(breed sparrow 588, started 123145625554944)>.

589 saved in thread <Thread(breed sparrow 589, started 123145573003264)>.
587 saved in thread <Thread(breed sparrow 587, started 123145609789440)>.
591 saved in thread <Thread(breed sparrow 591, started 123145588768768)>.
592 saved in thread <Thread(breed sparrow 592, started 123145615044608)>.590 saved in thread <Thread(breed sparrow 590, started 123145583513600)>.

593 saved in thread <Thread(breed sparrow 593, started 123145594023936)>.
594 saved in thread <Thread(breed sparrow 594, started 123145599279104)>.
595 saved in thread <Thread(breed sparrow 595, started 123145604534272)>.
596 saved in thread <Thread(breed sparrow 596, started 123145573003264)>.
597 saved in thread <Thread(breed sparrow 597, started 123145609789440)>.
598 saved in thread <Thread(breed sparrow 598, started 123145588768768)>.
599 saved in thread <Thread(breed sparrow 599, started 123145583513600)>.601 saved in thread <Thread(breed sparrow 601, started 123145599279104)>.
600 saved in thread <Thread(breed sparrow 600, started 123145594023936)>.

602 saved in thread <Thread(breed sparrow 602, started 123145604534272)>.
604 saved in thread <Thread(breed sparrow 604, started 123145573003264)>.
605 saved in thread <Thread(breed sparrow 605, started 123145620299776)>.
603 saved in thread <Thread(breed sparrow 603, started 123145615044608)>.
606 saved in thread <Thread(breed sparrow 606, started 123145588768768)>.
608 saved in thread <Thread(breed sparrow 608, started 123145625554944)>.607 saved in thread <Thread(breed sparrow 607, started 123145609789440)>.

609 saved in thread <Thread(breed sparrow 609, started 123145583513600)>.
611 saved in thread <Thread(breed sparrow 611, started 123145599279104)>.612 saved in thread <Thread(breed sparrow 612, started 123145604534272)>.

613 saved in thread <Thread(breed sparrow 613, started 123145630810112)>.610 saved in thread <Thread(breed sparrow 610, started 123145594023936)>.

614 saved in thread <Thread(breed sparrow 614, started 123145573003264)>.615 saved in thread <Thread(breed sparrow 615, started 123145615044608)>.

617 saved in thread <Thread(breed sparrow 617, started 123145609789440)>.
619 saved in thread <Thread(breed sparrow 619, started 123145583513600)>.
618 saved in thread <Thread(breed sparrow 618, started 123145620299776)>.616 saved in thread <Thread(breed sparrow 616, started 123145588768768)>.

620 saved in thread <Thread(breed sparrow 620, started 123145625554944)>.
621 saved in thread <Thread(breed sparrow 621, started 123145604534272)>.
622 saved in thread <Thread(breed sparrow 622, started 123145630810112)>.
626 saved in thread <Thread(breed sparrow 626, started 123145609789440)>.623 saved in thread <Thread(breed sparrow 623, started 123145594023936)>.

624 saved in thread <Thread(breed sparrow 624, started 123145599279104)>.625 saved in thread <Thread(breed sparrow 625, started 123145573003264)>.

627 saved in thread <Thread(breed sparrow 627, started 123145583513600)>.
630 saved in thread <Thread(breed sparrow 630, started 123145609789440)>.629 saved in thread <Thread(breed sparrow 629, started 123145604534272)>.

628 saved in thread <Thread(breed sparrow 628, started 123145588768768)>.
632 saved in thread <Thread(breed sparrow 632, started 123145599279104)>.
631 saved in thread <Thread(breed sparrow 631, started 123145594023936)>.
633 saved in thread <Thread(breed sparrow 633, started 123145573003264)>.
635 saved in thread <Thread(breed sparrow 635, started 123145615044608)>.
634 saved in thread <Thread(breed sparrow 634, started 123145583513600)>.
636 saved in thread <Thread(breed sparrow 636, started 123145620299776)>.
637 saved in thread <Thread(breed sparrow 637, started 123145625554944)>.638 saved in thread <Thread(breed sparrow 638, started 123145588768768)>.

640 saved in thread <Thread(breed sparrow 640, started 123145604534272)>.
639 saved in thread <Thread(breed sparrow 639, started 123145599279104)>.
641 saved in thread <Thread(breed sparrow 641, started 123145594023936)>.
642 saved in thread <Thread(breed sparrow 642, started 123145573003264)>.
643 saved in thread <Thread(breed sparrow 643, started 123145583513600)>.
646 saved in thread <Thread(breed sparrow 646, started 123145588768768)>.645 saved in thread <Thread(breed sparrow 645, started 123145615044608)>.
644 saved in thread <Thread(breed sparrow 644, started 123145609789440)>.

647 saved in thread <Thread(breed sparrow 647, started 123145604534272)>.
650 saved in thread <Thread(breed sparrow 650, started 123145573003264)>.
649 saved in thread <Thread(breed sparrow 649, started 123145594023936)>.
651 saved in thread <Thread(breed sparrow 651, started 123145583513600)>.
648 saved in thread <Thread(breed sparrow 648, started 123145620299776)>.
652 saved in thread <Thread(breed sparrow 652, started 123145599279104)>.
653 saved in thread <Thread(breed sparrow 653, started 123145588768768)>.654 saved in thread <Thread(breed sparrow 654, started 123145609789440)>.

656 saved in thread <Thread(breed sparrow 656, started 123145615044608)>.655 saved in thread <Thread(breed sparrow 655, started 123145604534272)>.

657 saved in thread <Thread(breed sparrow 657, started 123145625554944)>.
659 saved in thread <Thread(breed sparrow 659, started 123145583513600)>.
658 saved in thread <Thread(breed sparrow 658, started 123145573003264)>.
660 saved in thread <Thread(breed sparrow 660, started 123145594023936)>.
661 saved in thread <Thread(breed sparrow 661, started 123145588768768)>.
663 saved in thread <Thread(breed sparrow 663, started 123145604534272)>.
662 saved in thread <Thread(breed sparrow 662, started 123145599279104)>.
665 saved in thread <Thread(breed sparrow 665, started 123145583513600)>.664 saved in thread <Thread(breed sparrow 664, started 123145609789440)>.
668 saved in thread <Thread(breed sparrow 668, started 123145615044608)>.

667 saved in thread <Thread(breed sparrow 667, started 123145594023936)>.
666 saved in thread <Thread(breed sparrow 666, started 123145573003264)>.
669 saved in thread <Thread(breed sparrow 669, started 123145588768768)>.
670 saved in thread <Thread(breed sparrow 670, started 123145620299776)>.
672 saved in thread <Thread(breed sparrow 672, started 123145604534272)>.674 saved in thread <Thread(breed sparrow 674, started 123145573003264)>.

671 saved in thread <Thread(breed sparrow 671, started 123145599279104)>.673 saved in thread <Thread(breed sparrow 673, started 123145625554944)>.

675 saved in thread <Thread(breed sparrow 675, started 123145583513600)>.
677 saved in thread <Thread(breed sparrow 677, started 123145594023936)>.
676 saved in thread <Thread(breed sparrow 676, started 123145588768768)>.
678 saved in thread <Thread(breed sparrow 678, started 123145609789440)>.679 saved in thread <Thread(breed sparrow 679, started 123145615044608)>.

680 saved in thread <Thread(breed sparrow 680, started 123145573003264)>.
681 saved in thread <Thread(breed sparrow 681, started 123145599279104)>.683 saved in thread <Thread(breed sparrow 683, started 123145583513600)>.
682 saved in thread <Thread(breed sparrow 682, started 123145604534272)>.

684 saved in thread <Thread(breed sparrow 684, started 123145594023936)>.
686 saved in thread <Thread(breed sparrow 686, started 123145615044608)>.
685 saved in thread <Thread(breed sparrow 685, started 123145588768768)>.687 saved in thread <Thread(breed sparrow 687, started 123145609789440)>.

689 saved in thread <Thread(breed sparrow 689, started 123145583513600)>.688 saved in thread <Thread(breed sparrow 688, started 123145573003264)>.
690 saved in thread <Thread(breed sparrow 690, started 123145599279104)>.

692 saved in thread <Thread(breed sparrow 692, started 123145620299776)>.691 saved in thread <Thread(breed sparrow 691, started 123145604534272)>.
693 saved in thread <Thread(breed sparrow 693, started 123145594023936)>.

694 saved in thread <Thread(breed sparrow 694, started 123145615044608)>.
695 saved in thread <Thread(breed sparrow 695, started 123145588768768)>.
696 saved in thread <Thread(breed sparrow 696, started 123145609789440)>.
698 saved in thread <Thread(breed sparrow 698, started 123145573003264)>.
697 saved in thread <Thread(breed sparrow 697, started 123145625554944)>.
699 saved in thread <Thread(breed sparrow 699, started 123145583513600)>.
701 saved in thread <Thread(breed sparrow 701, started 123145594023936)>.
700 saved in thread <Thread(breed sparrow 700, started 123145599279104)>.
702 saved in thread <Thread(breed sparrow 702, started 123145604534272)>.
703 saved in thread <Thread(breed sparrow 703, started 123145588768768)>.
704 saved in thread <Thread(breed sparrow 704, started 123145573003264)>.705 saved in thread <Thread(breed sparrow 705, started 123145609789440)>.
706 saved in thread <Thread(breed sparrow 706, started 123145583513600)>.708 saved in thread <Thread(breed sparrow 708, started 123145620299776)>.707 saved in thread <Thread(breed sparrow 707, started 123145615044608)>.



710 saved in thread <Thread(breed sparrow 710, started 123145599279104)>.
709 saved in thread <Thread(breed sparrow 709, started 123145594023936)>.
711 saved in thread <Thread(breed sparrow 711, started 123145604534272)>.
713 saved in thread <Thread(breed sparrow 713, started 123145588768768)>.715 saved in thread <Thread(breed sparrow 715, started 123145573003264)>.712 saved in thread <Thread(breed sparrow 712, started 123145625554944)>.


716 saved in thread <Thread(breed sparrow 716, started 123145620299776)>.718 saved in thread <Thread(breed sparrow 718, started 123145609789440)>.

714 saved in thread <Thread(breed sparrow 714, started 123145630810112)>.
717 saved in thread <Thread(breed sparrow 717, started 123145583513600)>.
719 saved in thread <Thread(breed sparrow 719, started 123145599279104)>.720 saved in thread <Thread(breed sparrow 720, started 123145594023936)>.
721 saved in thread <Thread(breed sparrow 721, started 123145604534272)>.

722 saved in thread <Thread(breed sparrow 722, started 123145615044608)>.723 saved in thread <Thread(breed sparrow 723, started 123145573003264)>.

725 saved in thread <Thread(breed sparrow 725, started 123145609789440)>.
724 saved in thread <Thread(breed sparrow 724, started 123145588768768)>.
727 saved in thread <Thread(breed sparrow 727, started 123145583513600)>.
726 saved in thread <Thread(breed sparrow 726, started 123145620299776)>.
729 saved in thread <Thread(breed sparrow 729, started 123145594023936)>.
728 saved in thread <Thread(breed sparrow 728, started 123145599279104)>.
730 saved in thread <Thread(breed sparrow 730, started 123145604534272)>.
732 saved in thread <Thread(breed sparrow 732, started 123145588768768)>.
734 saved in thread <Thread(breed sparrow 734, started 123145615044608)>.
731 saved in thread <Thread(breed sparrow 731, started 123145573003264)>.
733 saved in thread <Thread(breed sparrow 733, started 123145609789440)>.
738 saved in thread <Thread(breed sparrow 738, started 123145594023936)>.
735 saved in thread <Thread(breed sparrow 735, started 123145583513600)>.
737 saved in thread <Thread(breed sparrow 737, started 123145620299776)>.
736 saved in thread <Thread(breed sparrow 736, started 123145625554944)>.
739 saved in thread <Thread(breed sparrow 739, started 123145573003264)>.
741 saved in thread <Thread(breed sparrow 741, started 123145599279104)>.
740 saved in thread <Thread(breed sparrow 740, started 123145588768768)>.
743 saved in thread <Thread(breed sparrow 743, started 123145583513600)>.742 saved in thread <Thread(breed sparrow 742, started 123145594023936)>.

745 saved in thread <Thread(breed sparrow 745, started 123145573003264)>.
744 saved in thread <Thread(breed sparrow 744, started 123145604534272)>.
746 saved in thread <Thread(breed sparrow 746, started 123145609789440)>.
747 saved in thread <Thread(breed sparrow 747, started 123145599279104)>.
749 saved in thread <Thread(breed sparrow 749, started 123145583513600)>.
748 saved in thread <Thread(breed sparrow 748, started 123145615044608)>.751 saved in thread <Thread(breed sparrow 751, started 123145594023936)>.

750 saved in thread <Thread(breed sparrow 750, started 123145588768768)>.
752 saved in thread <Thread(breed sparrow 752, started 123145573003264)>.
753 saved in thread <Thread(breed sparrow 753, started 123145620299776)>.
756 saved in thread <Thread(breed sparrow 756, started 123145583513600)>.755 saved in thread <Thread(breed sparrow 755, started 123145599279104)>.

759 saved in thread <Thread(breed sparrow 759, started 123145588768768)>.754 saved in thread <Thread(breed sparrow 754, started 123145604534272)>.

757 saved in thread <Thread(breed sparrow 757, started 123145609789440)>.
758 saved in thread <Thread(breed sparrow 758, started 123145594023936)>.
760 saved in thread <Thread(breed sparrow 760, started 123145573003264)>.761 saved in thread <Thread(breed sparrow 761, started 123145615044608)>.
762 saved in thread <Thread(breed sparrow 762, started 123145625554944)>.

764 saved in thread <Thread(breed sparrow 764, started 123145583513600)>.765 saved in thread <Thread(breed sparrow 765, started 123145588768768)>.763 saved in thread <Thread(breed sparrow 763, started 123145620299776)>.


766 saved in thread <Thread(breed sparrow 766, started 123145599279104)>.
767 saved in thread <Thread(breed sparrow 767, started 123145604534272)>.
768 saved in thread <Thread(breed sparrow 768, started 123145609789440)>.
771 saved in thread <Thread(breed sparrow 771, started 123145630810112)>.769 saved in thread <Thread(breed sparrow 769, started 123145594023936)>.

770 saved in thread <Thread(breed sparrow 770, started 123145615044608)>.772 saved in thread <Thread(breed sparrow 772, started 123145573003264)>.

773 saved in thread <Thread(breed sparrow 773, started 123145583513600)>.775 saved in thread <Thread(breed sparrow 775, started 123145599279104)>.

774 saved in thread <Thread(breed sparrow 774, started 123145588768768)>.776 saved in thread <Thread(breed sparrow 776, started 123145604534272)>.

777 saved in thread <Thread(breed sparrow 777, started 123145609789440)>.
778 saved in thread <Thread(breed sparrow 778, started 123145594023936)>.780 saved in thread <Thread(breed sparrow 780, started 123145625554944)>.

779 saved in thread <Thread(breed sparrow 779, started 123145620299776)>.
781 saved in thread <Thread(breed sparrow 781, started 123145573003264)>.
783 saved in thread <Thread(breed sparrow 783, started 123145583513600)>.785 saved in thread <Thread(breed sparrow 785, started 123145604534272)>.
782 saved in thread <Thread(breed sparrow 782, started 123145599279104)>.

787 saved in thread <Thread(breed sparrow 787, started 123145594023936)>.
784 saved in thread <Thread(breed sparrow 784, started 123145588768768)>.
786 saved in thread <Thread(breed sparrow 786, started 123145609789440)>.
788 saved in thread <Thread(breed sparrow 788, started 123145615044608)>.789 saved in thread <Thread(breed sparrow 789, started 123145573003264)>.
791 saved in thread <Thread(breed sparrow 791, started 123145583513600)>.

790 saved in thread <Thread(breed sparrow 790, started 123145620299776)>.
792 saved in thread <Thread(breed sparrow 792, started 123145594023936)>.793 saved in thread <Thread(breed sparrow 793, started 123145588768768)>.

796 saved in thread <Thread(breed sparrow 796, started 123145609789440)>.795 saved in thread <Thread(breed sparrow 795, started 123145604534272)>.794 saved in thread <Thread(breed sparrow 794, started 123145599279104)>.


797 saved in thread <Thread(breed sparrow 797, started 123145573003264)>.
799 saved in thread <Thread(breed sparrow 799, started 123145615044608)>.
798 saved in thread <Thread(breed sparrow 798, started 123145583513600)>.
800 saved in thread <Thread(breed sparrow 800, started 123145620299776)>.
801 saved in thread <Thread(breed sparrow 801, started 123145625554944)>.
802 saved in thread <Thread(breed sparrow 802, started 123145630810112)>.
803 saved in thread <Thread(breed sparrow 803, started 123145588768768)>.
804 saved in thread <Thread(breed sparrow 804, started 123145594023936)>.
805 saved in thread <Thread(breed sparrow 805, started 123145573003264)>.
806 saved in thread <Thread(breed sparrow 806, started 123145583513600)>.
807 saved in thread <Thread(breed sparrow 807, started 123145599279104)>.
808 saved in thread <Thread(breed sparrow 808, started 123145604534272)>.
809 saved in thread <Thread(breed sparrow 809, started 123145609789440)>.
810 saved in thread <Thread(breed sparrow 810, started 123145588768768)>.
811 saved in thread <Thread(breed sparrow 811, started 123145594023936)>.
812 saved in thread <Thread(breed sparrow 812, started 123145573003264)>.
813 saved in thread <Thread(breed sparrow 813, started 123145615044608)>.814 saved in thread <Thread(breed sparrow 814, started 123145583513600)>.

815 saved in thread <Thread(breed sparrow 815, started 123145599279104)>.
816 saved in thread <Thread(breed sparrow 816, started 123145620299776)>.
817 saved in thread <Thread(breed sparrow 817, started 123145604534272)>.
818 saved in thread <Thread(breed sparrow 818, started 123145609789440)>.
819 saved in thread <Thread(breed sparrow 819, started 123145588768768)>.
820 saved in thread <Thread(breed sparrow 820, started 123145573003264)>.
823 saved in thread <Thread(breed sparrow 823, started 123145599279104)>.
822 saved in thread <Thread(breed sparrow 822, started 123145594023936)>.
824 saved in thread <Thread(breed sparrow 824, started 123145604534272)>.
821 saved in thread <Thread(breed sparrow 821, started 123145583513600)>.
826 saved in thread <Thread(breed sparrow 826, started 123145588768768)>.
825 saved in thread <Thread(breed sparrow 825, started 123145609789440)>.
827 saved in thread <Thread(breed sparrow 827, started 123145615044608)>.
828 saved in thread <Thread(breed sparrow 828, started 123145620299776)>.
829 saved in thread <Thread(breed sparrow 829, started 123145573003264)>.830 saved in thread <Thread(breed sparrow 830, started 123145625554944)>.

832 saved in thread <Thread(breed sparrow 832, started 123145583513600)>.
833 saved in thread <Thread(breed sparrow 833, started 123145588768768)>.
831 saved in thread <Thread(breed sparrow 831, started 123145594023936)>.834 saved in thread <Thread(breed sparrow 834, started 123145599279104)>.

835 saved in thread <Thread(breed sparrow 835, started 123145604534272)>.
836 saved in thread <Thread(breed sparrow 836, started 123145609789440)>.
839 saved in thread <Thread(breed sparrow 839, started 123145573003264)>.838 saved in thread <Thread(breed sparrow 838, started 123145620299776)>.
837 saved in thread <Thread(breed sparrow 837, started 123145615044608)>.

840 saved in thread <Thread(breed sparrow 840, started 123145583513600)>.
841 saved in thread <Thread(breed sparrow 841, started 123145588768768)>.
842 saved in thread <Thread(breed sparrow 842, started 123145594023936)>.
843 saved in thread <Thread(breed sparrow 843, started 123145599279104)>.844 saved in thread <Thread(breed sparrow 844, started 123145604534272)>.

846 saved in thread <Thread(breed sparrow 846, started 123145573003264)>.
849 saved in thread <Thread(breed sparrow 849, started 123145588768768)>.845 saved in thread <Thread(breed sparrow 845, started 123145609789440)>.847 saved in thread <Thread(breed sparrow 847, started 123145615044608)>.


848 saved in thread <Thread(breed sparrow 848, started 123145583513600)>.
850 saved in thread <Thread(breed sparrow 850, started 123145594023936)>.
851 saved in thread <Thread(breed sparrow 851, started 123145599279104)>.
852 saved in thread <Thread(breed sparrow 852, started 123145604534272)>.
854 saved in thread <Thread(breed sparrow 854, started 123145573003264)>.
853 saved in thread <Thread(breed sparrow 853, started 123145620299776)>.
856 saved in thread <Thread(breed sparrow 856, started 123145588768768)>.
855 saved in thread <Thread(breed sparrow 855, started 123145625554944)>.
857 saved in thread <Thread(breed sparrow 857, started 123145583513600)>.859 saved in thread <Thread(breed sparrow 859, started 123145609789440)>.

858 saved in thread <Thread(breed sparrow 858, started 123145594023936)>.
860 saved in thread <Thread(breed sparrow 860, started 123145599279104)>.861 saved in thread <Thread(breed sparrow 861, started 123145604534272)>.
862 saved in thread <Thread(breed sparrow 862, started 123145573003264)>.863 saved in thread <Thread(breed sparrow 863, started 123145588768768)>.


865 saved in thread <Thread(breed sparrow 865, started 123145583513600)>.
864 saved in thread <Thread(breed sparrow 864, started 123145615044608)>.
868 saved in thread <Thread(breed sparrow 868, started 123145599279104)>.
867 saved in thread <Thread(breed sparrow 867, started 123145594023936)>.866 saved in thread <Thread(breed sparrow 866, started 123145609789440)>.

870 saved in thread <Thread(breed sparrow 870, started 123145573003264)>.
869 saved in thread <Thread(breed sparrow 869, started 123145588768768)>.872 saved in thread <Thread(breed sparrow 872, started 123145583513600)>.

871 saved in thread <Thread(breed sparrow 871, started 123145604534272)>.
873 saved in thread <Thread(breed sparrow 873, started 123145620299776)>.
875 saved in thread <Thread(breed sparrow 875, started 123145599279104)>.874 saved in thread <Thread(breed sparrow 874, started 123145615044608)>.

876 saved in thread <Thread(breed sparrow 876, started 123145594023936)>.
877 saved in thread <Thread(breed sparrow 877, started 123145609789440)>.878 saved in thread <Thread(breed sparrow 878, started 123145625554944)>.880 saved in thread <Thread(breed sparrow 880, started 123145583513600)>.


879 saved in thread <Thread(breed sparrow 879, started 123145573003264)>.
881 saved in thread <Thread(breed sparrow 881, started 123145588768768)>.
882 saved in thread <Thread(breed sparrow 882, started 123145604534272)>.
883 saved in thread <Thread(breed sparrow 883, started 123145594023936)>.
884 saved in thread <Thread(breed sparrow 884, started 123145599279104)>.
885 saved in thread <Thread(breed sparrow 885, started 123145615044608)>.
886 saved in thread <Thread(breed sparrow 886, started 123145583513600)>.
887 saved in thread <Thread(breed sparrow 887, started 123145573003264)>.
889 saved in thread <Thread(breed sparrow 889, started 123145604534272)>.
891 saved in thread <Thread(breed sparrow 891, started 123145620299776)>.890 saved in thread <Thread(breed sparrow 890, started 123145609789440)>.

888 saved in thread <Thread(breed sparrow 888, started 123145588768768)>.
892 saved in thread <Thread(breed sparrow 892, started 123145594023936)>.
894 saved in thread <Thread(breed sparrow 894, started 123145615044608)>.
893 saved in thread <Thread(breed sparrow 893, started 123145599279104)>.
895 saved in thread <Thread(breed sparrow 895, started 123145625554944)>.896 saved in thread <Thread(breed sparrow 896, started 123145573003264)>.899 saved in thread <Thread(breed sparrow 899, started 123145630810112)>.

897 saved in thread <Thread(breed sparrow 897, started 123145583513600)>.

898 saved in thread <Thread(breed sparrow 898, started 123145604534272)>.
900 saved in thread <Thread(breed sparrow 900, started 123145609789440)>.
903 saved in thread <Thread(breed sparrow 903, started 123145620299776)>.
902 saved in thread <Thread(breed sparrow 902, started 123145594023936)>.
901 saved in thread <Thread(breed sparrow 901, started 123145588768768)>.905 saved in thread <Thread(breed sparrow 905, started 123145615044608)>.

904 saved in thread <Thread(breed sparrow 904, started 123145599279104)>.906 saved in thread <Thread(breed sparrow 906, started 123145636065280)>.

907 saved in thread <Thread(breed sparrow 907, started 123145573003264)>.
908 saved in thread <Thread(breed sparrow 908, started 123145583513600)>.
909 saved in thread <Thread(breed sparrow 909, started 123145604534272)>.
911 saved in thread <Thread(breed sparrow 911, started 123145594023936)>.
910 saved in thread <Thread(breed sparrow 910, started 123145609789440)>.913 saved in thread <Thread(breed sparrow 913, started 123145615044608)>.

912 saved in thread <Thread(breed sparrow 912, started 123145588768768)>.
914 saved in thread <Thread(breed sparrow 914, started 123145599279104)>.
915 saved in thread <Thread(breed sparrow 915, started 123145620299776)>.916 saved in thread <Thread(breed sparrow 916, started 123145573003264)>.919 saved in thread <Thread(breed sparrow 919, started 123145604534272)>.


917 saved in thread <Thread(breed sparrow 917, started 123145583513600)>.
918 saved in thread <Thread(breed sparrow 918, started 123145594023936)>.921 saved in thread <Thread(breed sparrow 921, started 123145609789440)>.

920 saved in thread <Thread(breed sparrow 920, started 123145588768768)>.922 saved in thread <Thread(breed sparrow 922, started 123145599279104)>.

924 saved in thread <Thread(breed sparrow 924, started 123145625554944)>.923 saved in thread <Thread(breed sparrow 923, started 123145615044608)>.

925 saved in thread <Thread(breed sparrow 925, started 123145630810112)>.
926 saved in thread <Thread(breed sparrow 926, started 123145573003264)>.
927 saved in thread <Thread(breed sparrow 927, started 123145583513600)>.928 saved in thread <Thread(breed sparrow 928, started 123145604534272)>.

932 saved in thread <Thread(breed sparrow 932, started 123145609789440)>.930 saved in thread <Thread(breed sparrow 930, started 123145594023936)>.
929 saved in thread <Thread(breed sparrow 929, started 123145588768768)>.

931 saved in thread <Thread(breed sparrow 931, started 123145599279104)>.
933 saved in thread <Thread(breed sparrow 933, started 123145615044608)>.
934 saved in thread <Thread(breed sparrow 934, started 123145620299776)>.
935 saved in thread <Thread(breed sparrow 935, started 123145573003264)>.
936 saved in thread <Thread(breed sparrow 936, started 123145583513600)>.937 saved in thread <Thread(breed sparrow 937, started 123145588768768)>.

938 saved in thread <Thread(breed sparrow 938, started 123145594023936)>.
939 saved in thread <Thread(breed sparrow 939, started 123145599279104)>.940 saved in thread <Thread(breed sparrow 940, started 123145604534272)>.

941 saved in thread <Thread(breed sparrow 941, started 123145609789440)>.
943 saved in thread <Thread(breed sparrow 943, started 123145573003264)>.942 saved in thread <Thread(breed sparrow 942, started 123145615044608)>.

944 saved in thread <Thread(breed sparrow 944, started 123145588768768)>.
946 saved in thread <Thread(breed sparrow 946, started 123145594023936)>.945 saved in thread <Thread(breed sparrow 945, started 123145583513600)>.

947 saved in thread <Thread(breed sparrow 947, started 123145599279104)>.
948 saved in thread <Thread(breed sparrow 948, started 123145604534272)>.
949 saved in thread <Thread(breed sparrow 949, started 123145609789440)>.
951 saved in thread <Thread(breed sparrow 951, started 123145615044608)>.
950 saved in thread <Thread(breed sparrow 950, started 123145573003264)>.
952 saved in thread <Thread(breed sparrow 952, started 123145588768768)>.953 saved in thread <Thread(breed sparrow 953, started 123145583513600)>.

954 saved in thread <Thread(breed sparrow 954, started 123145594023936)>.
955 saved in thread <Thread(breed sparrow 955, started 123145599279104)>.
958 saved in thread <Thread(breed sparrow 958, started 123145609789440)>.
956 saved in thread <Thread(breed sparrow 956, started 123145604534272)>.
959 saved in thread <Thread(breed sparrow 959, started 123145615044608)>.
957 saved in thread <Thread(breed sparrow 957, started 123145620299776)>.
960 saved in thread <Thread(breed sparrow 960, started 123145573003264)>.
962 saved in thread <Thread(breed sparrow 962, started 123145588768768)>.
963 saved in thread <Thread(breed sparrow 963, started 123145594023936)>.
961 saved in thread <Thread(breed sparrow 961, started 123145583513600)>.
966 saved in thread <Thread(breed sparrow 966, started 123145609789440)>.964 saved in thread <Thread(breed sparrow 964, started 123145599279104)>.
967 saved in thread <Thread(breed sparrow 967, started 123145615044608)>.

968 saved in thread <Thread(breed sparrow 968, started 123145573003264)>.
969 saved in thread <Thread(breed sparrow 969, started 123145620299776)>.
965 saved in thread <Thread(breed sparrow 965, started 123145604534272)>.
970 saved in thread <Thread(breed sparrow 970, started 123145588768768)>.971 saved in thread <Thread(breed sparrow 971, started 123145625554944)>.

972 saved in thread <Thread(breed sparrow 972, started 123145594023936)>.
973 saved in thread <Thread(breed sparrow 973, started 123145583513600)>.
974 saved in thread <Thread(breed sparrow 974, started 123145609789440)>.
976 saved in thread <Thread(breed sparrow 976, started 123145615044608)>.
977 saved in thread <Thread(breed sparrow 977, started 123145573003264)>.978 saved in thread <Thread(breed sparrow 978, started 123145620299776)>.975 saved in thread <Thread(breed sparrow 975, started 123145599279104)>.


979 saved in thread <Thread(breed sparrow 979, started 123145604534272)>.
981 saved in thread <Thread(breed sparrow 981, started 123145625554944)>.980 saved in thread <Thread(breed sparrow 980, started 123145588768768)>.
982 saved in thread <Thread(breed sparrow 982, started 123145583513600)>.

983 saved in thread <Thread(breed sparrow 983, started 123145594023936)>.
984 saved in thread <Thread(breed sparrow 984, started 123145630810112)>.
985 saved in thread <Thread(breed sparrow 985, started 123145609789440)>.
987 saved in thread <Thread(breed sparrow 987, started 123145599279104)>.
986 saved in thread <Thread(breed sparrow 986, started 123145573003264)>.
989 saved in thread <Thread(breed sparrow 989, started 123145583513600)>.988 saved in thread <Thread(breed sparrow 988, started 123145604534272)>.
990 saved in thread <Thread(breed sparrow 990, started 123145588768768)>.

991 saved in thread <Thread(breed sparrow 991, started 123145594023936)>.992 saved in thread <Thread(breed sparrow 992, started 123145615044608)>.

993 saved in thread <Thread(breed sparrow 993, started 123145609789440)>.
995 saved in thread <Thread(breed sparrow 995, started 123145573003264)>.
996 saved in thread <Thread(breed sparrow 996, started 123145620299776)>.994 saved in thread <Thread(breed sparrow 994, started 123145599279104)>.

999 saved in thread <Thread(breed sparrow 999, started 123145604534272)>.998 saved in thread <Thread(breed sparrow 998, started 123145588768768)>.

997 saved in thread <Thread(breed sparrow 997, started 123145583513600)>.
CPU times: user 936 ms, sys: 453 ms, total: 1.39 s
Wall time: 1.01 s

Multiprocessing (using the separated memory for each process)

PyMongo is not fork-safe. Care must be taken when using instances of MongoClient with fork(). Specifically, instances of MongoClient must not be copied from a parent process to a child process. Instead, the parent process and each child process must create their own instances of MongoClient. Instances of MongoClient copied from the parent process have a high probability of deadlock in the child process due to the inherent incompatibilities between fork(), threads, and locks described below. PyMongo will attempt to issue a warning if there is a chance of this deadlock occurring. http://api.mongodb.com/python/current/faq.html#pymongo-fork-safe%3E


In [43]:
def breed2(tasks):
    db = Bird._db()  # create a MongoDB Client for the forked process
    try:
        for i in range(len(tasks)):
            sparrow = Bird({'_id': ObjectId(), 'name': f'sparrow', 'age': 0})
            sparrow.save(db=db)
            sparrow.age += 1
            sparrow.update(db=db)
    except Exception as e:
        print(f'Exception occured. {e} in process {multiprocessing.current_process()}')
    else:
        print(f'{len(tasks)} sparrow saved in process {multiprocessing.current_process()}.')

In [44]:
%%time
print(f'{multiprocessing.cpu_count()} cpu resources found.')
tasks = [[f'sparrow {i}' for i in range(250)] for j in range(4)]
process_pool = multiprocessing.Pool(4)
process_pool.map(breed2, tasks)


12 cpu resources found.
250 sparrow saved in process <ForkProcess(ForkPoolWorker-4, started daemon)>.
250 sparrow saved in process <ForkProcess(ForkPoolWorker-2, started daemon)>.
250 sparrow saved in process <ForkProcess(ForkPoolWorker-1, started daemon)>.
250 sparrow saved in process <ForkProcess(ForkPoolWorker-3, started daemon)>.
CPU times: user 11.9 ms, sys: 15.9 ms, total: 27.8 ms
Wall time: 286 ms