def get_prediction_and_save(many_mins=15):
  stations = getStations()
  prediction_list = []
  for station in stations:
    prediction_list.append(make_prediction(station, int(many_mins)))

  lock.acquire()
  try: 
    cache[many_mins] = prediction_list
    pickle.dump(cache, open("cache.p", "wb") )
  finally:
    lock.release()
Пример #2
0
def get_prediction_and_save(many_mins=15):
    stations = getStations()
    prediction_list = []
    for station in stations:
        prediction_list.append(make_prediction(station, int(many_mins)))

    lock.acquire()
    try:
        cache[many_mins] = prediction_list
        pickle.dump(cache, open("cache.p", "wb"))
    finally:
        lock.release()
Пример #3
0
def predict(station_id, many_mins):
  stations = getStations()
  return jsonify(make_prediction(stations[int(station_id)], int(many_mins)))
Пример #4
0
def predict(station_id, many_mins):
    stations = getStations()
    return jsonify(make_prediction(stations[int(station_id)], int(many_mins)))