Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
|
@@ -100,6 +100,21 @@ def update_google_sheet():
|
|
| 100 |
})
|
| 101 |
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
| 102 |
print(f"Google sheet {name} successfully updated at {timestamp}! \n{global_df}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
print(f"------------------------------------------------------------------------")
|
| 104 |
except Exception as e:
|
| 105 |
print(f"on_message Error: {e}")
|
|
@@ -107,7 +122,7 @@ def update_google_sheet():
|
|
| 107 |
|
| 108 |
executor = ThreadPoolExecutor(max_workers=1)
|
| 109 |
scheduler = BackgroundScheduler(executors={'default': executor})
|
| 110 |
-
scheduler.add_job(update_google_sheet, trigger='interval', minutes=
|
| 111 |
scheduler.start()
|
| 112 |
|
| 113 |
|
|
|
|
| 100 |
})
|
| 101 |
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
| 102 |
print(f"Google sheet {name} successfully updated at {timestamp}! \n{global_df}")
|
| 103 |
+
|
| 104 |
+
await asyncio.sleep(2)
|
| 105 |
+
|
| 106 |
+
name2 = "hf_discord_verified_users_test"
|
| 107 |
+
# could just do this / format
|
| 108 |
+
set_with_dataframe(worksheet2, worksheet2_df)
|
| 109 |
+
# very important, otherwise gspread will force format IDs in scientific notation by default (making them unusable)
|
| 110 |
+
worksheet2.format(f"E1:E{len(worksheet2_df.index)+1}", {
|
| 111 |
+
"numberFormat": {
|
| 112 |
+
"type": 'TEXT',
|
| 113 |
+
},
|
| 114 |
+
})
|
| 115 |
+
|
| 116 |
+
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
| 117 |
+
print(f"Google sheet {name2} successfully updated at {timestamp}!")
|
| 118 |
print(f"------------------------------------------------------------------------")
|
| 119 |
except Exception as e:
|
| 120 |
print(f"on_message Error: {e}")
|
|
|
|
| 122 |
|
| 123 |
executor = ThreadPoolExecutor(max_workers=1)
|
| 124 |
scheduler = BackgroundScheduler(executors={'default': executor})
|
| 125 |
+
scheduler.add_job(update_google_sheet, trigger='interval', minutes=3, max_instances=1)
|
| 126 |
scheduler.start()
|
| 127 |
|
| 128 |
|