|
@@ -11,7 +11,7 @@ from time import strftime,time
|
|
|
|
|
|
|
|
from multiprocessing import Pool
|
|
from multiprocessing import Pool
|
|
|
import sys
|
|
import sys
|
|
|
-from analytics import post
|
|
|
|
|
|
|
+from analytics import post_data
|
|
|
|
|
|
|
|
|
|
|
|
|
def parseSource(s):
|
|
def parseSource(s):
|
|
@@ -108,7 +108,7 @@ def news_worker(source, kw, d, q):
|
|
|
|
|
|
|
|
# TODO influx start
|
|
# TODO influx start
|
|
|
|
|
|
|
|
-post('start', {}, 1)
|
|
|
|
|
|
|
+post_data('start', {}, 1)
|
|
|
start = time()
|
|
start = time()
|
|
|
sources = db().sources()
|
|
sources = db().sources()
|
|
|
db().purge_error()
|
|
db().purge_error()
|
|
@@ -117,8 +117,8 @@ ret = pool.map(parseSource, sources)
|
|
|
new = sum([r[3] for r in ret])
|
|
new = sum([r[3] for r in ret])
|
|
|
tot = sum([r[1] for r in ret])
|
|
tot = sum([r[1] for r in ret])
|
|
|
|
|
|
|
|
-post('new', {}, new)
|
|
|
|
|
-post('total', {}, tot)
|
|
|
|
|
|
|
+post_data('new', {}, new)
|
|
|
|
|
+post_data('total', {}, tot)
|
|
|
# TODO influx source new
|
|
# TODO influx source new
|
|
|
# TODO influx source total
|
|
# TODO influx source total
|
|
|
# n = sum(ret)
|
|
# n = sum(ret)
|
|
@@ -129,4 +129,4 @@ print("[%s] %d/%d new articles, total time %d sec" %
|
|
|
(strftime("%H:%M:%S"), new, tot, time()-start))
|
|
(strftime("%H:%M:%S"), new, tot, time()-start))
|
|
|
print("#" * 75)
|
|
print("#" * 75)
|
|
|
# TODO influx end
|
|
# TODO influx end
|
|
|
-post('start', {}, 0)
|
|
|
|
|
|
|
+post_data('start', {}, 0)
|