Useful python – Class based decorators and context managers

useful-python

There are many things why Pyhton is my standard go-to language if it comes to implement something. It’s either a website, automation, data-mining or complex calculation Python excels in most of it. I decided to write some of my favourite things which just makes things cleaner and easier to implement.

Continue reading

Solr Stats component is available in sunburnt

Stats

StatsComponent is now available with stats function in the suburnt Solr python client library.

More info: http://wiki.apache.org/solr/StatsComponent

Example:

For the source code go to my github repo: https://github.com/charlesnagy/sunburnt

Solr dynamic field with data importer

solr

I’m managing a Solr installation which holds products for an e-commerce site. Lately a new feature was introduced. Namely, every product type can have specific dynamic attributes which is configurable on the Type level. For example monitor types have resolution, size, etc. while processor types have clock frequency, socket, L2 … Continue reading

Flashcache stats collector for Diamond / Graphite

I have upgraded the LVM collector in my StorageCollector repository on github (https://github.com/charlesnagy/Diamond-StorageCollectors) to match the new directory structure of Diamond and added support to collect flashcache metrics.

Installation

Move the flashcache directory to your collectors directory which should exist on /usr/local/share/diamond/collectors or /usr/share/diamond/collectors path depending on your installation.

Continue reading

Difference between DISTINCT and GROUP BY

Today we had an interesting situation where the same query was executed significantly slower when it was written with GROUP BY instead of DISTINCT and I saw many people still had the assumption that these two types of queries are actually equivalent which is simply not true. Although DISTINCT queries … Continue reading

The four phases of learning

Unawareness

Life long learning? I hate this expression but kind of expresses the importance of learning. Why? Because nowdays (especially on the field of IT) if you’re not progressing you’re regressing. There’s no middle way, no stagnation. Years are passing while you may be getting comfortable and years later you … Continue reading

Dataimport handler for Sunburnt Solr python library

Dataimport handler

I had to trigger the dataimporter delta-import command from the code so I added support for this function.

Example:

Following properties are available in the SolrImportStatus (_response.import_status) object:

Source code can be found on my github page:  Continue reading