-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodal_gfs.py
38 lines (24 loc) · 1.05 KB
/
modal_gfs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Everything till the `=======` is required to work, though it can be customized.
from datetime import timedelta
import modal
from modal_app import applib, driver
from src.lib import WriteMode, utcnow
from src.lib_modal import MODAL_FUNCTION_KWARGS
app = modal.App("gfs-forecast-ingest")
app.include(applib) # necessary
# =======
@app.function(**MODAL_FUNCTION_KWARGS, timeout=3600, schedule=modal.Cron("30 0,6,12,18 * * *"))
def gfs_update_solar():
driver(mode=WriteMode.UPDATE, toml_file_path="src/configs/gfs.toml")
# @app.function(**MODAL_FUNCTION_KWARGS, timeout=3600, schedule=modal.Cron("30 * * * *"))
# def gfs_verify_solar():
# driver(mode=ReadMode.VERIFY, toml_file_path="src/configs/gfs.toml")
@app.function(**MODAL_FUNCTION_KWARGS, timeout=3600)
def gfs_backfill():
file = "src/configs/gfs.toml"
since = utcnow() - timedelta(days=3)
till = utcnow() - timedelta(days=1, hours=12)
driver(mode=WriteMode.BACKFILL, toml_file_path=file, since=since, till=till)
@app.local_entrypoint()
def main():
gfs_update_solar.remote()