Created
June 1, 2011 11:20
-
-
Save jamii/1002135 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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