Skip to content

Instantly share code, notes, and snippets.

@vitillo
Last active August 19, 2016 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vitillo/f1129de59ae649e23220583113493ea8 to your computer and use it in GitHub Desktop.
Save vitillo/f1129de59ae649e23220583113493ea8 to your computer and use it in GitHub Desktop.
activePlugins is not an array
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# coding: utf-8
# In[1]:
from moztelemetry import get_pings
get_ipython().magic(u'pylab inline')
# In[2]:
pings = get_pings(sc, app="Firefox", channel="nightly", submission_date="20160718")
# In[3]:
def get_active_plugins(x):
try:
return x["environment"]["addons"]["activePlugins"]
except:
return []
# In[4]:
print pings.map(get_active_plugins).filter(lambda x: not isinstance(x, list)).first()
# In[5]:
print pings.map(get_active_plugins).map(lambda x: (isinstance(x, list), 1)).countByKey()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment