flyte 2.0.0b22__py3-none-any.whl → 2.0.0b30__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 (197) hide show
  1. flyte/__init__.py +18 -2
  2. flyte/_bin/runtime.py +43 -5
  3. flyte/_cache/cache.py +4 -2
  4. flyte/_cache/local_cache.py +216 -0
  5. flyte/_code_bundle/_ignore.py +1 -1
  6. flyte/_code_bundle/_packaging.py +4 -4
  7. flyte/_code_bundle/_utils.py +14 -8
  8. flyte/_code_bundle/bundle.py +13 -5
  9. flyte/_constants.py +1 -0
  10. flyte/_context.py +4 -1
  11. flyte/_custom_context.py +73 -0
  12. flyte/_debug/constants.py +0 -1
  13. flyte/_debug/vscode.py +6 -1
  14. flyte/_deploy.py +223 -59
  15. flyte/_environment.py +5 -0
  16. flyte/_excepthook.py +1 -1
  17. flyte/_image.py +144 -82
  18. flyte/_initialize.py +95 -12
  19. flyte/_interface.py +2 -0
  20. flyte/_internal/controllers/_local_controller.py +65 -24
  21. flyte/_internal/controllers/_trace.py +1 -1
  22. flyte/_internal/controllers/remote/_action.py +13 -11
  23. flyte/_internal/controllers/remote/_client.py +1 -1
  24. flyte/_internal/controllers/remote/_controller.py +9 -4
  25. flyte/_internal/controllers/remote/_core.py +16 -16
  26. flyte/_internal/controllers/remote/_informer.py +4 -4
  27. flyte/_internal/controllers/remote/_service_protocol.py +7 -7
  28. flyte/_internal/imagebuild/docker_builder.py +139 -84
  29. flyte/_internal/imagebuild/image_builder.py +7 -13
  30. flyte/_internal/imagebuild/remote_builder.py +65 -13
  31. flyte/_internal/imagebuild/utils.py +51 -3
  32. flyte/_internal/resolvers/_task_module.py +5 -38
  33. flyte/_internal/resolvers/default.py +2 -2
  34. flyte/_internal/runtime/convert.py +42 -20
  35. flyte/_internal/runtime/entrypoints.py +24 -1
  36. flyte/_internal/runtime/io.py +21 -8
  37. flyte/_internal/runtime/resources_serde.py +20 -6
  38. flyte/_internal/runtime/reuse.py +1 -1
  39. flyte/_internal/runtime/rusty.py +20 -5
  40. flyte/_internal/runtime/task_serde.py +33 -27
  41. flyte/_internal/runtime/taskrunner.py +10 -1
  42. flyte/_internal/runtime/trigger_serde.py +160 -0
  43. flyte/_internal/runtime/types_serde.py +1 -1
  44. flyte/_keyring/file.py +39 -9
  45. flyte/_logging.py +79 -12
  46. flyte/_map.py +31 -12
  47. flyte/_module.py +70 -0
  48. flyte/_pod.py +2 -2
  49. flyte/_resources.py +213 -31
  50. flyte/_run.py +107 -41
  51. flyte/_task.py +66 -10
  52. flyte/_task_environment.py +96 -24
  53. flyte/_task_plugins.py +4 -2
  54. flyte/_trigger.py +1000 -0
  55. flyte/_utils/__init__.py +2 -1
  56. flyte/_utils/asyn.py +3 -1
  57. flyte/_utils/docker_credentials.py +173 -0
  58. flyte/_utils/module_loader.py +17 -2
  59. flyte/_version.py +3 -3
  60. flyte/cli/_abort.py +3 -3
  61. flyte/cli/_build.py +1 -3
  62. flyte/cli/_common.py +78 -7
  63. flyte/cli/_create.py +178 -3
  64. flyte/cli/_delete.py +23 -1
  65. flyte/cli/_deploy.py +49 -11
  66. flyte/cli/_get.py +79 -34
  67. flyte/cli/_params.py +8 -6
  68. flyte/cli/_plugins.py +209 -0
  69. flyte/cli/_run.py +127 -11
  70. flyte/cli/_serve.py +64 -0
  71. flyte/cli/_update.py +37 -0
  72. flyte/cli/_user.py +17 -0
  73. flyte/cli/main.py +30 -4
  74. flyte/config/_config.py +2 -0
  75. flyte/config/_internal.py +1 -0
  76. flyte/config/_reader.py +3 -3
  77. flyte/connectors/__init__.py +11 -0
  78. flyte/connectors/_connector.py +270 -0
  79. flyte/connectors/_server.py +197 -0
  80. flyte/connectors/utils.py +135 -0
  81. flyte/errors.py +10 -1
  82. flyte/extend.py +8 -1
  83. flyte/extras/_container.py +6 -1
  84. flyte/git/_config.py +11 -9
  85. flyte/io/__init__.py +2 -0
  86. flyte/io/_dataframe/__init__.py +2 -0
  87. flyte/io/_dataframe/basic_dfs.py +1 -1
  88. flyte/io/_dataframe/dataframe.py +12 -8
  89. flyte/io/_dir.py +551 -120
  90. flyte/io/_file.py +538 -141
  91. flyte/models.py +57 -12
  92. flyte/remote/__init__.py +6 -1
  93. flyte/remote/_action.py +18 -16
  94. flyte/remote/_client/_protocols.py +39 -4
  95. flyte/remote/_client/auth/_channel.py +10 -6
  96. flyte/remote/_client/controlplane.py +17 -5
  97. flyte/remote/_console.py +3 -2
  98. flyte/remote/_data.py +4 -3
  99. flyte/remote/_logs.py +3 -3
  100. flyte/remote/_run.py +47 -7
  101. flyte/remote/_secret.py +26 -17
  102. flyte/remote/_task.py +21 -9
  103. flyte/remote/_trigger.py +306 -0
  104. flyte/remote/_user.py +33 -0
  105. flyte/storage/__init__.py +6 -1
  106. flyte/storage/_parallel_reader.py +274 -0
  107. flyte/storage/_storage.py +185 -103
  108. flyte/types/__init__.py +16 -0
  109. flyte/types/_interface.py +2 -2
  110. flyte/types/_pickle.py +17 -4
  111. flyte/types/_string_literals.py +8 -9
  112. flyte/types/_type_engine.py +26 -19
  113. flyte/types/_utils.py +1 -1
  114. {flyte-2.0.0b22.data → flyte-2.0.0b30.data}/scripts/runtime.py +43 -5
  115. {flyte-2.0.0b22.dist-info → flyte-2.0.0b30.dist-info}/METADATA +8 -1
  116. flyte-2.0.0b30.dist-info/RECORD +192 -0
  117. flyte/_protos/__init__.py +0 -0
  118. flyte/_protos/common/authorization_pb2.py +0 -66
  119. flyte/_protos/common/authorization_pb2.pyi +0 -108
  120. flyte/_protos/common/authorization_pb2_grpc.py +0 -4
  121. flyte/_protos/common/identifier_pb2.py +0 -99
  122. flyte/_protos/common/identifier_pb2.pyi +0 -120
  123. flyte/_protos/common/identifier_pb2_grpc.py +0 -4
  124. flyte/_protos/common/identity_pb2.py +0 -48
  125. flyte/_protos/common/identity_pb2.pyi +0 -72
  126. flyte/_protos/common/identity_pb2_grpc.py +0 -4
  127. flyte/_protos/common/list_pb2.py +0 -36
  128. flyte/_protos/common/list_pb2.pyi +0 -71
  129. flyte/_protos/common/list_pb2_grpc.py +0 -4
  130. flyte/_protos/common/policy_pb2.py +0 -37
  131. flyte/_protos/common/policy_pb2.pyi +0 -27
  132. flyte/_protos/common/policy_pb2_grpc.py +0 -4
  133. flyte/_protos/common/role_pb2.py +0 -37
  134. flyte/_protos/common/role_pb2.pyi +0 -53
  135. flyte/_protos/common/role_pb2_grpc.py +0 -4
  136. flyte/_protos/common/runtime_version_pb2.py +0 -28
  137. flyte/_protos/common/runtime_version_pb2.pyi +0 -24
  138. flyte/_protos/common/runtime_version_pb2_grpc.py +0 -4
  139. flyte/_protos/imagebuilder/definition_pb2.py +0 -60
  140. flyte/_protos/imagebuilder/definition_pb2.pyi +0 -153
  141. flyte/_protos/imagebuilder/definition_pb2_grpc.py +0 -4
  142. flyte/_protos/imagebuilder/payload_pb2.py +0 -32
  143. flyte/_protos/imagebuilder/payload_pb2.pyi +0 -21
  144. flyte/_protos/imagebuilder/payload_pb2_grpc.py +0 -4
  145. flyte/_protos/imagebuilder/service_pb2.py +0 -29
  146. flyte/_protos/imagebuilder/service_pb2.pyi +0 -5
  147. flyte/_protos/imagebuilder/service_pb2_grpc.py +0 -66
  148. flyte/_protos/logs/dataplane/payload_pb2.py +0 -100
  149. flyte/_protos/logs/dataplane/payload_pb2.pyi +0 -177
  150. flyte/_protos/logs/dataplane/payload_pb2_grpc.py +0 -4
  151. flyte/_protos/secret/definition_pb2.py +0 -49
  152. flyte/_protos/secret/definition_pb2.pyi +0 -93
  153. flyte/_protos/secret/definition_pb2_grpc.py +0 -4
  154. flyte/_protos/secret/payload_pb2.py +0 -62
  155. flyte/_protos/secret/payload_pb2.pyi +0 -94
  156. flyte/_protos/secret/payload_pb2_grpc.py +0 -4
  157. flyte/_protos/secret/secret_pb2.py +0 -38
  158. flyte/_protos/secret/secret_pb2.pyi +0 -6
  159. flyte/_protos/secret/secret_pb2_grpc.py +0 -198
  160. flyte/_protos/secret/secret_pb2_grpc_grpc.py +0 -198
  161. flyte/_protos/validate/validate/validate_pb2.py +0 -76
  162. flyte/_protos/workflow/common_pb2.py +0 -27
  163. flyte/_protos/workflow/common_pb2.pyi +0 -14
  164. flyte/_protos/workflow/common_pb2_grpc.py +0 -4
  165. flyte/_protos/workflow/environment_pb2.py +0 -29
  166. flyte/_protos/workflow/environment_pb2.pyi +0 -12
  167. flyte/_protos/workflow/environment_pb2_grpc.py +0 -4
  168. flyte/_protos/workflow/node_execution_service_pb2.py +0 -26
  169. flyte/_protos/workflow/node_execution_service_pb2.pyi +0 -4
  170. flyte/_protos/workflow/node_execution_service_pb2_grpc.py +0 -32
  171. flyte/_protos/workflow/queue_service_pb2.py +0 -111
  172. flyte/_protos/workflow/queue_service_pb2.pyi +0 -168
  173. flyte/_protos/workflow/queue_service_pb2_grpc.py +0 -172
  174. flyte/_protos/workflow/run_definition_pb2.py +0 -123
  175. flyte/_protos/workflow/run_definition_pb2.pyi +0 -352
  176. flyte/_protos/workflow/run_definition_pb2_grpc.py +0 -4
  177. flyte/_protos/workflow/run_logs_service_pb2.py +0 -41
  178. flyte/_protos/workflow/run_logs_service_pb2.pyi +0 -28
  179. flyte/_protos/workflow/run_logs_service_pb2_grpc.py +0 -69
  180. flyte/_protos/workflow/run_service_pb2.py +0 -137
  181. flyte/_protos/workflow/run_service_pb2.pyi +0 -185
  182. flyte/_protos/workflow/run_service_pb2_grpc.py +0 -446
  183. flyte/_protos/workflow/state_service_pb2.py +0 -67
  184. flyte/_protos/workflow/state_service_pb2.pyi +0 -76
  185. flyte/_protos/workflow/state_service_pb2_grpc.py +0 -138
  186. flyte/_protos/workflow/task_definition_pb2.py +0 -82
  187. flyte/_protos/workflow/task_definition_pb2.pyi +0 -88
  188. flyte/_protos/workflow/task_definition_pb2_grpc.py +0 -4
  189. flyte/_protos/workflow/task_service_pb2.py +0 -60
  190. flyte/_protos/workflow/task_service_pb2.pyi +0 -59
  191. flyte/_protos/workflow/task_service_pb2_grpc.py +0 -138
  192. flyte-2.0.0b22.dist-info/RECORD +0 -250
  193. {flyte-2.0.0b22.data → flyte-2.0.0b30.data}/scripts/debug.py +0 -0
  194. {flyte-2.0.0b22.dist-info → flyte-2.0.0b30.dist-info}/WHEEL +0 -0
  195. {flyte-2.0.0b22.dist-info → flyte-2.0.0b30.dist-info}/entry_points.txt +0 -0
  196. {flyte-2.0.0b22.dist-info → flyte-2.0.0b30.dist-info}/licenses/LICENSE +0 -0
  197. {flyte-2.0.0b22.dist-info → flyte-2.0.0b30.dist-info}/top_level.txt +0 -0
