Skip to content

Instantly share code, notes, and snippets.

@jamii
Created June 1, 2011 11:20
Show Gist options
  • Select an option

  • Save jamii/1002135 to your computer and use it in GitHub Desktop.

Select an option

Save jamii/1002135 to your computer and use it in GitHub Desktop.
from disco.core import Job
from disco.worker.classic.func import chain_reader
import datetime
class Download(object):
def __init__(self, id, doi, date, ip):
self.id = id
self.doi = doi
self.date = datetime.date(int(date[0:4]), int(date[5:7]), int(date[8:10]))
self.ip = ip
class ParseDownloads(Job):
map_reader = staticmethod(chain_reader)
@staticmethod
def map(line, params):
[id, doi, date, ip] = line.split('\t')
yield id, Download(id, doi, date, ip)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment