Skip to content

Commit b6c49d1

Browse files
committed
sort
1 parent 3ce1e5d commit b6c49d1

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

scripts/generateChart.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ while true
33
do
44
python ~/test1.py map2 "G40沪陕高速(上海高东收费口->崇明陈家镇收费口)路况 更新时间:"
55
sleep 900
6-
#python ~/test1.py map3 "G40沪陕高速(崇明陈家镇收费口->上海高东收费口)路况 更新时间:"
7-
#sleep 900
6+
python ~/test1.py map3 "G40沪陕高速(崇明陈家镇收费口->上海高东收费口)路况 更新时间:"
7+
sleep 900
88
done

test1.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from datetime import datetime
55
from pymongo import MongoClient
66
from pymongo.errors import ConnectionFailure
7-
#from send import h1
7+
import pymongo
88
import pandas as pd
99
import plotly.plotly as py
1010
import plotly.graph_objs as go
@@ -24,7 +24,7 @@ def save2rabbitmq(doc):
2424
def save2mongo(dbname,collection,doc):
2525
try:
2626
hostname = os.getenv('HOSTNAME')
27-
hostname = 'x'
27+
# hostname = 'x'
2828
if hostname:
2929
c = MongoClient("mongodb://db1:user1@ds155684.mlab.com:55684/baidu")
3030
print("cloud")
@@ -55,10 +55,7 @@ def findlast2day(dbname, collection, title):
5555
sys.exit(1)
5656
dbh = c[dbname]
5757
c = dbh[collection].count() - 288*2
58-
z = dbh[collection].find(skip=c)
59-
#z = dbh[collection].find({'dt': '2017-10-08 01:22:38'}).limit(1)
60-
61-
#z = dbh[collection].find({'dt': {'$gte':'2017-10-08 01:22:38'}}).limit(2)
58+
z = dbh[collection].find(skip=c).sort("dt", pymongo.ASCENDING)
6259

6360
list1 = []
6461
list2 = []

0 commit comments

Comments
 (0)