flyte/_trigger.py ADDED
@@ -0,0 +1,1000 @@
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
+ from flyte.trigger import Trigger, Cron
628
+ my_trigger = Trigger(
629
+ name="my_cron_trigger",
630
+ automation=Cron("0 * * * *"), # Runs every hour
631
+ description="A trigger that runs every hour",
632
+ )
633
+ ```
634
+ """
635
+
636
+ expression: str
637
+ timezone: Timezone = "UTC"
638
+
639
+ @property
640
+ def timezone_expression(self) -> str:
641
+ return f"CRON_TZ={self.timezone} {self.expression}"
642
+
643
+ def __str__(self):
644
+ return f"Cron Trigger: {self.timezone_expression}"
645
+
646
+
647
+ @rich.repr.auto
648
+ @dataclass(frozen=True)
649
+ class FixedRate:
650
+ """
651
+ This class defines a FixedRate automation that can be associated with a Trigger in Flyte.
652
+ Example usage:
653
+ ```python
654
+ from flyte.trigger import Trigger, FixedRate
655
+ my_trigger = Trigger(
656
+ name="my_fixed_rate_trigger",
657
+ automation=FixedRate(60), # Runs every hour
658
+ description="A trigger that runs every hour",
659
+ )
660
+ ```
661
+ """
662
+
663
+ interval_minutes: int
664
+ start_time: datetime | None = None
665
+
666
+ def __str__(self):
667
+ return f"FixedRate Trigger: every {self.interval_minutes} minutes"
668
+
669
+
670
+ @rich.repr.auto
671
+ @dataclass(frozen=True)
672
+ class Trigger:
673
+ """
674
+ This class defines specification of a Trigger, that can be associated with any Flyte V2 task.
675
+ The trigger then is deployed to the Flyte Platform.
676
+
677
+ Triggers can be used to run tasks on a schedule, in response to events, or based on other conditions.
678
+ The `Trigger` class encapsulates the metadata and configuration needed to define a trigger.
679
+
680
+ You can associate the same Trigger object with multiple tasks.
681
+
682
+ Example usage:
683
+ ```python
684
+ from flyte.trigger import Trigger
685
+ my_trigger = Trigger(
686
+ name="my_trigger",
687
+ description="A trigger that runs every hour",
688
+ )
689
+ ```
690
+
691
+ :param name: (str) The name of the trigger.
692
+ :param automation: (AutomationType) The automation type, currently only supports Cron.
693
+ :param description: (str) A description of the trigger, default is an empty string.
694
+ :param auto_activate: (bool) Whether the trigger should be automatically activated, default is True.
695
+ :param inputs: (Dict[str, Any]) Optional inputs for the trigger, default is None. If provided, will replace the
696
+ values for inputs to these defaults.
697
+ :param env_vars: (Dict[str, str]) Optional environment variables for the trigger, default is None. If provided, will
698
+ replace the environment variables set in the config of the task.
699
+ :param interruptible: (bool) Whether the trigger run is interruptible,
700
+ default is None (maintains the configured behavior). If provided, it overrides whatever is set in the config
701
+ of the task.
702
+ :param overwrite_cache: (bool) Whether to overwrite the cache, default is False.
703
+ :param queue: (str) Optional queue to run the trigger in, default is None.
704
+ :param labels: (Mapping[str, str]) Optional labels to attach to the trigger, default is None.
705
+ :param annotations: (Mapping[str, str]) Optional annotations to attach to the trigger, default is None.
706
+ """
707
+
708
+ name: str
709
+ automation: Union[Cron, FixedRate]
710
+ description: str = ""
711
+ auto_activate: bool = True
712
+ inputs: Dict[str, Any] | None = None
713
+ env_vars: Dict[str, str] | None = None
714
+ interruptible: bool | None = None
715
+ overwrite_cache: bool = False
716
+ queue: str | None = None
717
+ labels: Mapping[str, str] | None = None
718
+ annotations: Mapping[str, str] | None = None
719
+
720
+ def __post_init__(self):
721
+ if not self.name:
722
+ raise ValueError("Trigger name cannot be empty")
723
+ if self.automation is None:
724
+ raise ValueError("Automation cannot be None")
725
+
726
+ @classmethod
727
+ def daily(
728
+ cls,
729
+ trigger_time_input_key: str = "trigger_time",
730
+ *,
731
+ name: str = "daily",
732
+ description: str = "A trigger that runs daily at midnight",
733
+ auto_activate: bool = True,
734
+ inputs: Dict[str, Any] | None = None,
735
+ env_vars: Dict[str, str] | None = None,
736
+ interruptible: bool | None = None,
737
+ overwrite_cache: bool = False,
738
+ queue: str | None = None,
739
+ labels: Mapping[str, str] | None = None,
740
+ annotations: Mapping[str, str] | None = None,
741
+ ) -> Trigger:
742
+ """
743
+ Creates a Cron trigger that runs daily at midnight.
744
+
745
+ Args:
746
+ trigger_time_input_key (str): The input key for the trigger time, default is "trigger_time".
747
+ name (str): The name of the trigger, default is "daily".
748
+ description (str): A description of the trigger.
749
+ auto_activate (bool): Whether the trigger should be automatically activated.
750
+ inputs (Dict[str, Any] | None): Optional inputs for the trigger.
751
+ env_vars (Dict[str, str] | None): Optional environment variables.
752
+ interruptible (bool | None): Whether the triggered run is interruptible.
753
+ overwrite_cache (bool): Whether to overwrite the cache.
754
+ queue (str | None): Optional queue to run the trigger in.
755
+ labels (Mapping[str, str] | None): Optional labels to attach to the trigger.
756
+ annotations (Mapping[str, str] | None): Optional annotations to attach to the trigger.
757
+
758
+ Returns:
759
+ Trigger: A trigger that runs daily at midnight.
760
+ """
761
+ final_inputs = {trigger_time_input_key: TriggerTime}
762
+ if inputs:
763
+ final_inputs.update(inputs)
764
+
765
+ return cls(
766
+ name=name,
767
+ automation=Cron("0 0 * * *"), # Cron expression for daily at midnight
768
+ description=description,
769
+ auto_activate=auto_activate,
770
+ inputs=final_inputs,
771
+ env_vars=env_vars,
772
+ interruptible=interruptible,
773
+ overwrite_cache=overwrite_cache,
774
+ queue=queue,
775
+ labels=labels,
776
+ annotations=annotations,
777
+ )
778
+
779
+ @classmethod
780
+ def hourly(
781
+ cls,
782
+ trigger_time_input_key: str = "trigger_time",
783
+ *,
784
+ name: str = "hourly",
785
+ description: str = "A trigger that runs every hour",
786
+ auto_activate: bool = True,
787
+ inputs: Dict[str, Any] | None = None,
788
+ env_vars: Dict[str, str] | None = None,
789
+ interruptible: bool | None = None,
790
+ overwrite_cache: bool = False,
791
+ queue: str | None = None,
792
+ labels: Mapping[str, str] | None = None,
793
+ annotations: Mapping[str, str] | None = None,
794
+ ) -> Trigger:
795
+ """
796
+ Creates a Cron trigger that runs every hour.
797
+
798
+ Args:
799
+ trigger_time_input_key (str): The input parameter for the trigger time, default is "trigger_time".
800
+ name (str): The name of the trigger, default is "hourly".
801
+ description (str): A description of the trigger.
802
+ auto_activate (bool): Whether the trigger should be automatically activated.
803
+ inputs (Dict[str, Any] | None): Optional inputs for the trigger.
804
+ env_vars (Dict[str, str] | None): Optional environment variables.
805
+ interruptible (bool | None): Whether the trigger is interruptible.
806
+ overwrite_cache (bool): Whether to overwrite the cache.
807
+ queue (str | None): Optional queue to run the trigger in.
808
+ labels (Mapping[str, str] | None): Optional labels to attach to the trigger.
809
+ annotations (Mapping[str, str] | None): Optional annotations to attach to the trigger.
810
+
811
+ Returns:
812
+ Trigger: A trigger that runs every hour, on the hour.
813
+ """
814
+ final_inputs = {trigger_time_input_key: TriggerTime}
815
+ if inputs:
816
+ final_inputs.update(inputs)
817
+
818
+ return cls(
819
+ name=name,
820
+ automation=Cron("0 * * * *"), # Cron expression for every hour
821
+ description=description,
822
+ auto_activate=auto_activate,
823
+ inputs=final_inputs,
824
+ env_vars=env_vars,
825
+ interruptible=interruptible,
826
+ overwrite_cache=overwrite_cache,
827
+ queue=queue,
828
+ labels=labels,
829
+ annotations=annotations,
830
+ )
831
+
832
+ @classmethod
833
+ def minutely(
834
+ cls,
835
+ trigger_time_input_key: str = "trigger_time",
836
+ *,
837
+ name: str = "minutely",
838
+ description: str = "A trigger that runs every minute",
839
+ auto_activate: bool = True,
840
+ inputs: Dict[str, Any] | None = None,
841
+ env_vars: Dict[str, str] | None = None,
842
+ interruptible: bool | None = None,
843
+ overwrite_cache: bool = False,
844
+ queue: str | None = None,
845
+ labels: Mapping[str, str] | None = None,
846
+ annotations: Mapping[str, str] | None = None,
847
+ ) -> Trigger:
848
+ """
849
+ Creates a Cron trigger that runs every minute.
850
+
851
+ Args:
852
+ trigger_time_input_key (str): The input parameter for the trigger time, default is "trigger_time".
853
+ name (str): The name of the trigger, default is "every_minute".
854
+ description (str): A description of the trigger.
855
+ auto_activate (bool): Whether the trigger should be automatically activated.
856
+ inputs (Dict[str, Any] | None): Optional inputs for the trigger.
857
+ env_vars (Dict[str, str] | None): Optional environment variables.
858
+ interruptible (bool | None): Whether the trigger is interruptible.
859
+ overwrite_cache (bool): Whether to overwrite the cache.
860
+ queue (str | None): Optional queue to run the trigger in.
861
+ labels (Mapping[str, str] | None): Optional labels to attach to the trigger.
862
+ annotations (Mapping[str, str] | None): Optional annotations to attach to the trigger.
863
+
864
+ Returns:
865
+ Trigger: A trigger that runs every minute.
866
+ """
867
+ final_inputs = {trigger_time_input_key: TriggerTime}
868
+ if inputs:
869
+ final_inputs.update(inputs)
870
+
871
+ return cls(
872
+ name=name,
873
+ automation=Cron("* * * * *"), # Cron expression for every minute
874
+ description=description,
875
+ auto_activate=auto_activate,
876
+ inputs=final_inputs,
877
+ env_vars=env_vars,
878
+ interruptible=interruptible,
879
+ overwrite_cache=overwrite_cache,
880
+ queue=queue,
881
+ labels=labels,
882
+ annotations=annotations,
883
+ )
884
+
885
+ @classmethod
886
+ def weekly(
887
+ cls,
888
+ trigger_time_input_key: str = "trigger_time",
889
+ *,
890
+ name: str = "weekly",
891
+ description: str = "A trigger that runs weekly on Sundays at midnight",
892
+ auto_activate: bool = True,
893
+ inputs: Dict[str, Any] | None = None,
894
+ env_vars: Dict[str, str] | None = None,
895
+ interruptible: bool | None = None,
896
+ overwrite_cache: bool = False,
897
+ queue: str | None = None,
898
+ labels: Mapping[str, str] | None = None,
899
+ annotations: Mapping[str, str] | None = None,
900
+ ) -> Trigger:
901
+ """
902
+ Creates a Cron trigger that runs weekly on Sundays at midnight.
903
+
904
+ Args:
905
+ trigger_time_input_key (str): The input parameter for the trigger time, default is "trigger_time".
906
+ name (str): The name of the trigger, default is "weekly".
907
+ description (str): A description of the trigger.
908
+ auto_activate (bool): Whether the trigger should be automatically activated.
909
+ inputs (Dict[str, Any] | None): Optional inputs for the trigger.
910
+ env_vars (Dict[str, str] | None): Optional environment variables.
911
+ interruptible (bool | None): Whether the trigger is interruptible.
912
+ overwrite_cache (bool): Whether to overwrite the cache.
913
+ queue (str | None): Optional queue to run the trigger in.
914
+ labels (Mapping[str, str] | None): Optional labels to attach to the trigger.
915
+ annotations (Mapping[str, str] | None): Optional annotations to attach to the trigger.
916
+
917
+ Returns:
918
+ Trigger: A trigger that runs weekly on Sundays at midnight.
919
+ """
920
+ final_inputs = {trigger_time_input_key: TriggerTime}
921
+ if inputs:
922
+ final_inputs.update(inputs)
923
+
924
+ return cls(
925
+ name=name,
926
+ automation=Cron("0 0 * * 0"), # Cron expression for every Sunday at midnight
927
+ description=description,
928
+ auto_activate=auto_activate,
929
+ inputs=final_inputs,
930
+ env_vars=env_vars,
931
+ interruptible=interruptible,
932
+ overwrite_cache=overwrite_cache,
933
+ queue=queue,
934
+ labels=labels,
935
+ annotations=annotations,
936
+ )
937
+
938
+ @classmethod
939
+ def monthly(
940
+ cls,
941
+ trigger_time_input_key: str = "trigger_time",
942
+ *,
943
+ name: str = "monthly",
944
+ description: str = "A trigger that runs monthly on the 1st at midnight",
945
+ auto_activate: bool = True,
946
+ inputs: Dict[str, Any] | None = None,
947
+ env_vars: Dict[str, str] | None = None,
948
+ interruptible: bool | None = None,
949
+ overwrite_cache: bool = False,
950
+ queue: str | None = None,
951
+ labels: Mapping[str, str] | None = None,
952
+ annotations: Mapping[str, str] | None = None,
953
+ ) -> Trigger:
954
+ """
955
+ Creates a Cron trigger that runs monthly on the 1st at midnight.
956
+
957
+ Args:
958
+ trigger_time_input_key (str): The input parameter for the trigger time, default is "trigger_time".
959
+ name (str): The name of the trigger, default is "monthly".
960
+ description (str): A description of the trigger.
961
+ auto_activate (bool): Whether the trigger should be automatically activated.
962
+ inputs (Dict[str, Any] | None): Optional inputs for the trigger.
963
+ env_vars (Dict[str, str] | None): Optional environment variables.
964
+ interruptible (bool | None): Whether the trigger is interruptible.
965
+ overwrite_cache (bool): Whether to overwrite the cache.
966
+ queue (str | None): Optional queue to run the trigger in.
967
+ labels (Mapping[str, str] | None): Optional labels to attach to the trigger.
968
+ annotations (Mapping[str, str] | None): Optional annotations to attach to the trigger.
969
+
970
+ Returns:
971
+ Trigger: A trigger that runs monthly on the 1st at midnight.
972
+ """
973
+ final_inputs = {trigger_time_input_key: TriggerTime}
974
+ if inputs:
975
+ final_inputs.update(inputs)
976
+
977
+ return cls(
978
+ name=name,
979
+ automation=Cron("0 0 1 * *"), # Cron expression for monthly on the 1st at midnight
980
+ description=description,
981
+ auto_activate=auto_activate,
982
+ inputs=final_inputs,
983
+ env_vars=env_vars,
984
+ interruptible=interruptible,
985
+ overwrite_cache=overwrite_cache,
986
+ queue=queue,
987
+ labels=labels,
988
+ annotations=annotations,
989
+ )
990
+
991
+
992
+ if __name__ == "__main__":
993
+ from typing import get_args
994
+
995
+ vals = get_args(Timezone)
996
+ with open("/tmp/timezones.txt", "w") as f:
997
+ for v in vals:
998
+ c = Cron(expression="0 0 * * *", timezone=v)
999
+ f.write(f"{c.timezone_expression}\n")
1000
+ print(f"Wrote {len(vals)} timezones to /tmp/timezones.txt")