-
Notifications
You must be signed in to change notification settings - Fork 1
/
job_queue.py
40 lines (33 loc) · 979 Bytes
/
job_queue.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# -*- coding: utf-8 -*-
#!/usr/bin/env python
"""
File d'attente persistante.
Requires Python 2.7
"""
# Copyright (C) 2011 by
# Sébastien Heymann <[email protected]>
# All rights reserved.
# BSD license.
from queue import PersistantQueue
class JobQueue(PersistantQueue):
"""
File d'attente persistante des jobs de crawl.
"""
__lock__ = "job_queue.lock"
__dir__ = "job_queue"
if __name__ == "__main__":
U = ["a", "a", "b", "c", "d", "e"]
V = ["http://twitter.com/mentatseb", "http://twitter.com/Gephi", "http://twitter.com/mathieubastian", "fail", "\"#!\""]
queue = JobQueue()
queue.put("twitter.com/jacomyal")
for element in V:
if not queue.isLocked():
queue.put(element)
if not queue.isLocked():
print queue.get()
print queue.get()
print queue.get()
print queue.get()
print queue.get()
print queue.get()
print queue.get()