Kushal Das4

FOSS and life. Kushal Das talks here.

My talk in MSF, India

Last week I gave a talk on Free and Open Source Software in the Metal and Steel factory, Indian Ordinance Factories, Ishapore, India. I met Mr. Amartya Talukdar, a well known activist and blogger from Kolkata in the blogger’s meet. He currently manages the I.T. team in the above mentioned place and he arranged the talk to spread more awareness about FOSS.

I reached the main gate an hour before the talk. The securities came around to ask me why I was standing there in the road. I was sure this is going to happen again. I went into the factory along with Mr. Talukdar, at least three times the securities stopped me while the guns were ready. They also took my mobile phone, I left my camera back at home for the same reason.

I met the I.T. Department and few developers who work there, before the talk. Around 9:40am we moved to the big conference room for my talk. The talk started with Mr. Talukdar giving a small introduction. I was not sure how many technical people will attend the talk, so it was less technical and more on demo side. The room was almost full within few minutes, and I hope that my introductions to FOSS, Fedora, and Python went well. I was carrying a few Python docs with me and few other Fedora stickers. In the talk I spent most of time demoing various tools which can increase productivity of the management by using the right tools. We saw reStructuredText, rst2pdf and Sphinx for managing documents. We also looked into version control systems and how we can use them. We talked a bit about Owncloud, but without network, I could not demo. I also demoed various small Python scripts I use, to keep my life simple. I learned about various FOSS tools they are already using. They use Linux in the servers, my biggest suggestion was about using Linux in the desktops too. Viruses are always a common problem which can easily be eliminated with Linux on the desktops.

My talk ended around 12pm. After lunch, while walking back to the factory Mr. Talukdar showed me various historical places and items from Dutch and British colony days. Of course there were again the securities while going out and coming in.

We spent next few hours discussing various technology and workflow related queries with the Jt. General Manager Mr. Neeraj Agrawal. It was very nice to see that he is updated with all the latest news and information from the FOSS and technology world. We really need more people like him who are open to new ideas and capable of managing both the worlds. In future we will be doing a few workshops targeting the needs of the developers of the factory.

Job/Task queue quick tutorial using retask

Here is one quick tutorial of Job/Task queue using retask

You need to first install retask & redis-py from pypi.

$ pip install retask redis

Then start the redis server (if it is not already running, in my case I installed it from Fedora package repository).

service redis start

In out producer code we will create tasks to get current stock values of few companies. The workers will get the company symbols, then they will fetch the value and pass to the producer.

from retask.task import Task from retask.queue import Queue

import time
queue = Queue(‘sharevalue’)
symbols = [‘AAPL’, ‘ORCL’, ‘MSFT’]
jobs = []
for sym in symbols:
    info = {‘name’: sym}
    task = Task(info)

print [job.result for job in jobs if job.wait()]

Here we have a list of symbols and creating tasks based on them, as they are getting enqueued, a Job object is returned for each one of them.

In the workers we will use requests, so let us install it first.

$ pip install requests

then the actual worker code

import requests
from retask.queue import Queue

queue = Queue(‘sharevalue’) queue.connect() while True: task = queue.wait() print “Received %s” % task.data[‘name’] url = ‘http://download.finance.yahoo.com/d/quotes.csv?s=%s&f=l1' % task.data[‘name’] r = requests.get(url) queue.send(task, r.content.strip())

Here we wait for new tasks in the queue. After getting a new task, we find the latest share value and then return it to the producer. Please go through the documentation for more examples.