I hate doing tasks that are repetitive or that someone else should do but its a waste of my time. Earlier we used to store user and customer data on LDAP and there were all sort of BS requests from marketing like tell me "all customers that are on PlanY and are buy domain with >5 users". Problem is there were 40 ldaps and each one of these would require writing a custom script. Teaching other programmers ldap was not reasonable. One of my goals at my employer is to "Empower people to retrieve information themselves". I don’t want to be bottleneck in their chain of thoughts and they need not be bottleneck in what I want to do. I don’t want to involve humans if at all possible.
So when we migrated to Ldap->Mysql, first thing I did was consolidated 40 ldaps per data centre to 4 Mysql server per datacentre. I could have consolidated to 1 also but that would suffer from noisy neighbour issue. Problem is that there are 3 Data centres so in total 12 mysql servers. Still people would come to me for data just because I architected Ldap2Mysql. People need to understand that my job is to "Empower people by writing tools/frameworks so that they can do their job themselves".
Two weeks back I got a custom request where someone wanted all emails of all users in 11 thousand customer accounts. I was like its BS either I can give you all or I can give you none. It would waste 2-3 hours of my time if I had to do it. I even tried creating a SQL query with 11K domains in IN clause and Mysql would run it by python program to query 12 Mysql servers would bomb due to command line argument limitation. So I refused to do it and it was given to someone else in the team who would split the list into 1K domains and combine the CSV. But then I realized the issue for me was not splitting the result into 1K domains and constructing IN clause as that I can do programatically or in excel in 10-20 min. Problem to me was that my program was generating output as python tuple format so who would combine the 11 log files and do all that data scrubbing to generate final CSV.
Today again the developer attached to internal apps team was asked to produce a list of all admin users of all customers who want to recieve our newsletter. The developer sent email to me that I should do it. I was like wth its not my job, the marketing team should hire someone with SQL skills to do it and I can give him pointers on how to retrieve information. Problem is that today one more developer whom I can delegate was on medical leave so the thing came back to me. I had to go to my son's school in 20 min so I was in time crunch. I thought I have everything, I have a program that given a template query would execute it on all Mysql databases and print it in tuple format and this is a common requirement that they want it in CSV so why not change program to do both.
within 5 min I changed code like this
for row in pc_db_conn.execute(query):
print row
to
for row in pc_db_conn.execute(query):
print row
#I know this is BS and I should use csv module but this is internal shit
csv_file.write(','.join(['"'+str(s)+'"' for s in row]))
csv_file.write('\n')
and tada the job was done. Now it seems for this kind of queries I eliminated the need for that developer. So I eliminated a human for one more task and this gave me a programming epiphany for the day.
I was whole day battling with newrelic, appdynamics and vivid cortex to find performance anomalies but this 5 min change gave me more joy than other things I found using those tools.
This blog post is dedicated to a fellow developer who once asked me how do I came up with all these ideas. So just trying to describe the thought process of eliminating myself from doing grunt work forces me to think these things.
So when we migrated to Ldap->Mysql, first thing I did was consolidated 40 ldaps per data centre to 4 Mysql server per datacentre. I could have consolidated to 1 also but that would suffer from noisy neighbour issue. Problem is that there are 3 Data centres so in total 12 mysql servers. Still people would come to me for data just because I architected Ldap2Mysql. People need to understand that my job is to "Empower people by writing tools/frameworks so that they can do their job themselves".
Two weeks back I got a custom request where someone wanted all emails of all users in 11 thousand customer accounts. I was like its BS either I can give you all or I can give you none. It would waste 2-3 hours of my time if I had to do it. I even tried creating a SQL query with 11K domains in IN clause and Mysql would run it by python program to query 12 Mysql servers would bomb due to command line argument limitation. So I refused to do it and it was given to someone else in the team who would split the list into 1K domains and combine the CSV. But then I realized the issue for me was not splitting the result into 1K domains and constructing IN clause as that I can do programatically or in excel in 10-20 min. Problem to me was that my program was generating output as python tuple format so who would combine the 11 log files and do all that data scrubbing to generate final CSV.
Today again the developer attached to internal apps team was asked to produce a list of all admin users of all customers who want to recieve our newsletter. The developer sent email to me that I should do it. I was like wth its not my job, the marketing team should hire someone with SQL skills to do it and I can give him pointers on how to retrieve information. Problem is that today one more developer whom I can delegate was on medical leave so the thing came back to me. I had to go to my son's school in 20 min so I was in time crunch. I thought I have everything, I have a program that given a template query would execute it on all Mysql databases and print it in tuple format and this is a common requirement that they want it in CSV so why not change program to do both.
within 5 min I changed code like this
for row in pc_db_conn.execute(query):
print row
to
for row in pc_db_conn.execute(query):
print row
#I know this is BS and I should use csv module but this is internal shit
csv_file.write(','.join(['"'+str(s)+'"' for s in row]))
csv_file.write('\n')
and tada the job was done. Now it seems for this kind of queries I eliminated the need for that developer. So I eliminated a human for one more task and this gave me a programming epiphany for the day.
I was whole day battling with newrelic, appdynamics and vivid cortex to find performance anomalies but this 5 min change gave me more joy than other things I found using those tools.
This blog post is dedicated to a fellow developer who once asked me how do I came up with all these ideas. So just trying to describe the thought process of eliminating myself from doing grunt work forces me to think these things.
Comments
Post a Comment