Skip to content

Instantly share code, notes, and snippets.

asaasa
def _index_children(self, company_id, contacts_map):
children_map = defaultdict(list)
for contact_id, contact in contacts_map.items():
children_map[contact_id].extend(self._child_extender.process(contact))
failed, children_ids = self._put_children(company_id, children_map)
# find old and new contacts children in es
es_child_ids = self._search_all_child_docs(company_id, contacts_map.keys()).ids
# we take all contacts and subtract those contacts that were updated
es_remove_child_ids = set(es_child_ids).difference(children_ids)
self._remove_child_docs_by_ids(es_remove_child_ids)
def _index_children(self, company_id, contacts_map):
children_map = defaultdict(list)
for contact_id, contact in contacts_map.items():
children_map[contact_id].extend(self._child_extender.process(contact))
failed, children_ids = self._put_children(company_id, children_map)
# find old and new contacts children in es
es_child_ids = self._search_all_child_docs(company_id, contacts_map.keys()).ids
# we take all contacts and subtract those contacts that were updated
es_remove_child_ids = set(es_child_ids).difference(children_ids)
self._remove_child_docs_by_ids(es_remove_child_ids)
they are: [[u'LinkedIN', u'linkedin']]
they are: [[u'Linkedin', u'linkedin'], [u'facebook', u'Facebook']]
they are: [[u'google', u'Google'], [u'zac', u'Zac'], [u'CEE', u'cee'], [u'Justin', u'justin'], [u'Mac', u'mac'], [u'Materials', u'materials']]
they are: [[u'twitter', u'Twitter'], [u'Linkedin', u'linkedin']]
they are: [[u'Dunbar', u'dunbar']]
they are: [[u'norfolk', u'Norfolk', u'NOrfolk'], [u'p', u'P'], [u'ian lowe', u'IAN LOWE'], [u'ASMC - Fairfield', u'asmc - Fairfield'], [u'Claire', u'claire'], [u'Doncaster', u'doncaster'], [u'january', u'January'], [u'database philippe', u'Database Philippe'], [u'mason', u'Mason'], [u'Month - September', u'month - September'], [u'anti bullying', u'Anti Bullying'], [u'july', u'July'], [u'Brekk', u'brekk'], [u'Bedfordshire', u'bedfordshire'], [u'WAyne telesales 14/10/2015', u'wayne telesales 14/10/2015'], [u'show - MSMO', u'Show - MSMO'], [u'Wedding', u'wedding'], [u'Magician', u'magician'], [u'Masons', u'masons'], [u'Eugene Matthias', u'eugene matthias'], [u'steve kem
@serj-p
serj-p / complexity of multifield mapping
Created December 18, 2013 15:55
complexity of multifield mapping
def F_DEFAULT_MULTIFIELD_MAPPING_IN_ALL(f_name):
return {
"fields": {
f_name: ANALYZED_FIELD_MAPPING_IN_ALL,
'na': NA_MAPPING
},
"type": "multi_field",
"include_in_all": True
}
└ (develop)[ $ devtools/release twitter_api_limits
Pulling latest updates from remote origin
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:9sEJf8SwcobMYGu0dKOnYWnX9xTHDV8mnHmB2d7QUhs.
interpretation( 2, [number=1, seconds=0], [
function(c1, [ 0 ]),
function(g(_), [ 0, 0 ]),
function(f(_,_), [
1, 1,
0, 1 ]),
import itertools
class Valuation(object):
def __init__(self, literals):
self.literals = literals
self._vals = list(itertools.product([True, False], repeat=len(literals)))
def __iter__(self):
for arr in self._vals:
@serj-p
serj-p / gist:4047633
Created November 9, 2012 19:18
about tasks live
<14>1 2012-11-09T12:48:08.000000Z ip-10-253-0-26 contacts_rest_api 13469 MSGID13524652884394083 [default path="/mnt/nimble/src/nimble_search/nimble_search/es.py:149" role="app" service="contacts_rest_api" levelname="INFO" funcName="delay"] Task 'Index documents to ElasticSearch' ['dd9bfce7-4799-42e6-825e-2d5b02e9f216'] was sent to broker
<14>1 2012-11-09T15:04:42.000000Z ip-10-244-7-130 celeryd 22360 MSGID13524734822921806 [default path="/mnt/nimble/eggs/celery-3.0.9nimble-py2.7.egg/celery/worker/consumer.py:487" role="taskbroker" service="celeryd" levelname="INFO" funcName="on_task"] Got task from broker: Index documents to ElasticSearch[dd9bfce7-4799-42e6-825e-2d5b02e9f216]
<14>1 2012-11-09T15:05:00.000000Z ip-10-244-7-130 <string> 22375 MSGID1352473500363040 [default path="/mnt/nimble/src/nimble_search/nimble_search/es.py:136" role="taskbroker" service="<string>" levelname="INFO" funcName="retry"] Task 'Index documents to ElasticSearch' ['dd9bfce7-4799-42e6-825e-2d5b02e9f216'] was started
<14>1 2012-11-
@serj-p
serj-p / gist:3903012
Created October 17, 2012 00:31
hot_threads
This file has been truncated, but you can view the full file.
::: [Cassiopea][7mMpd-vGRGKArz6HeVshZQ][inet[/10.248.106.117:9300]]
0,0% (0s out of 2s) cpu usage by thread 'Reference Handler'
10/10 snapshots sharing following 3 elements
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:485)
java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
0,0% (0s out of 2s) cpu usage by thread 'Finalizer'
10/10 snapshots sharing following 4 elements