flyte 0.2.0b1__py3-none-any.whl → 2.0.0b46__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. flyte/__init__.py +83 -30
  2. flyte/_bin/connect.py +61 -0
  3. flyte/_bin/debug.py +38 -0
  4. flyte/_bin/runtime.py +87 -19
  5. flyte/_bin/serve.py +351 -0
  6. flyte/_build.py +3 -2
  7. flyte/_cache/cache.py +6 -5
  8. flyte/_cache/local_cache.py +216 -0
  9. flyte/_code_bundle/_ignore.py +31 -5
  10. flyte/_code_bundle/_packaging.py +42 -11
  11. flyte/_code_bundle/_utils.py +57 -34
  12. flyte/_code_bundle/bundle.py +130 -27
  13. flyte/_constants.py +1 -0
  14. flyte/_context.py +21 -5
  15. flyte/_custom_context.py +73 -0
  16. flyte/_debug/constants.py +37 -0
  17. flyte/_debug/utils.py +17 -0
  18. flyte/_debug/vscode.py +315 -0
  19. flyte/_deploy.py +396 -75
  20. flyte/_deployer.py +109 -0
  21. flyte/_environment.py +94 -11
  22. flyte/_excepthook.py +37 -0
  23. flyte/_group.py +2 -1
  24. flyte/_hash.py +1 -16
  25. flyte/_image.py +544 -231
  26. flyte/_initialize.py +456 -316
  27. flyte/_interface.py +40 -5
  28. flyte/_internal/controllers/__init__.py +22 -8
  29. flyte/_internal/controllers/_local_controller.py +159 -35
  30. flyte/_internal/controllers/_trace.py +18 -10
  31. flyte/_internal/controllers/remote/__init__.py +38 -9
  32. flyte/_internal/controllers/remote/_action.py +82 -12
  33. flyte/_internal/controllers/remote/_client.py +6 -2
  34. flyte/_internal/controllers/remote/_controller.py +290 -64
  35. flyte/_internal/controllers/remote/_core.py +155 -95
  36. flyte/_internal/controllers/remote/_informer.py +40 -20
  37. flyte/_internal/controllers/remote/_service_protocol.py +2 -2
  38. flyte/_internal/imagebuild/__init__.py +2 -10
  39. flyte/_internal/imagebuild/docker_builder.py +391 -84
  40. flyte/_internal/imagebuild/image_builder.py +111 -55
  41. flyte/_internal/imagebuild/remote_builder.py +409 -0
  42. flyte/_internal/imagebuild/utils.py +79 -0
  43. flyte/_internal/resolvers/_app_env_module.py +92 -0
  44. flyte/_internal/resolvers/_task_module.py +5 -38
  45. flyte/_internal/resolvers/app_env.py +26 -0
  46. flyte/_internal/resolvers/common.py +8 -1
  47. flyte/_internal/resolvers/default.py +2 -2
  48. flyte/_internal/runtime/convert.py +319 -36
  49. flyte/_internal/runtime/entrypoints.py +106 -18
  50. flyte/_internal/runtime/io.py +71 -23
  51. flyte/_internal/runtime/resources_serde.py +21 -7
  52. flyte/_internal/runtime/reuse.py +125 -0
  53. flyte/_internal/runtime/rusty.py +196 -0
  54. flyte/_internal/runtime/task_serde.py +239 -66
  55. flyte/_internal/runtime/taskrunner.py +48 -8
  56. flyte/_internal/runtime/trigger_serde.py +162 -0
  57. flyte/_internal/runtime/types_serde.py +7 -16
  58. flyte/_keyring/file.py +115 -0
  59. flyte/_link.py +30 -0
  60. flyte/_logging.py +241 -42
  61. flyte/_map.py +312 -0
  62. flyte/_metrics.py +59 -0
  63. flyte/_module.py +74 -0
  64. flyte/_pod.py +30 -0
  65. flyte/_resources.py +296 -33
  66. flyte/_retry.py +1 -7
  67. flyte/_reusable_environment.py +72 -7
  68. flyte/_run.py +462 -132
  69. flyte/_secret.py +47 -11
  70. flyte/_serve.py +333 -0
  71. flyte/_task.py +245 -56
  72. flyte/_task_environment.py +219 -97
  73. flyte/_task_plugins.py +47 -0
  74. flyte/_tools.py +8 -8
  75. flyte/_trace.py +15 -24
  76. flyte/_trigger.py +1027 -0
  77. flyte/_utils/__init__.py +12 -1
  78. flyte/_utils/asyn.py +3 -1
  79. flyte/_utils/async_cache.py +139 -0
  80. flyte/_utils/coro_management.py +5 -4
  81. flyte/_utils/description_parser.py +19 -0
  82. flyte/_utils/docker_credentials.py +173 -0
  83. flyte/_utils/helpers.py +45 -19
  84. flyte/_utils/module_loader.py +123 -0
  85. flyte/_utils/org_discovery.py +57 -0
  86. flyte/_utils/uv_script_parser.py +8 -1
  87. flyte/_version.py +16 -3
  88. flyte/app/__init__.py +27 -0
  89. flyte/app/_app_environment.py +362 -0
  90. flyte/app/_connector_environment.py +40 -0
  91. flyte/app/_deploy.py +130 -0
  92. flyte/app/_parameter.py +343 -0
  93. flyte/app/_runtime/__init__.py +3 -0
  94. flyte/app/_runtime/app_serde.py +383 -0
  95. flyte/app/_types.py +113 -0
  96. flyte/app/extras/__init__.py +9 -0
  97. flyte/app/extras/_auth_middleware.py +217 -0
  98. flyte/app/extras/_fastapi.py +93 -0
  99. flyte/app/extras/_model_loader/__init__.py +3 -0
  100. flyte/app/extras/_model_loader/config.py +7 -0
  101. flyte/app/extras/_model_loader/loader.py +288 -0
  102. flyte/cli/__init__.py +12 -0
  103. flyte/cli/_abort.py +28 -0
  104. flyte/cli/_build.py +114 -0
  105. flyte/cli/_common.py +493 -0
  106. flyte/cli/_create.py +371 -0
  107. flyte/cli/_delete.py +45 -0
  108. flyte/cli/_deploy.py +401 -0
  109. flyte/cli/_gen.py +316 -0
  110. flyte/cli/_get.py +446 -0
  111. flyte/cli/_option.py +33 -0
  112. flyte/{_cli → cli}/_params.py +57 -17
  113. flyte/cli/_plugins.py +209 -0
  114. flyte/cli/_prefetch.py +292 -0
  115. flyte/cli/_run.py +690 -0
  116. flyte/cli/_serve.py +338 -0
  117. flyte/cli/_update.py +86 -0
  118. flyte/cli/_user.py +20 -0
  119. flyte/cli/main.py +246 -0
  120. flyte/config/__init__.py +2 -167
  121. flyte/config/_config.py +215 -163
  122. flyte/config/_internal.py +10 -1
  123. flyte/config/_reader.py +225 -0
  124. flyte/connectors/__init__.py +11 -0
  125. flyte/connectors/_connector.py +330 -0
  126. flyte/connectors/_server.py +194 -0
  127. flyte/connectors/utils.py +159 -0
  128. flyte/errors.py +134 -2
  129. flyte/extend.py +24 -0
  130. flyte/extras/_container.py +69 -56
  131. flyte/git/__init__.py +3 -0
  132. flyte/git/_config.py +279 -0
  133. flyte/io/__init__.py +8 -1
  134. flyte/io/{structured_dataset → _dataframe}/__init__.py +32 -30
  135. flyte/io/{structured_dataset → _dataframe}/basic_dfs.py +75 -68
  136. flyte/io/{structured_dataset/structured_dataset.py → _dataframe/dataframe.py} +207 -242
  137. flyte/io/_dir.py +575 -113
  138. flyte/io/_file.py +587 -141
  139. flyte/io/_hashing_io.py +342 -0
  140. flyte/io/extend.py +7 -0
  141. flyte/models.py +635 -0
  142. flyte/prefetch/__init__.py +22 -0
  143. flyte/prefetch/_hf_model.py +563 -0
  144. flyte/remote/__init__.py +14 -3
  145. flyte/remote/_action.py +879 -0
  146. flyte/remote/_app.py +346 -0
  147. flyte/remote/_auth_metadata.py +42 -0
  148. flyte/remote/_client/_protocols.py +62 -4
  149. flyte/remote/_client/auth/_auth_utils.py +19 -0
  150. flyte/remote/_client/auth/_authenticators/base.py +8 -2
  151. flyte/remote/_client/auth/_authenticators/device_code.py +4 -5
  152. flyte/remote/_client/auth/_authenticators/factory.py +4 -0
  153. flyte/remote/_client/auth/_authenticators/passthrough.py +79 -0
  154. flyte/remote/_client/auth/_authenticators/pkce.py +17 -18
  155. flyte/remote/_client/auth/_channel.py +47 -18
  156. flyte/remote/_client/auth/_client_config.py +5 -3
  157. flyte/remote/_client/auth/_keyring.py +15 -2
  158. flyte/remote/_client/auth/_token_client.py +3 -3
  159. flyte/remote/_client/controlplane.py +206 -18
  160. flyte/remote/_common.py +66 -0
  161. flyte/remote/_data.py +107 -22
  162. flyte/remote/_logs.py +116 -33
  163. flyte/remote/_project.py +21 -19
  164. flyte/remote/_run.py +164 -631
  165. flyte/remote/_secret.py +72 -29
  166. flyte/remote/_task.py +387 -46
  167. flyte/remote/_trigger.py +368 -0
  168. flyte/remote/_user.py +43 -0
  169. flyte/report/_report.py +10 -6
  170. flyte/storage/__init__.py +13 -1
  171. flyte/storage/_config.py +237 -0
  172. flyte/storage/_parallel_reader.py +289 -0
  173. flyte/storage/_storage.py +268 -59
  174. flyte/syncify/__init__.py +56 -0
  175. flyte/syncify/_api.py +414 -0
  176. flyte/types/__init__.py +39 -0
  177. flyte/types/_interface.py +22 -7
  178. flyte/{io/pickle/transformer.py → types/_pickle.py} +37 -9
  179. flyte/types/_string_literals.py +8 -9
  180. flyte/types/_type_engine.py +226 -126
  181. flyte/types/_utils.py +1 -1
  182. flyte-2.0.0b46.data/scripts/debug.py +38 -0
  183. flyte-2.0.0b46.data/scripts/runtime.py +194 -0
  184. flyte-2.0.0b46.dist-info/METADATA +352 -0
  185. flyte-2.0.0b46.dist-info/RECORD +221 -0
  186. flyte-2.0.0b46.dist-info/entry_points.txt +8 -0
  187. flyte-2.0.0b46.dist-info/licenses/LICENSE +201 -0
  188. flyte/_api_commons.py +0 -3
  189. flyte/_cli/_common.py +0 -299
  190. flyte/_cli/_create.py +0 -42
  191. flyte/_cli/_delete.py +0 -23
  192. flyte/_cli/_deploy.py +0 -140
  193. flyte/_cli/_get.py +0 -235
  194. flyte/_cli/_run.py +0 -174
  195. flyte/_cli/main.py +0 -98
  196. flyte/_datastructures.py +0 -342
  197. flyte/_internal/controllers/pbhash.py +0 -39
  198. flyte/_protos/common/authorization_pb2.py +0 -66
  199. flyte/_protos/common/authorization_pb2.pyi +0 -108
  200. flyte/_protos/common/authorization_pb2_grpc.py +0 -4
  201. flyte/_protos/common/identifier_pb2.py +0 -71
  202. flyte/_protos/common/identifier_pb2.pyi +0 -82
  203. flyte/_protos/common/identifier_pb2_grpc.py +0 -4
  204. flyte/_protos/common/identity_pb2.py +0 -48
  205. flyte/_protos/common/identity_pb2.pyi +0 -72
  206. flyte/_protos/common/identity_pb2_grpc.py +0 -4
  207. flyte/_protos/common/list_pb2.py +0 -36
  208. flyte/_protos/common/list_pb2.pyi +0 -69
  209. flyte/_protos/common/list_pb2_grpc.py +0 -4
  210. flyte/_protos/common/policy_pb2.py +0 -37
  211. flyte/_protos/common/policy_pb2.pyi +0 -27
  212. flyte/_protos/common/policy_pb2_grpc.py +0 -4
  213. flyte/_protos/common/role_pb2.py +0 -37
  214. flyte/_protos/common/role_pb2.pyi +0 -53
  215. flyte/_protos/common/role_pb2_grpc.py +0 -4
  216. flyte/_protos/common/runtime_version_pb2.py +0 -28
  217. flyte/_protos/common/runtime_version_pb2.pyi +0 -24
  218. flyte/_protos/common/runtime_version_pb2_grpc.py +0 -4
  219. flyte/_protos/logs/dataplane/payload_pb2.py +0 -96
  220. flyte/_protos/logs/dataplane/payload_pb2.pyi +0 -168
  221. flyte/_protos/logs/dataplane/payload_pb2_grpc.py +0 -4
  222. flyte/_protos/secret/definition_pb2.py +0 -49
  223. flyte/_protos/secret/definition_pb2.pyi +0 -93
  224. flyte/_protos/secret/definition_pb2_grpc.py +0 -4
  225. flyte/_protos/secret/payload_pb2.py +0 -62
  226. flyte/_protos/secret/payload_pb2.pyi +0 -94
  227. flyte/_protos/secret/payload_pb2_grpc.py +0 -4
  228. flyte/_protos/secret/secret_pb2.py +0 -38
  229. flyte/_protos/secret/secret_pb2.pyi +0 -6
  230. flyte/_protos/secret/secret_pb2_grpc.py +0 -198
  231. flyte/_protos/secret/secret_pb2_grpc_grpc.py +0 -198
  232. flyte/_protos/validate/validate/validate_pb2.py +0 -76
  233. flyte/_protos/workflow/node_execution_service_pb2.py +0 -26
  234. flyte/_protos/workflow/node_execution_service_pb2.pyi +0 -4
  235. flyte/_protos/workflow/node_execution_service_pb2_grpc.py +0 -32
  236. flyte/_protos/workflow/queue_service_pb2.py +0 -106
  237. flyte/_protos/workflow/queue_service_pb2.pyi +0 -141
  238. flyte/_protos/workflow/queue_service_pb2_grpc.py +0 -172
  239. flyte/_protos/workflow/run_definition_pb2.py +0 -128
  240. flyte/_protos/workflow/run_definition_pb2.pyi +0 -310
  241. flyte/_protos/workflow/run_definition_pb2_grpc.py +0 -4
  242. flyte/_protos/workflow/run_logs_service_pb2.py +0 -41
  243. flyte/_protos/workflow/run_logs_service_pb2.pyi +0 -28
  244. flyte/_protos/workflow/run_logs_service_pb2_grpc.py +0 -69
  245. flyte/_protos/workflow/run_service_pb2.py +0 -133
  246. flyte/_protos/workflow/run_service_pb2.pyi +0 -175
  247. flyte/_protos/workflow/run_service_pb2_grpc.py +0 -412
  248. flyte/_protos/workflow/state_service_pb2.py +0 -58
  249. flyte/_protos/workflow/state_service_pb2.pyi +0 -71
  250. flyte/_protos/workflow/state_service_pb2_grpc.py +0 -138
  251. flyte/_protos/workflow/task_definition_pb2.py +0 -72
  252. flyte/_protos/workflow/task_definition_pb2.pyi +0 -65
  253. flyte/_protos/workflow/task_definition_pb2_grpc.py +0 -4
  254. flyte/_protos/workflow/task_service_pb2.py +0 -44
  255. flyte/_protos/workflow/task_service_pb2.pyi +0 -31
  256. flyte/_protos/workflow/task_service_pb2_grpc.py +0 -104
  257. flyte/io/_dataframe.py +0 -0
  258. flyte/io/pickle/__init__.py +0 -0
  259. flyte/remote/_console.py +0 -18
  260. flyte-0.2.0b1.dist-info/METADATA +0 -179
  261. flyte-0.2.0b1.dist-info/RECORD +0 -204
  262. flyte-0.2.0b1.dist-info/entry_points.txt +0 -3
  263. /flyte/{_cli → _debug}/__init__.py +0 -0
  264. /flyte/{_protos → _keyring}/__init__.py +0 -0
  265. {flyte-0.2.0b1.dist-info → flyte-2.0.0b46.dist-info}/WHEEL +0 -0
  266. {flyte-0.2.0b1.dist-info → flyte-2.0.0b46.dist-info}/top_level.txt +0 -0
flyte/_trigger.py ADDED
@@ -0,0 +1,1027 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from datetime import datetime
5
+ from typing import Any, Dict, Literal, Mapping, Union
6
+
7
+ import rich.repr
8
+
9
+ Timezone = Literal[
10
+ "Etc/GMT-5",
11
+ "Europe/London",
12
+ "America/Martinique",
13
+ "Asia/Sakhalin",
14
+ "Europe/Podgorica",
15
+ "America/Grand_Turk",
16
+ "America/Dawson_Creek",
17
+ "Africa/Asmera",
18
+ "Canada/Newfoundland",
19
+ "CST6CDT",
20
+ "ROC",
21
+ "Asia/Taipei",
22
+ "America/Danmarkshavn",
23
+ "Asia/Yakutsk",
24
+ "America/Catamarca",
25
+ "Asia/Gaza",
26
+ "America/Chihuahua",
27
+ "Africa/Lusaka",
28
+ "Atlantic/Azores",
29
+ "Canada/Atlantic",
30
+ "Africa/Abidjan",
31
+ "America/Port-au-Prince",
32
+ "Pacific/Noumea",
33
+ "Asia/Barnaul",
34
+ "Europe/Bucharest",
35
+ "Asia/Samarkand",
36
+ "Africa/Bangui",
37
+ "America/Yakutat",
38
+ "Africa/Porto-Novo",
39
+ "Etc/GMT+12",
40
+ "America/Fortaleza",
41
+ "Australia/Brisbane",
42
+ "America/Goose_Bay",
43
+ "America/Nassau",
44
+ "Arctic/Longyearbyen",
45
+ "Asia/Kolkata",
46
+ "Indian/Mayotte",
47
+ "Asia/Tel_Aviv",
48
+ "America/Cambridge_Bay",
49
+ "Africa/Nouakchott",
50
+ "Australia/North",
51
+ "Europe/Tirane",
52
+ "America/Ensenada",
53
+ "Asia/Rangoon",
54
+ "Pacific/Kanton",
55
+ "Africa/Tunis",
56
+ "Europe/Kyiv",
57
+ "America/Halifax",
58
+ "Europe/Guernsey",
59
+ "America/Cancun",
60
+ "Canada/Saskatchewan",
61
+ "Europe/Helsinki",
62
+ "Pacific/Norfolk",
63
+ "Chile/Continental",
64
+ "Eire",
65
+ "Africa/Mogadishu",
66
+ "Pacific/Midway",
67
+ "Etc/GMT-1",
68
+ "Etc/UTC",
69
+ "America/Argentina/San_Luis",
70
+ "Europe/Gibraltar",
71
+ "GMT+0",
72
+ "HST",
73
+ "America/Kentucky/Louisville",
74
+ "US/Alaska",
75
+ "Africa/Addis_Ababa",
76
+ "America/Costa_Rica",
77
+ "Pacific/Rarotonga",
78
+ "America/Matamoros",
79
+ "Europe/Vienna",
80
+ "America/Vancouver",
81
+ "Mexico/BajaNorte",
82
+ "America/Merida",
83
+ "Pacific/Efate",
84
+ "America/La_Paz",
85
+ "Pacific/Marquesas",
86
+ "America/Manaus",
87
+ "Antarctica/South_Pole",
88
+ "Pacific/Easter",
89
+ "Europe/Mariehamn",
90
+ "Atlantic/Madeira",
91
+ "Pacific/Bougainville",
92
+ "Antarctica/Syowa",
93
+ "America/Montevideo",
94
+ "Africa/Khartoum",
95
+ "America/St_Thomas",
96
+ "Africa/Mbabane",
97
+ "America/Campo_Grande",
98
+ "Australia/Queensland",
99
+ "Asia/Damascus",
100
+ "Etc/Universal",
101
+ "Asia/Amman",
102
+ "Europe/Samara",
103
+ "Australia/Tasmania",
104
+ "Africa/Douala",
105
+ "Indian/Antananarivo",
106
+ "Canada/Eastern",
107
+ "America/Argentina/Rio_Gallegos",
108
+ "Pacific/Samoa",
109
+ "Australia/Canberra",
110
+ "Australia/Sydney",
111
+ "Atlantic/Faeroe",
112
+ "Asia/Ust-Nera",
113
+ "Pacific/Palau",
114
+ "Africa/Kinshasa",
115
+ "Asia/Makassar",
116
+ "Asia/Hebron",
117
+ "ROK",
118
+ "America/St_Vincent",
119
+ "America/Argentina/Buenos_Aires",
120
+ "Africa/Asmara",
121
+ "Indian/Mahe",
122
+ "America/Dawson",
123
+ "Europe/Lisbon",
124
+ "Pacific/Pago_Pago",
125
+ "Brazil/West",
126
+ "America/Santarem",
127
+ "America/Virgin",
128
+ "America/Indianapolis",
129
+ "Asia/Bangkok",
130
+ "America/Indiana/Marengo",
131
+ "Atlantic/St_Helena",
132
+ "Europe/Moscow",
133
+ "Europe/Istanbul",
134
+ "Asia/Famagusta",
135
+ "Asia/Chongqing",
136
+ "America/Cuiaba",
137
+ "America/Detroit",
138
+ "America/Swift_Current",
139
+ "Greenwich",
140
+ "Antarctica/Davis",
141
+ "Africa/Conakry",
142
+ "America/Asuncion",
143
+ "Asia/Hovd",
144
+ "Africa/Freetown",
145
+ "America/Bahia_Banderas",
146
+ "Etc/GMT+6",
147
+ "Indian/Chagos",
148
+ "Pacific/Kiritimati",
149
+ "America/Toronto",
150
+ "EET",
151
+ "Indian/Cocos",
152
+ "America/Caracas",
153
+ "America/Indiana/Knox",
154
+ "America/Indiana/Winamac",
155
+ "Asia/Katmandu",
156
+ "America/Dominica",
157
+ "Asia/Hong_Kong",
158
+ "GMT0",
159
+ "Atlantic/Faroe",
160
+ "US/Michigan",
161
+ "UCT",
162
+ "Etc/GMT-9",
163
+ "America/Cordoba",
164
+ "Etc/GMT",
165
+ "Chile/EasterIsland",
166
+ "America/Resolute",
167
+ "America/Juneau",
168
+ "Europe/Chisinau",
169
+ "Africa/Djibouti",
170
+ "Antarctica/Vostok",
171
+ "Europe/Ulyanovsk",
172
+ "US/Hawaii",
173
+ "Africa/Juba",
174
+ "America/Chicago",
175
+ "America/Boa_Vista",
176
+ "Antarctica/DumontDUrville",
177
+ "Brazil/East",
178
+ "Mexico/BajaSur",
179
+ "Africa/Lubumbashi",
180
+ "America/Anguilla",
181
+ "Etc/GMT-13",
182
+ "Canada/Central",
183
+ "Europe/Busingen",
184
+ "America/Ciudad_Juarez",
185
+ "America/Edmonton",
186
+ "Atlantic/South_Georgia",
187
+ "America/Anchorage",
188
+ "America/Rosario",
189
+ "America/Araguaina",
190
+ "Asia/Shanghai",
191
+ "America/Tijuana",
192
+ "America/Cayenne",
193
+ "America/Regina",
194
+ "Australia/NSW",
195
+ "America/Santa_Isabel",
196
+ "Indian/Comoro",
197
+ "Europe/San_Marino",
198
+ "WET",
199
+ "Poland",
200
+ "US/Indiana-Starke",
201
+ "Asia/Saigon",
202
+ "Africa/Ceuta",
203
+ "Pacific/Niue",
204
+ "Australia/Darwin",
205
+ "Asia/Yekaterinburg",
206
+ "Pacific/Chuuk",
207
+ "Asia/Kathmandu",
208
+ "Asia/Almaty",
209
+ "America/Miquelon",
210
+ "Asia/Choibalsan",
211
+ "Australia/Melbourne",
212
+ "America/Managua",
213
+ "Portugal",
214
+ "Iceland",
215
+ "Africa/Malabo",
216
+ "America/North_Dakota/Center",
217
+ "Asia/Macau",
218
+ "EST5EDT",
219
+ "America/Louisville",
220
+ "America/Fort_Nelson",
221
+ "Europe/Amsterdam",
222
+ "America/Rio_Branco",
223
+ "Etc/GMT0",
224
+ "America/Thule",
225
+ "Pacific/Fakaofo",
226
+ "Africa/Bujumbura",
227
+ "Asia/Baku",
228
+ "Etc/GMT+8",
229
+ "Etc/GMT+10",
230
+ "America/Argentina/Tucuman",
231
+ "Africa/Lagos",
232
+ "Europe/Paris",
233
+ "Indian/Christmas",
234
+ "Asia/Qatar",
235
+ "Australia/ACT",
236
+ "Asia/Pyongyang",
237
+ "America/North_Dakota/Beulah",
238
+ "Factory",
239
+ "Europe/Copenhagen",
240
+ "Pacific/Fiji",
241
+ "America/Lower_Princes",
242
+ "Antarctica/Macquarie",
243
+ "America/Punta_Arenas",
244
+ "Antarctica/Rothera",
245
+ "America/Montserrat",
246
+ "Etc/GMT+0",
247
+ "NZ",
248
+ "America/Argentina/La_Rioja",
249
+ "America/Argentina/Catamarca",
250
+ "Antarctica/Troll",
251
+ "Europe/Vatican",
252
+ "Cuba",
253
+ "Africa/Windhoek",
254
+ "America/Havana",
255
+ "Asia/Atyrau",
256
+ "Australia/Eucla",
257
+ "America/Guatemala",
258
+ "US/Mountain",
259
+ "Europe/Saratov",
260
+ "Asia/Jakarta",
261
+ "US/Aleutian",
262
+ "Asia/Thimphu",
263
+ "Pacific/Enderbury",
264
+ "Africa/Luanda",
265
+ "Europe/Kirov",
266
+ "Pacific/Tongatapu",
267
+ "Africa/Sao_Tome",
268
+ "Africa/El_Aaiun",
269
+ "Iran",
270
+ "America/Godthab",
271
+ "MST7MDT",
272
+ "Europe/Sofia",
273
+ "America/Thunder_Bay",
274
+ "Australia/South",
275
+ "America/Tegucigalpa",
276
+ "Africa/Monrovia",
277
+ "Egypt",
278
+ "America/Scoresbysund",
279
+ "Singapore",
280
+ "Etc/GMT-7",
281
+ "Africa/Lome",
282
+ "America/Metlakatla",
283
+ "Asia/Singapore",
284
+ "Pacific/Chatham",
285
+ "America/Paramaribo",
286
+ "Asia/Ulaanbaatar",
287
+ "Antarctica/Mawson",
288
+ "Australia/Yancowinna",
289
+ "GMT-0",
290
+ "America/Belize",
291
+ "Asia/Magadan",
292
+ "America/Fort_Wayne",
293
+ "Pacific/Nauru",
294
+ "Europe/Warsaw",
295
+ "Asia/Muscat",
296
+ "Europe/Sarajevo",
297
+ "Etc/GMT-2",
298
+ "Africa/Gaborone",
299
+ "Africa/Bamako",
300
+ "Asia/Qyzylorda",
301
+ "GB",
302
+ "Etc/GMT+2",
303
+ "America/Lima",
304
+ "Asia/Omsk",
305
+ "Kwajalein",
306
+ "Asia/Tokyo",
307
+ "America/Inuvik",
308
+ "Asia/Tashkent",
309
+ "Jamaica",
310
+ "America/Argentina/ComodRivadavia",
311
+ "Africa/Algiers",
312
+ "Africa/Harare",
313
+ "America/Argentina/San_Juan",
314
+ "Pacific/Guam",
315
+ "Europe/Astrakhan",
316
+ "Africa/Nairobi",
317
+ "US/Arizona",
318
+ "EST",
319
+ "Australia/Hobart",
320
+ "America/Kentucky/Monticello",
321
+ "Asia/Urumqi",
322
+ "Etc/GMT-14",
323
+ "Pacific/Johnston",
324
+ "Etc/Zulu",
325
+ "Asia/Ashgabat",
326
+ "Atlantic/Jan_Mayen",
327
+ "America/Aruba",
328
+ "America/Argentina/Jujuy",
329
+ "Etc/Greenwich",
330
+ "America/St_Lucia",
331
+ "Australia/Currie",
332
+ "Asia/Jerusalem",
333
+ "America/Atka",
334
+ "America/St_Kitts",
335
+ "America/El_Salvador",
336
+ "Europe/Riga",
337
+ "US/Central",
338
+ "Etc/GMT+3",
339
+ "America/Montreal",
340
+ "Australia/Lord_Howe",
341
+ "W-SU",
342
+ "America/Noronha",
343
+ "Canada/Mountain",
344
+ "America/Indiana/Vincennes",
345
+ "Europe/Simferopol",
346
+ "Pacific/Gambier",
347
+ "Africa/Tripoli",
348
+ "Asia/Novosibirsk",
349
+ "Navajo",
350
+ "Asia/Harbin",
351
+ "America/Rankin_Inlet",
352
+ "Asia/Kuching",
353
+ "America/Argentina/Salta",
354
+ "Europe/Bratislava",
355
+ "America/Glace_Bay",
356
+ "America/Argentina/Mendoza",
357
+ "Asia/Tomsk",
358
+ "America/Nipigon",
359
+ "Asia/Pontianak",
360
+ "Australia/Perth",
361
+ "Indian/Reunion",
362
+ "Europe/Uzhgorod",
363
+ "Europe/Athens",
364
+ "Brazil/DeNoronha",
365
+ "Zulu",
366
+ "Asia/Qostanay",
367
+ "Europe/Malta",
368
+ "Indian/Maldives",
369
+ "Asia/Jayapura",
370
+ "America/Denver",
371
+ "Atlantic/Reykjavik",
372
+ "Australia/West",
373
+ "America/Phoenix",
374
+ "Europe/Volgograd",
375
+ "Asia/Kamchatka",
376
+ "America/Kralendijk",
377
+ "America/Creston",
378
+ "Africa/Dakar",
379
+ "Europe/Andorra",
380
+ "Europe/Madrid",
381
+ "Japan",
382
+ "Pacific/Kosrae",
383
+ "GMT",
384
+ "America/Maceio",
385
+ "America/Porto_Acre",
386
+ "Asia/Ho_Chi_Minh",
387
+ "Asia/Kashgar",
388
+ "US/Samoa",
389
+ "Africa/Banjul",
390
+ "Asia/Anadyr",
391
+ "Etc/GMT-6",
392
+ "Pacific/Truk",
393
+ "America/Winnipeg",
394
+ "Africa/Ndjamena",
395
+ "Africa/Bissau",
396
+ "Asia/Baghdad",
397
+ "Israel",
398
+ "America/Guadeloupe",
399
+ "America/Buenos_Aires",
400
+ "America/Adak",
401
+ "Asia/Vladivostok",
402
+ "Pacific/Tarawa",
403
+ "Antarctica/Casey",
404
+ "Antarctica/Palmer",
405
+ "Asia/Irkutsk",
406
+ "Asia/Colombo",
407
+ "America/Port_of_Spain",
408
+ "America/North_Dakota/New_Salem",
409
+ "Europe/Dublin",
410
+ "Pacific/Ponape",
411
+ "America/Boise",
412
+ "Pacific/Yap",
413
+ "America/Whitehorse",
414
+ "PRC",
415
+ "Australia/Adelaide",
416
+ "America/Indiana/Vevay",
417
+ "Europe/Berlin",
418
+ "America/Recife",
419
+ "Europe/Oslo",
420
+ "Turkey",
421
+ "Europe/Luxembourg",
422
+ "Europe/Zagreb",
423
+ "America/Grenada",
424
+ "Africa/Blantyre",
425
+ "Asia/Tbilisi",
426
+ "America/Coyhaique",
427
+ "Pacific/Apia",
428
+ "Africa/Niamey",
429
+ "America/Guyana",
430
+ "Asia/Yerevan",
431
+ "Pacific/Honolulu",
432
+ "America/Hermosillo",
433
+ "Asia/Macao",
434
+ "Europe/Belfast",
435
+ "America/Indiana/Tell_City",
436
+ "Asia/Dushanbe",
437
+ "Asia/Novokuznetsk",
438
+ "Africa/Maseru",
439
+ "Pacific/Funafuti",
440
+ "Antarctica/McMurdo",
441
+ "America/Menominee",
442
+ "NZ-CHAT",
443
+ "MET",
444
+ "Asia/Dhaka",
445
+ "America/Jujuy",
446
+ "Europe/Vaduz",
447
+ "Europe/Budapest",
448
+ "Asia/Kuwait",
449
+ "Africa/Maputo",
450
+ "Asia/Aqtau",
451
+ "Europe/Belgrade",
452
+ "Africa/Ouagadougou",
453
+ "America/Puerto_Rico",
454
+ "Europe/Vilnius",
455
+ "Asia/Chita",
456
+ "America/Yellowknife",
457
+ "America/Ojinaga",
458
+ "America/Shiprock",
459
+ "America/Bahia",
460
+ "America/Tortola",
461
+ "America/Antigua",
462
+ "Etc/GMT+11",
463
+ "Atlantic/Bermuda",
464
+ "Asia/Khandyga",
465
+ "US/Pacific",
466
+ "Asia/Nicosia",
467
+ "Etc/GMT-3",
468
+ "Asia/Kabul",
469
+ "America/St_Johns",
470
+ "Etc/GMT+5",
471
+ "Asia/Dubai",
472
+ "Pacific/Galapagos",
473
+ "Etc/GMT-0",
474
+ "America/Indiana/Petersburg",
475
+ "America/Blanc-Sablon",
476
+ "Etc/GMT-10",
477
+ "Pacific/Tahiti",
478
+ "America/Argentina/Cordoba",
479
+ "Europe/Tiraspol",
480
+ "America/Pangnirtung",
481
+ "Africa/Casablanca",
482
+ "Brazil/Acre",
483
+ "Pacific/Pitcairn",
484
+ "Europe/Ljubljana",
485
+ "Africa/Cairo",
486
+ "America/Nuuk",
487
+ "Asia/Chungking",
488
+ "Africa/Dar_es_Salaam",
489
+ "Asia/Bahrain",
490
+ "Etc/GMT-12",
491
+ "Asia/Krasnoyarsk",
492
+ "US/East-Indiana",
493
+ "Europe/Minsk",
494
+ "Asia/Dili",
495
+ "Etc/GMT+7",
496
+ "Asia/Seoul",
497
+ "Asia/Yangon",
498
+ "Europe/Zurich",
499
+ "America/Knox_IN",
500
+ "Atlantic/Cape_Verde",
501
+ "Asia/Ashkhabad",
502
+ "Pacific/Port_Moresby",
503
+ "Europe/Prague",
504
+ "Africa/Kampala",
505
+ "America/Belem",
506
+ "Asia/Vientiane",
507
+ "America/Moncton",
508
+ "Europe/Monaco",
509
+ "America/Mazatlan",
510
+ "Africa/Brazzaville",
511
+ "America/Marigot",
512
+ "Asia/Dacca",
513
+ "Etc/GMT-11",
514
+ "Atlantic/Stanley",
515
+ "Asia/Kuala_Lumpur",
516
+ "Hongkong",
517
+ "Asia/Manila",
518
+ "America/Santiago",
519
+ "Indian/Mauritius",
520
+ "Europe/Brussels",
521
+ "Europe/Isle_of_Man",
522
+ "Australia/Broken_Hill",
523
+ "Asia/Brunei",
524
+ "Europe/Zaporozhye",
525
+ "America/New_York",
526
+ "Asia/Tehran",
527
+ "America/Panama",
528
+ "Africa/Libreville",
529
+ "America/Santo_Domingo",
530
+ "Pacific/Wake",
531
+ "Pacific/Auckland",
532
+ "America/Argentina/Ushuaia",
533
+ "Asia/Aden",
534
+ "Africa/Timbuktu",
535
+ "Asia/Bishkek",
536
+ "Etc/GMT+1",
537
+ "Pacific/Pohnpei",
538
+ "America/Sao_Paulo",
539
+ "US/Eastern",
540
+ "Europe/Nicosia",
541
+ "Pacific/Kwajalein",
542
+ "America/Iqaluit",
543
+ "America/Cayman",
544
+ "America/Monterrey",
545
+ "America/Guayaquil",
546
+ "America/Nome",
547
+ "America/Barbados",
548
+ "Pacific/Majuro",
549
+ "Etc/GMT-8",
550
+ "Asia/Phnom_Penh",
551
+ "America/Rainy_River",
552
+ "America/Indiana/Indianapolis",
553
+ "America/Atikokan",
554
+ "America/St_Barthelemy",
555
+ "PST8PDT",
556
+ "Universal",
557
+ "Indian/Kerguelen",
558
+ "Etc/UCT",
559
+ "Australia/LHI",
560
+ "Europe/Stockholm",
561
+ "Asia/Ujung_Pandang",
562
+ "America/Los_Angeles",
563
+ "Asia/Riyadh",
564
+ "America/Curacao",
565
+ "Africa/Johannesburg",
566
+ "Etc/GMT+4",
567
+ "Canada/Yukon",
568
+ "GB-Eire",
569
+ "Asia/Karachi",
570
+ "America/Mendoza",
571
+ "Australia/Victoria",
572
+ "America/Jamaica",
573
+ "Australia/Lindeman",
574
+ "Asia/Srednekolymsk",
575
+ "America/Bogota",
576
+ "Asia/Beirut",
577
+ "Asia/Calcutta",
578
+ "MST",
579
+ "Europe/Jersey",
580
+ "Etc/GMT+9",
581
+ "Asia/Ulan_Bator",
582
+ "Europe/Rome",
583
+ "Pacific/Wallis",
584
+ "Etc/GMT-4",
585
+ "Libya",
586
+ "UTC",
587
+ "Asia/Thimbu",
588
+ "Canada/Pacific",
589
+ "Africa/Kigali",
590
+ "America/Eirunepe",
591
+ "Europe/Kaliningrad",
592
+ "Atlantic/Canary",
593
+ "America/Mexico_City",
594
+ "Europe/Kiev",
595
+ "CET",
596
+ "Europe/Skopje",
597
+ "Pacific/Saipan",
598
+ "America/Sitka",
599
+ "Africa/Accra",
600
+ "Asia/Aqtobe",
601
+ "Asia/Oral",
602
+ "Pacific/Guadalcanal",
603
+ "Asia/Istanbul",
604
+ "America/Porto_Velho",
605
+ "America/Coral_Harbour",
606
+ "Mexico/General",
607
+ "Europe/Tallinn",
608
+ ]
609
+
610
+
611
+ class _trigger_time:
612
+ """
613
+ This class represents the actual time of Trigger, which can be bound to any task input.
614
+ """
615
+
616
+
617
+ TriggerTime = _trigger_time()
618
+
619
+
620
+ @rich.repr.auto
621
+ @dataclass(frozen=True)
622
+ class Cron:
623
+ """
624
+ This class defines a Cron automation that can be associated with a Trigger in Flyte.
625
+ Example usage:
626
+ ```python
627
+ my_trigger = flyte.Trigger(
628
+ name="my_cron_trigger",
629
+ automation=flyte.Cron("0 * * * *"), # Runs every hour
630
+ description="A trigger that runs every hour",
631
+ )
632
+ ```
633
+
634
+ :param expression: (str) String cron expression to trigger - Example: "* * * * *"
635
+ :param timezone: (str literal) One of Timezone values.
636
+ """
637
+
638
+ expression: str
639
+ timezone: Timezone = "UTC"
640
+
641
+ @property
642
+ def timezone_expression(self) -> str:
643
+ return f"CRON_TZ={self.timezone} {self.expression}"
644
+
645
+ def __str__(self):
646
+ return f"Cron Trigger: {self.timezone_expression}"
647
+
648
+
649
+ @rich.repr.auto
650
+ @dataclass(frozen=True)
651
+ class FixedRate:
652
+ """
653
+ This class defines a FixedRate automation that can be associated with a Trigger in Flyte.
654
+
655
+ Example usage:
656
+ ```python
657
+ my_trigger = flyte.Trigger(
658
+ name="my_fixed_rate_trigger",
659
+ automation=flyte.FixedRate(60), # Runs every hour
660
+ description="A trigger that runs every hour",
661
+ )
662
+ ```
663
+
664
+ :param interval_minutes: (int) Interval to schedule the trigger in minutes.
665
+ :param start_time: (datetime) Start time of the trigger. This will enable starting a trigger with fixed rate as
666
+ of this time.
667
+ """
668
+
669
+ interval_minutes: int
670
+ start_time: datetime | None = None
671
+
672
+ def __str__(self):
673
+ return f"FixedRate Trigger: every {self.interval_minutes} minutes"
674
+
675
+
676
+ @rich.repr.auto
677
+ @dataclass(frozen=True)
678
+ class Trigger:
679
+ """
680
+ This class defines specification of a Trigger, that can be associated with any Flyte V2 task.
681
+ The trigger then is deployed to the Flyte Platform.
682
+
683
+ Triggers can be used to run tasks on a schedule, in response to events, or based on other conditions.
684
+ The `Trigger` class encapsulates the metadata and configuration needed to define a trigger.
685
+
686
+ You can associate the same Trigger object with multiple tasks.
687
+
688
+ Example usage:
689
+ ```python
690
+ my_trigger = flyte.Trigger(
691
+ name="my_trigger",
692
+ description="A trigger that runs every hour",
693
+ inputs={"start_time": flyte.TriggerTime, "x": 1}, # Note how you can bind the `trigger time` to an input called
694
+ # start_time
695
+ automation=flyte.FixedRate(60), # Runs every hour
696
+ )
697
+ ```
698
+
699
+ :param name: (str) The name of the trigger.
700
+ :param automation: (AutomationType) The automation type, currently only supports Cron.
701
+ :param description: (str) A description of the trigger, default is an empty string.
702
+ :param auto_activate: (bool) Whether the trigger should be automatically activated, default is True.
703
+ :param inputs: (Dict[str, Any]) Optional inputs for the trigger, default is None. If provided, will replace the
704
+ values for inputs to these defaults.
705
+ :param env_vars: (Dict[str, str]) Optional environment variables for the trigger, default is None. If provided, will
706
+ replace the environment variables set in the config of the task.
707
+ :param interruptible: (bool) Whether the trigger run is interruptible,
708
+ default is None (maintains the configured behavior). If provided, it overrides whatever is set in the config
709
+ of the task.
710
+ :param overwrite_cache: (bool) Whether to overwrite the cache, default is False.
711
+ :param queue: (str) Optional queue to run the trigger in, default is None.
712
+ :param labels: (Mapping[str, str]) Optional labels to attach to the trigger, default is None.
713
+ :param annotations: (Mapping[str, str]) Optional annotations to attach to the trigger, default is None.
714
+ """
715
+
716
+ name: str
717
+ automation: Union[Cron, FixedRate]
718
+ description: str = ""
719
+ auto_activate: bool = True
720
+ inputs: Dict[str, Any] | None = None
721
+ env_vars: Dict[str, str] | None = None
722
+ interruptible: bool | None = None
723
+ overwrite_cache: bool = False
724
+ queue: str | None = None
725
+ labels: Mapping[str, str] | None = None
726
+ annotations: Mapping[str, str] | None = None
727
+
728
+ def __post_init__(self):
729
+ if not self.name:
730
+ raise ValueError("Trigger name cannot be empty")
731
+ if self.automation is None:
732
+ raise ValueError("Automation cannot be None")
733
+ if self.description and len(self.description) > 255:
734
+ from flyte._utils.description_parser import parse_description
735
+
736
+ object.__setattr__(self, "description", parse_description(self.description, 255))
737
+
738
+ @classmethod
739
+ def daily(
740
+ cls,
741
+ trigger_time_input_key: str | None = None,
742
+ *,
743
+ name: str = "daily",
744
+ description: str = "A trigger that runs daily at midnight",
745
+ auto_activate: bool = True,
746
+ inputs: Dict[str, Any] | None = None,
747
+ env_vars: Dict[str, str] | None = None,
748
+ interruptible: bool | None = None,
749
+ overwrite_cache: bool = False,
750
+ queue: str | None = None,
751
+ labels: Mapping[str, str] | None = None,
752
+ annotations: Mapping[str, str] | None = None,
753
+ ) -> Trigger:
754
+ """
755
+ Creates a Cron trigger that runs daily at midnight.
756
+
757
+ Args:
758
+ trigger_time_input_key (str | None): The input key for the trigger time.
759
+ If None, no trigger time input is added.
760
+ name (str): The name of the trigger, default is "daily".
761
+ description (str): A description of the trigger.
762
+ auto_activate (bool): Whether the trigger should be automatically activated.
763
+ inputs (Dict[str, Any] | None): Optional inputs for the trigger.
764
+ env_vars (Dict[str, str] | None): Optional environment variables.
765
+ interruptible (bool | None): Whether the triggered run is interruptible.
766
+ overwrite_cache (bool): Whether to overwrite the cache.
767
+ queue (str | None): Optional queue to run the trigger in.
768
+ labels (Mapping[str, str] | None): Optional labels to attach to the trigger.
769
+ annotations (Mapping[str, str] | None): Optional annotations to attach to the trigger.
770
+
771
+ Returns:
772
+ Trigger: A trigger that runs daily at midnight.
773
+ """
774
+ final_inputs = {}
775
+ if trigger_time_input_key is not None:
776
+ final_inputs[trigger_time_input_key] = TriggerTime
777
+ if inputs:
778
+ final_inputs.update(inputs)
779
+
780
+ return cls(
781
+ name=name,
782
+ automation=Cron("0 0 * * *"), # Cron expression for daily at midnight
783
+ description=description,
784
+ auto_activate=auto_activate,
785
+ inputs=final_inputs,
786
+ env_vars=env_vars,
787
+ interruptible=interruptible,
788
+ overwrite_cache=overwrite_cache,
789
+ queue=queue,
790
+ labels=labels,
791
+ annotations=annotations,
792
+ )
793
+
794
+ @classmethod
795
+ def hourly(
796
+ cls,
797
+ trigger_time_input_key: str | None = None,
798
+ *,
799
+ name: str = "hourly",
800
+ description: str = "A trigger that runs every hour",
801
+ auto_activate: bool = True,
802
+ inputs: Dict[str, Any] | None = None,
803
+ env_vars: Dict[str, str] | None = None,
804
+ interruptible: bool | None = None,
805
+ overwrite_cache: bool = False,
806
+ queue: str | None = None,
807
+ labels: Mapping[str, str] | None = None,
808
+ annotations: Mapping[str, str] | None = None,
809
+ ) -> Trigger:
810
+ """
811
+ Creates a Cron trigger that runs every hour.
812
+
813
+ Args:
814
+ trigger_time_input_key (str | None): The input parameter for the trigger time.
815
+ If None, no trigger time input is added.
816
+ name (str): The name of the trigger, default is "hourly".
817
+ description (str): A description of the trigger.
818
+ auto_activate (bool): Whether the trigger should be automatically activated.
819
+ inputs (Dict[str, Any] | None): Optional inputs for the trigger.
820
+ env_vars (Dict[str, str] | None): Optional environment variables.
821
+ interruptible (bool | None): Whether the trigger is interruptible.
822
+ overwrite_cache (bool): Whether to overwrite the cache.
823
+ queue (str | None): Optional queue to run the trigger in.
824
+ labels (Mapping[str, str] | None): Optional labels to attach to the trigger.
825
+ annotations (Mapping[str, str] | None): Optional annotations to attach to the trigger.
826
+
827
+ Returns:
828
+ Trigger: A trigger that runs every hour, on the hour.
829
+ """
830
+ final_inputs = {}
831
+ if trigger_time_input_key is not None:
832
+ final_inputs[trigger_time_input_key] = TriggerTime
833
+ if inputs:
834
+ final_inputs.update(inputs)
835
+
836
+ return cls(
837
+ name=name,
838
+ automation=Cron("0 * * * *"), # Cron expression for every hour
839
+ description=description,
840
+ auto_activate=auto_activate,
841
+ inputs=final_inputs,
842
+ env_vars=env_vars,
843
+ interruptible=interruptible,
844
+ overwrite_cache=overwrite_cache,
845
+ queue=queue,
846
+ labels=labels,
847
+ annotations=annotations,
848
+ )
849
+
850
+ @classmethod
851
+ def minutely(
852
+ cls,
853
+ trigger_time_input_key: str | None = None,
854
+ *,
855
+ name: str = "minutely",
856
+ description: str = "A trigger that runs every minute",
857
+ auto_activate: bool = True,
858
+ inputs: Dict[str, Any] | None = None,
859
+ env_vars: Dict[str, str] | None = None,
860
+ interruptible: bool | None = None,
861
+ overwrite_cache: bool = False,
862
+ queue: str | None = None,
863
+ labels: Mapping[str, str] | None = None,
864
+ annotations: Mapping[str, str] | None = None,
865
+ ) -> Trigger:
866
+ """
867
+ Creates a Cron trigger that runs every minute.
868
+
869
+ Args:
870
+ trigger_time_input_key (str | None): The input parameter for the trigger time.
871
+ If None, no trigger time input is added.
872
+ name (str): The name of the trigger, default is "every_minute".
873
+ description (str): A description of the trigger.
874
+ auto_activate (bool): Whether the trigger should be automatically activated.
875
+ inputs (Dict[str, Any] | None): Optional inputs for the trigger.
876
+ env_vars (Dict[str, str] | None): Optional environment variables.
877
+ interruptible (bool | None): Whether the trigger is interruptible.
878
+ overwrite_cache (bool): Whether to overwrite the cache.
879
+ queue (str | None): Optional queue to run the trigger in.
880
+ labels (Mapping[str, str] | None): Optional labels to attach to the trigger.
881
+ annotations (Mapping[str, str] | None): Optional annotations to attach to the trigger.
882
+
883
+ Returns:
884
+ Trigger: A trigger that runs every minute.
885
+ """
886
+ final_inputs = {}
887
+ if trigger_time_input_key is not None:
888
+ final_inputs[trigger_time_input_key] = TriggerTime
889
+ if inputs:
890
+ final_inputs.update(inputs)
891
+
892
+ return cls(
893
+ name=name,
894
+ automation=Cron("* * * * *"), # Cron expression for every minute
895
+ description=description,
896
+ auto_activate=auto_activate,
897
+ inputs=final_inputs,
898
+ env_vars=env_vars,
899
+ interruptible=interruptible,
900
+ overwrite_cache=overwrite_cache,
901
+ queue=queue,
902
+ labels=labels,
903
+ annotations=annotations,
904
+ )
905
+
906
+ @classmethod
907
+ def weekly(
908
+ cls,
909
+ trigger_time_input_key: str | None = None,
910
+ *,
911
+ name: str = "weekly",
912
+ description: str = "A trigger that runs weekly on Sundays at midnight",
913
+ auto_activate: bool = True,
914
+ inputs: Dict[str, Any] | None = None,
915
+ env_vars: Dict[str, str] | None = None,
916
+ interruptible: bool | None = None,
917
+ overwrite_cache: bool = False,
918
+ queue: str | None = None,
919
+ labels: Mapping[str, str] | None = None,
920
+ annotations: Mapping[str, str] | None = None,
921
+ ) -> Trigger:
922
+ """
923
+ Creates a Cron trigger that runs weekly on Sundays at midnight.
924
+
925
+ Args:
926
+ trigger_time_input_key (str | None): The input parameter for the trigger time.
927
+ If None, no trigger time input is added.
928
+ name (str): The name of the trigger, default is "weekly".
929
+ description (str): A description of the trigger.
930
+ auto_activate (bool): Whether the trigger should be automatically activated.
931
+ inputs (Dict[str, Any] | None): Optional inputs for the trigger.
932
+ env_vars (Dict[str, str] | None): Optional environment variables.
933
+ interruptible (bool | None): Whether the trigger is interruptible.
934
+ overwrite_cache (bool): Whether to overwrite the cache.
935
+ queue (str | None): Optional queue to run the trigger in.
936
+ labels (Mapping[str, str] | None): Optional labels to attach to the trigger.
937
+ annotations (Mapping[str, str] | None): Optional annotations to attach to the trigger.
938
+
939
+ Returns:
940
+ Trigger: A trigger that runs weekly on Sundays at midnight.
941
+ """
942
+ final_inputs = {}
943
+ if trigger_time_input_key is not None:
944
+ final_inputs[trigger_time_input_key] = TriggerTime
945
+ if inputs:
946
+ final_inputs.update(inputs)
947
+
948
+ return cls(
949
+ name=name,
950
+ automation=Cron("0 0 * * 0"), # Cron expression for every Sunday at midnight
951
+ description=description,
952
+ auto_activate=auto_activate,
953
+ inputs=final_inputs,
954
+ env_vars=env_vars,
955
+ interruptible=interruptible,
956
+ overwrite_cache=overwrite_cache,
957
+ queue=queue,
958
+ labels=labels,
959
+ annotations=annotations,
960
+ )
961
+
962
+ @classmethod
963
+ def monthly(
964
+ cls,
965
+ trigger_time_input_key: str | None = None,
966
+ *,
967
+ name: str = "monthly",
968
+ description: str = "A trigger that runs monthly on the 1st at midnight",
969
+ auto_activate: bool = True,
970
+ inputs: Dict[str, Any] | None = None,
971
+ env_vars: Dict[str, str] | None = None,
972
+ interruptible: bool | None = None,
973
+ overwrite_cache: bool = False,
974
+ queue: str | None = None,
975
+ labels: Mapping[str, str] | None = None,
976
+ annotations: Mapping[str, str] | None = None,
977
+ ) -> Trigger:
978
+ """
979
+ Creates a Cron trigger that runs monthly on the 1st at midnight.
980
+
981
+ Args:
982
+ trigger_time_input_key (str | None): The input parameter for the trigger time.
983
+ If None, no trigger time input is added.
984
+ name (str): The name of the trigger, default is "monthly".
985
+ description (str): A description of the trigger.
986
+ auto_activate (bool): Whether the trigger should be automatically activated.
987
+ inputs (Dict[str, Any] | None): Optional inputs for the trigger.
988
+ env_vars (Dict[str, str] | None): Optional environment variables.
989
+ interruptible (bool | None): Whether the trigger is interruptible.
990
+ overwrite_cache (bool): Whether to overwrite the cache.
991
+ queue (str | None): Optional queue to run the trigger in.
992
+ labels (Mapping[str, str] | None): Optional labels to attach to the trigger.
993
+ annotations (Mapping[str, str] | None): Optional annotations to attach to the trigger.
994
+
995
+ Returns:
996
+ Trigger: A trigger that runs monthly on the 1st at midnight.
997
+ """
998
+ final_inputs = {}
999
+ if trigger_time_input_key is not None:
1000
+ final_inputs[trigger_time_input_key] = TriggerTime
1001
+ if inputs:
1002
+ final_inputs.update(inputs)
1003
+
1004
+ return cls(
1005
+ name=name,
1006
+ automation=Cron("0 0 1 * *"), # Cron expression for monthly on the 1st at midnight
1007
+ description=description,
1008
+ auto_activate=auto_activate,
1009
+ inputs=final_inputs,
1010
+ env_vars=env_vars,
1011
+ interruptible=interruptible,
1012
+ overwrite_cache=overwrite_cache,
1013
+ queue=queue,
1014
+ labels=labels,
1015
+ annotations=annotations,
1016
+ )
1017
+
1018
+
1019
+ if __name__ == "__main__":
1020
+ from typing import get_args
1021
+
1022
+ vals = get_args(Timezone)
1023
+ with open("/tmp/timezones.txt", "w") as f:
1024
+ for v in vals:
1025
+ c = Cron(expression="0 0 * * *", timezone=v)
1026
+ f.write(f"{c.timezone_expression}\n")
1027
+ print(f"Wrote {len(vals)} timezones to /tmp/timezones.txt")