def handle(self, *args, **options): print "start..." site = options["site"] user_name = options["user"] try: # 更新用户油品类型缓存 delete_by_key_from_cache("%s_user_fuel_types_dict" % user_name) update_station_fuel_types_from_fact_trans(site_name=site) except Exception, e: print e
def handle(self, *args, **options): try: #all_user=User.objects.all() create_session = get_dash_session_maker() s = create_session() sql=select([User.name]).select_from(User.__table__) rs=s.execute(sql) all_user=rs.fetchall() s.close() for user in all_user: sql_utils.update_station_fuel_types_from_fact_trans(user.name) except Exception, e: print >> sys.stderr, "Exception: ", str(e)