ob-metaflow 2.11.13.1__py2.py3-none-any.whl → 2.19.7.1rc0__py2.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 (289) hide show
  1. metaflow/R.py +10 -7
  2. metaflow/__init__.py +40 -25
  3. metaflow/_vendor/imghdr/__init__.py +186 -0
  4. metaflow/_vendor/importlib_metadata/__init__.py +1063 -0
  5. metaflow/_vendor/importlib_metadata/_adapters.py +68 -0
  6. metaflow/_vendor/importlib_metadata/_collections.py +30 -0
  7. metaflow/_vendor/importlib_metadata/_compat.py +71 -0
  8. metaflow/_vendor/importlib_metadata/_functools.py +104 -0
  9. metaflow/_vendor/importlib_metadata/_itertools.py +73 -0
  10. metaflow/_vendor/importlib_metadata/_meta.py +48 -0
  11. metaflow/_vendor/importlib_metadata/_text.py +99 -0
  12. metaflow/_vendor/importlib_metadata/py.typed +0 -0
  13. metaflow/_vendor/typeguard/__init__.py +48 -0
  14. metaflow/_vendor/typeguard/_checkers.py +1070 -0
  15. metaflow/_vendor/typeguard/_config.py +108 -0
  16. metaflow/_vendor/typeguard/_decorators.py +233 -0
  17. metaflow/_vendor/typeguard/_exceptions.py +42 -0
  18. metaflow/_vendor/typeguard/_functions.py +308 -0
  19. metaflow/_vendor/typeguard/_importhook.py +213 -0
  20. metaflow/_vendor/typeguard/_memo.py +48 -0
  21. metaflow/_vendor/typeguard/_pytest_plugin.py +127 -0
  22. metaflow/_vendor/typeguard/_suppression.py +86 -0
  23. metaflow/_vendor/typeguard/_transformer.py +1229 -0
  24. metaflow/_vendor/typeguard/_union_transformer.py +55 -0
  25. metaflow/_vendor/typeguard/_utils.py +173 -0
  26. metaflow/_vendor/typeguard/py.typed +0 -0
  27. metaflow/_vendor/typing_extensions.py +3641 -0
  28. metaflow/_vendor/v3_7/importlib_metadata/__init__.py +1063 -0
  29. metaflow/_vendor/v3_7/importlib_metadata/_adapters.py +68 -0
  30. metaflow/_vendor/v3_7/importlib_metadata/_collections.py +30 -0
  31. metaflow/_vendor/v3_7/importlib_metadata/_compat.py +71 -0
  32. metaflow/_vendor/v3_7/importlib_metadata/_functools.py +104 -0
  33. metaflow/_vendor/v3_7/importlib_metadata/_itertools.py +73 -0
  34. metaflow/_vendor/v3_7/importlib_metadata/_meta.py +48 -0
  35. metaflow/_vendor/v3_7/importlib_metadata/_text.py +99 -0
  36. metaflow/_vendor/v3_7/importlib_metadata/py.typed +0 -0
  37. metaflow/_vendor/v3_7/typeguard/__init__.py +48 -0
  38. metaflow/_vendor/v3_7/typeguard/_checkers.py +906 -0
  39. metaflow/_vendor/v3_7/typeguard/_config.py +108 -0
  40. metaflow/_vendor/v3_7/typeguard/_decorators.py +237 -0
  41. metaflow/_vendor/v3_7/typeguard/_exceptions.py +42 -0
  42. metaflow/_vendor/v3_7/typeguard/_functions.py +310 -0
  43. metaflow/_vendor/v3_7/typeguard/_importhook.py +213 -0
  44. metaflow/_vendor/v3_7/typeguard/_memo.py +48 -0
  45. metaflow/_vendor/v3_7/typeguard/_pytest_plugin.py +100 -0
  46. metaflow/_vendor/v3_7/typeguard/_suppression.py +88 -0
  47. metaflow/_vendor/v3_7/typeguard/_transformer.py +1207 -0
  48. metaflow/_vendor/v3_7/typeguard/_union_transformer.py +54 -0
  49. metaflow/_vendor/v3_7/typeguard/_utils.py +169 -0
  50. metaflow/_vendor/v3_7/typeguard/py.typed +0 -0
  51. metaflow/_vendor/v3_7/typing_extensions.py +3072 -0
  52. metaflow/_vendor/yaml/__init__.py +427 -0
  53. metaflow/_vendor/yaml/composer.py +139 -0
  54. metaflow/_vendor/yaml/constructor.py +748 -0
  55. metaflow/_vendor/yaml/cyaml.py +101 -0
  56. metaflow/_vendor/yaml/dumper.py +62 -0
  57. metaflow/_vendor/yaml/emitter.py +1137 -0
  58. metaflow/_vendor/yaml/error.py +75 -0
  59. metaflow/_vendor/yaml/events.py +86 -0
  60. metaflow/_vendor/yaml/loader.py +63 -0
  61. metaflow/_vendor/yaml/nodes.py +49 -0
  62. metaflow/_vendor/yaml/parser.py +589 -0
  63. metaflow/_vendor/yaml/reader.py +185 -0
  64. metaflow/_vendor/yaml/representer.py +389 -0
  65. metaflow/_vendor/yaml/resolver.py +227 -0
  66. metaflow/_vendor/yaml/scanner.py +1435 -0
  67. metaflow/_vendor/yaml/serializer.py +111 -0
  68. metaflow/_vendor/yaml/tokens.py +104 -0
  69. metaflow/cards.py +5 -0
  70. metaflow/cli.py +331 -785
  71. metaflow/cli_args.py +17 -0
  72. metaflow/cli_components/__init__.py +0 -0
  73. metaflow/cli_components/dump_cmd.py +96 -0
  74. metaflow/cli_components/init_cmd.py +52 -0
  75. metaflow/cli_components/run_cmds.py +546 -0
  76. metaflow/cli_components/step_cmd.py +334 -0
  77. metaflow/cli_components/utils.py +140 -0
  78. metaflow/client/__init__.py +1 -0
  79. metaflow/client/core.py +467 -73
  80. metaflow/client/filecache.py +75 -35
  81. metaflow/clone_util.py +7 -1
  82. metaflow/cmd/code/__init__.py +231 -0
  83. metaflow/cmd/develop/stub_generator.py +756 -288
  84. metaflow/cmd/develop/stubs.py +12 -28
  85. metaflow/cmd/main_cli.py +6 -4
  86. metaflow/cmd/make_wrapper.py +78 -0
  87. metaflow/datastore/__init__.py +1 -0
  88. metaflow/datastore/content_addressed_store.py +41 -10
  89. metaflow/datastore/datastore_set.py +11 -2
  90. metaflow/datastore/flow_datastore.py +156 -10
  91. metaflow/datastore/spin_datastore.py +91 -0
  92. metaflow/datastore/task_datastore.py +154 -39
  93. metaflow/debug.py +5 -0
  94. metaflow/decorators.py +404 -78
  95. metaflow/exception.py +8 -2
  96. metaflow/extension_support/__init__.py +527 -376
  97. metaflow/extension_support/_empty_file.py +2 -2
  98. metaflow/extension_support/plugins.py +49 -31
  99. metaflow/flowspec.py +482 -33
  100. metaflow/graph.py +210 -42
  101. metaflow/includefile.py +84 -40
  102. metaflow/lint.py +141 -22
  103. metaflow/meta_files.py +13 -0
  104. metaflow/{metadata → metadata_provider}/heartbeat.py +24 -8
  105. metaflow/{metadata → metadata_provider}/metadata.py +86 -1
  106. metaflow/metaflow_config.py +175 -28
  107. metaflow/metaflow_config_funcs.py +51 -3
  108. metaflow/metaflow_current.py +4 -10
  109. metaflow/metaflow_environment.py +139 -53
  110. metaflow/metaflow_git.py +115 -0
  111. metaflow/metaflow_profile.py +18 -0
  112. metaflow/metaflow_version.py +150 -66
  113. metaflow/mflog/__init__.py +4 -3
  114. metaflow/mflog/save_logs.py +2 -2
  115. metaflow/multicore_utils.py +31 -14
  116. metaflow/package/__init__.py +673 -0
  117. metaflow/packaging_sys/__init__.py +880 -0
  118. metaflow/packaging_sys/backend.py +128 -0
  119. metaflow/packaging_sys/distribution_support.py +153 -0
  120. metaflow/packaging_sys/tar_backend.py +99 -0
  121. metaflow/packaging_sys/utils.py +54 -0
  122. metaflow/packaging_sys/v1.py +527 -0
  123. metaflow/parameters.py +149 -28
  124. metaflow/plugins/__init__.py +74 -5
  125. metaflow/plugins/airflow/airflow.py +40 -25
  126. metaflow/plugins/airflow/airflow_cli.py +22 -5
  127. metaflow/plugins/airflow/airflow_decorator.py +1 -1
  128. metaflow/plugins/airflow/airflow_utils.py +5 -3
  129. metaflow/plugins/airflow/sensors/base_sensor.py +4 -4
  130. metaflow/plugins/airflow/sensors/external_task_sensor.py +2 -2
  131. metaflow/plugins/airflow/sensors/s3_sensor.py +2 -2
  132. metaflow/plugins/argo/argo_client.py +78 -33
  133. metaflow/plugins/argo/argo_events.py +6 -6
  134. metaflow/plugins/argo/argo_workflows.py +2410 -527
  135. metaflow/plugins/argo/argo_workflows_cli.py +571 -121
  136. metaflow/plugins/argo/argo_workflows_decorator.py +43 -12
  137. metaflow/plugins/argo/argo_workflows_deployer.py +106 -0
  138. metaflow/plugins/argo/argo_workflows_deployer_objects.py +453 -0
  139. metaflow/plugins/argo/capture_error.py +73 -0
  140. metaflow/plugins/argo/conditional_input_paths.py +35 -0
  141. metaflow/plugins/argo/exit_hooks.py +209 -0
  142. metaflow/plugins/argo/jobset_input_paths.py +15 -0
  143. metaflow/plugins/argo/param_val.py +19 -0
  144. metaflow/plugins/aws/aws_client.py +10 -3
  145. metaflow/plugins/aws/aws_utils.py +55 -2
  146. metaflow/plugins/aws/batch/batch.py +72 -5
  147. metaflow/plugins/aws/batch/batch_cli.py +33 -10
  148. metaflow/plugins/aws/batch/batch_client.py +4 -3
  149. metaflow/plugins/aws/batch/batch_decorator.py +102 -35
  150. metaflow/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.py +13 -10
  151. metaflow/plugins/aws/step_functions/dynamo_db_client.py +0 -3
  152. metaflow/plugins/aws/step_functions/production_token.py +1 -1
  153. metaflow/plugins/aws/step_functions/step_functions.py +65 -8
  154. metaflow/plugins/aws/step_functions/step_functions_cli.py +101 -7
  155. metaflow/plugins/aws/step_functions/step_functions_decorator.py +1 -2
  156. metaflow/plugins/aws/step_functions/step_functions_deployer.py +97 -0
  157. metaflow/plugins/aws/step_functions/step_functions_deployer_objects.py +264 -0
  158. metaflow/plugins/azure/azure_exceptions.py +1 -1
  159. metaflow/plugins/azure/azure_secret_manager_secrets_provider.py +240 -0
  160. metaflow/plugins/azure/azure_tail.py +1 -1
  161. metaflow/plugins/azure/includefile_support.py +2 -0
  162. metaflow/plugins/cards/card_cli.py +66 -30
  163. metaflow/plugins/cards/card_creator.py +25 -1
  164. metaflow/plugins/cards/card_datastore.py +21 -49
  165. metaflow/plugins/cards/card_decorator.py +132 -8
  166. metaflow/plugins/cards/card_modules/basic.py +112 -17
  167. metaflow/plugins/cards/card_modules/bundle.css +1 -1
  168. metaflow/plugins/cards/card_modules/card.py +16 -1
  169. metaflow/plugins/cards/card_modules/chevron/renderer.py +1 -1
  170. metaflow/plugins/cards/card_modules/components.py +665 -28
  171. metaflow/plugins/cards/card_modules/convert_to_native_type.py +36 -7
  172. metaflow/plugins/cards/card_modules/json_viewer.py +232 -0
  173. metaflow/plugins/cards/card_modules/main.css +1 -0
  174. metaflow/plugins/cards/card_modules/main.js +68 -49
  175. metaflow/plugins/cards/card_modules/renderer_tools.py +1 -0
  176. metaflow/plugins/cards/card_modules/test_cards.py +26 -12
  177. metaflow/plugins/cards/card_server.py +39 -14
  178. metaflow/plugins/cards/component_serializer.py +2 -9
  179. metaflow/plugins/cards/metadata.py +22 -0
  180. metaflow/plugins/catch_decorator.py +9 -0
  181. metaflow/plugins/datastores/azure_storage.py +10 -1
  182. metaflow/plugins/datastores/gs_storage.py +6 -2
  183. metaflow/plugins/datastores/local_storage.py +12 -6
  184. metaflow/plugins/datastores/spin_storage.py +12 -0
  185. metaflow/plugins/datatools/local.py +2 -0
  186. metaflow/plugins/datatools/s3/s3.py +126 -75
  187. metaflow/plugins/datatools/s3/s3op.py +254 -121
  188. metaflow/plugins/env_escape/__init__.py +3 -3
  189. metaflow/plugins/env_escape/client_modules.py +102 -72
  190. metaflow/plugins/env_escape/server.py +7 -0
  191. metaflow/plugins/env_escape/stub.py +24 -5
  192. metaflow/plugins/events_decorator.py +343 -185
  193. metaflow/plugins/exit_hook/__init__.py +0 -0
  194. metaflow/plugins/exit_hook/exit_hook_decorator.py +46 -0
  195. metaflow/plugins/exit_hook/exit_hook_script.py +52 -0
  196. metaflow/plugins/gcp/__init__.py +1 -1
  197. metaflow/plugins/gcp/gcp_secret_manager_secrets_provider.py +11 -6
  198. metaflow/plugins/gcp/gs_tail.py +10 -6
  199. metaflow/plugins/gcp/includefile_support.py +3 -0
  200. metaflow/plugins/kubernetes/kube_utils.py +108 -0
  201. metaflow/plugins/kubernetes/kubernetes.py +411 -130
  202. metaflow/plugins/kubernetes/kubernetes_cli.py +168 -36
  203. metaflow/plugins/kubernetes/kubernetes_client.py +104 -2
  204. metaflow/plugins/kubernetes/kubernetes_decorator.py +246 -88
  205. metaflow/plugins/kubernetes/kubernetes_job.py +253 -581
  206. metaflow/plugins/kubernetes/kubernetes_jobsets.py +1071 -0
  207. metaflow/plugins/kubernetes/spot_metadata_cli.py +69 -0
  208. metaflow/plugins/kubernetes/spot_monitor_sidecar.py +109 -0
  209. metaflow/plugins/logs_cli.py +359 -0
  210. metaflow/plugins/{metadata → metadata_providers}/local.py +144 -84
  211. metaflow/plugins/{metadata → metadata_providers}/service.py +103 -26
  212. metaflow/plugins/metadata_providers/spin.py +16 -0
  213. metaflow/plugins/package_cli.py +36 -24
  214. metaflow/plugins/parallel_decorator.py +128 -11
  215. metaflow/plugins/parsers.py +16 -0
  216. metaflow/plugins/project_decorator.py +51 -5
  217. metaflow/plugins/pypi/bootstrap.py +357 -105
  218. metaflow/plugins/pypi/conda_decorator.py +82 -81
  219. metaflow/plugins/pypi/conda_environment.py +187 -52
  220. metaflow/plugins/pypi/micromamba.py +157 -47
  221. metaflow/plugins/pypi/parsers.py +268 -0
  222. metaflow/plugins/pypi/pip.py +88 -13
  223. metaflow/plugins/pypi/pypi_decorator.py +37 -1
  224. metaflow/plugins/pypi/utils.py +48 -2
  225. metaflow/plugins/resources_decorator.py +2 -2
  226. metaflow/plugins/secrets/__init__.py +3 -0
  227. metaflow/plugins/secrets/secrets_decorator.py +26 -181
  228. metaflow/plugins/secrets/secrets_func.py +49 -0
  229. metaflow/plugins/secrets/secrets_spec.py +101 -0
  230. metaflow/plugins/secrets/utils.py +74 -0
  231. metaflow/plugins/tag_cli.py +4 -7
  232. metaflow/plugins/test_unbounded_foreach_decorator.py +41 -6
  233. metaflow/plugins/timeout_decorator.py +3 -3
  234. metaflow/plugins/uv/__init__.py +0 -0
  235. metaflow/plugins/uv/bootstrap.py +128 -0
  236. metaflow/plugins/uv/uv_environment.py +72 -0
  237. metaflow/procpoll.py +1 -1
  238. metaflow/pylint_wrapper.py +5 -1
  239. metaflow/runner/__init__.py +0 -0
  240. metaflow/runner/click_api.py +717 -0
  241. metaflow/runner/deployer.py +470 -0
  242. metaflow/runner/deployer_impl.py +201 -0
  243. metaflow/runner/metaflow_runner.py +714 -0
  244. metaflow/runner/nbdeploy.py +132 -0
  245. metaflow/runner/nbrun.py +225 -0
  246. metaflow/runner/subprocess_manager.py +650 -0
  247. metaflow/runner/utils.py +335 -0
  248. metaflow/runtime.py +1078 -260
  249. metaflow/sidecar/sidecar_worker.py +1 -1
  250. metaflow/system/__init__.py +5 -0
  251. metaflow/system/system_logger.py +85 -0
  252. metaflow/system/system_monitor.py +108 -0
  253. metaflow/system/system_utils.py +19 -0
  254. metaflow/task.py +521 -225
  255. metaflow/tracing/__init__.py +7 -7
  256. metaflow/tracing/span_exporter.py +31 -38
  257. metaflow/tracing/tracing_modules.py +38 -43
  258. metaflow/tuple_util.py +27 -0
  259. metaflow/user_configs/__init__.py +0 -0
  260. metaflow/user_configs/config_options.py +563 -0
  261. metaflow/user_configs/config_parameters.py +598 -0
  262. metaflow/user_decorators/__init__.py +0 -0
  263. metaflow/user_decorators/common.py +144 -0
  264. metaflow/user_decorators/mutable_flow.py +512 -0
  265. metaflow/user_decorators/mutable_step.py +424 -0
  266. metaflow/user_decorators/user_flow_decorator.py +264 -0
  267. metaflow/user_decorators/user_step_decorator.py +749 -0
  268. metaflow/util.py +243 -27
  269. metaflow/vendor.py +23 -7
  270. metaflow/version.py +1 -1
  271. ob_metaflow-2.19.7.1rc0.data/data/share/metaflow/devtools/Makefile +355 -0
  272. ob_metaflow-2.19.7.1rc0.data/data/share/metaflow/devtools/Tiltfile +726 -0
  273. ob_metaflow-2.19.7.1rc0.data/data/share/metaflow/devtools/pick_services.sh +105 -0
  274. ob_metaflow-2.19.7.1rc0.dist-info/METADATA +87 -0
  275. ob_metaflow-2.19.7.1rc0.dist-info/RECORD +445 -0
  276. {ob_metaflow-2.11.13.1.dist-info → ob_metaflow-2.19.7.1rc0.dist-info}/WHEEL +1 -1
  277. {ob_metaflow-2.11.13.1.dist-info → ob_metaflow-2.19.7.1rc0.dist-info}/entry_points.txt +1 -0
  278. metaflow/_vendor/v3_5/__init__.py +0 -1
  279. metaflow/_vendor/v3_5/importlib_metadata/__init__.py +0 -644
  280. metaflow/_vendor/v3_5/importlib_metadata/_compat.py +0 -152
  281. metaflow/package.py +0 -188
  282. ob_metaflow-2.11.13.1.dist-info/METADATA +0 -85
  283. ob_metaflow-2.11.13.1.dist-info/RECORD +0 -308
  284. /metaflow/_vendor/{v3_5/zipp.py → zipp.py} +0 -0
  285. /metaflow/{metadata → metadata_provider}/__init__.py +0 -0
  286. /metaflow/{metadata → metadata_provider}/util.py +0 -0
  287. /metaflow/plugins/{metadata → metadata_providers}/__init__.py +0 -0
  288. {ob_metaflow-2.11.13.1.dist-info → ob_metaflow-2.19.7.1rc0.dist-info/licenses}/LICENSE +0 -0
  289. {ob_metaflow-2.11.13.1.dist-info → ob_metaflow-2.19.7.1rc0.dist-info}/top_level.txt +0 -0
@@ -15,6 +15,17 @@ if sys.platform == "darwin":
15
15
  ## value, either set `METAFLOW_DEFAULT_DATASTORE` in your configuration file or set
16
16
  ## an environment variable called `METAFLOW_DEFAULT_DATASTORE`
17
17
 
18
+ ##
19
+ # Constants (NOTE: these need to live before any from_conf)
20
+ ##
21
+
22
+ # Path to the local directory to store artifacts for 'local' datastore.
23
+ DATASTORE_LOCAL_DIR = ".metaflow"
24
+ DATASTORE_SPIN_LOCAL_DIR = ".metaflow_spin"
25
+
26
+ # Local configuration file (in .metaflow) containing overrides per-project
27
+ LOCAL_CONFIG_FILE = "config.json"
28
+
18
29
  ###
19
30
  # Default configuration
20
31
  ###
@@ -26,10 +37,49 @@ DEFAULT_METADATA = from_conf("DEFAULT_METADATA", "local")
26
37
  DEFAULT_MONITOR = from_conf("DEFAULT_MONITOR", "nullSidecarMonitor")
27
38
  DEFAULT_PACKAGE_SUFFIXES = from_conf("DEFAULT_PACKAGE_SUFFIXES", ".py,.R,.RDS")
28
39
  DEFAULT_AWS_CLIENT_PROVIDER = from_conf("DEFAULT_AWS_CLIENT_PROVIDER", "boto3")
40
+ DEFAULT_AZURE_CLIENT_PROVIDER = from_conf(
41
+ "DEFAULT_AZURE_CLIENT_PROVIDER", "azure-default"
42
+ )
29
43
  DEFAULT_GCP_CLIENT_PROVIDER = from_conf("DEFAULT_GCP_CLIENT_PROVIDER", "gcp-default")
30
44
  DEFAULT_SECRETS_BACKEND_TYPE = from_conf("DEFAULT_SECRETS_BACKEND_TYPE")
31
45
  DEFAULT_SECRETS_ROLE = from_conf("DEFAULT_SECRETS_ROLE")
32
46
 
47
+ DEFAULT_FROM_DEPLOYMENT_IMPL = from_conf(
48
+ "DEFAULT_FROM_DEPLOYMENT_IMPL", "argo-workflows"
49
+ )
50
+
51
+ ###
52
+ # Spin configuration
53
+ ###
54
+ # Essentially a whitelist of decorators that are allowed in Spin steps
55
+ SPIN_ALLOWED_DECORATORS = from_conf(
56
+ "SPIN_ALLOWED_DECORATORS",
57
+ [
58
+ "conda",
59
+ "pypi",
60
+ "conda_base",
61
+ "pypi_base",
62
+ "environment",
63
+ "project",
64
+ "timeout",
65
+ "conda_env_internal",
66
+ "card",
67
+ ],
68
+ )
69
+
70
+ # Essentially a blacklist of decorators that are not allowed in Spin steps
71
+ # Note: decorators not in either SPIN_ALLOWED_DECORATORS or SPIN_DISALLOWED_DECORATORS
72
+ # are simply ignored in Spin steps
73
+ SPIN_DISALLOWED_DECORATORS = from_conf(
74
+ "SPIN_DISALLOWED_DECORATORS",
75
+ [
76
+ "parallel",
77
+ ],
78
+ )
79
+
80
+ # Default value for persist option in spin command
81
+ SPIN_PERSIST = from_conf("SPIN_PERSIST", False)
82
+
33
83
  ###
34
84
  # User configuration
35
85
  ###
@@ -39,9 +89,8 @@ USER = from_conf("USER")
39
89
  ###
40
90
  # Datastore configuration
41
91
  ###
42
- # Path to the local directory to store artifacts for 'local' datastore.
43
- DATASTORE_LOCAL_DIR = ".metaflow"
44
92
  DATASTORE_SYSROOT_LOCAL = from_conf("DATASTORE_SYSROOT_LOCAL")
93
+ DATASTORE_SYSROOT_SPIN = from_conf("DATASTORE_SYSROOT_SPIN")
45
94
  # S3 bucket and prefix to store artifacts for 's3' datastore.
46
95
  DATASTORE_SYSROOT_S3 = from_conf("DATASTORE_SYSROOT_S3")
47
96
  # Azure Blob Storage container and blob prefix
@@ -94,6 +143,15 @@ S3_WORKER_COUNT = from_conf("S3_WORKER_COUNT", 64)
94
143
  # top-level retries)
95
144
  S3_TRANSIENT_RETRY_COUNT = from_conf("S3_TRANSIENT_RETRY_COUNT", 20)
96
145
 
146
+ # Whether to log transient retry messages to stdout
147
+ S3_LOG_TRANSIENT_RETRIES = from_conf("S3_LOG_TRANSIENT_RETRIES", False)
148
+
149
+ # S3 retry configuration used in the aws client
150
+ # Use the adaptive retry strategy by default
151
+ S3_CLIENT_RETRY_CONFIG = from_conf(
152
+ "S3_CLIENT_RETRY_CONFIG", {"max_attempts": 10, "mode": "adaptive"}
153
+ )
154
+
97
155
  # Threshold to start printing warnings for an AWS retry
98
156
  RETRY_WARNING_THRESHOLD = 3
99
157
 
@@ -101,9 +159,11 @@ RETRY_WARNING_THRESHOLD = 3
101
159
  DATATOOLS_SUFFIX = from_conf("DATATOOLS_SUFFIX", "data")
102
160
  DATATOOLS_S3ROOT = from_conf(
103
161
  "DATATOOLS_S3ROOT",
104
- os.path.join(DATASTORE_SYSROOT_S3, DATATOOLS_SUFFIX)
105
- if DATASTORE_SYSROOT_S3
106
- else None,
162
+ (
163
+ os.path.join(DATASTORE_SYSROOT_S3, DATATOOLS_SUFFIX)
164
+ if DATASTORE_SYSROOT_S3
165
+ else None
166
+ ),
107
167
  )
108
168
 
109
169
  TEMPDIR = from_conf("TEMPDIR", ".")
@@ -121,25 +181,31 @@ DATATOOLS_SESSION_VARS = from_conf("DATATOOLS_SESSION_VARS", {})
121
181
  # Similar to DATATOOLS_LOCALROOT, this is used ONLY by the IncludeFile's internal implementation.
122
182
  DATATOOLS_AZUREROOT = from_conf(
123
183
  "DATATOOLS_AZUREROOT",
124
- os.path.join(DATASTORE_SYSROOT_AZURE, DATATOOLS_SUFFIX)
125
- if DATASTORE_SYSROOT_AZURE
126
- else None,
184
+ (
185
+ os.path.join(DATASTORE_SYSROOT_AZURE, DATATOOLS_SUFFIX)
186
+ if DATASTORE_SYSROOT_AZURE
187
+ else None
188
+ ),
127
189
  )
128
190
  # GS datatools root location
129
191
  # Note: we do not expose an actual datatools library for GS (like we do for S3)
130
192
  # Similar to DATATOOLS_LOCALROOT, this is used ONLY by the IncludeFile's internal implementation.
131
193
  DATATOOLS_GSROOT = from_conf(
132
194
  "DATATOOLS_GSROOT",
133
- os.path.join(DATASTORE_SYSROOT_GS, DATATOOLS_SUFFIX)
134
- if DATASTORE_SYSROOT_GS
135
- else None,
195
+ (
196
+ os.path.join(DATASTORE_SYSROOT_GS, DATATOOLS_SUFFIX)
197
+ if DATASTORE_SYSROOT_GS
198
+ else None
199
+ ),
136
200
  )
137
201
  # Local datatools root location
138
202
  DATATOOLS_LOCALROOT = from_conf(
139
203
  "DATATOOLS_LOCALROOT",
140
- os.path.join(DATASTORE_SYSROOT_LOCAL, DATATOOLS_SUFFIX)
141
- if DATASTORE_SYSROOT_LOCAL
142
- else None,
204
+ (
205
+ os.path.join(DATASTORE_SYSROOT_LOCAL, DATATOOLS_SUFFIX)
206
+ if DATASTORE_SYSROOT_LOCAL
207
+ else None
208
+ ),
143
209
  )
144
210
 
145
211
  # Secrets Backend - AWS Secrets Manager configuration
@@ -154,6 +220,13 @@ AWS_SECRETS_MANAGER_DEFAULT_REGION = from_conf("AWS_SECRETS_MANAGER_DEFAULT_REGI
154
220
  # - "projects/1234567890/secrets/foo-" -> "projects/1234567890/secrets/foo-mysecret"
155
221
  GCP_SECRET_MANAGER_PREFIX = from_conf("GCP_SECRET_MANAGER_PREFIX")
156
222
 
223
+ # Secrets Backend - Azure Key Vault prefix. With this, users don't have to
224
+ # specify the full https:// vault url in the @secret decorator.
225
+ #
226
+ # It does not make a difference if the prefix ends in a / or not. We will handle either
227
+ # case correctly.
228
+ AZURE_KEY_VAULT_PREFIX = from_conf("AZURE_KEY_VAULT_PREFIX")
229
+
157
230
  # The root directory to save artifact pulls in, when using S3 or Azure
158
231
  ARTIFACT_LOCALROOT = from_conf("ARTIFACT_LOCALROOT", os.getcwd())
159
232
 
@@ -166,9 +239,11 @@ CARD_S3ROOT = from_conf(
166
239
  )
167
240
  CARD_AZUREROOT = from_conf(
168
241
  "CARD_AZUREROOT",
169
- os.path.join(DATASTORE_SYSROOT_AZURE, CARD_SUFFIX)
170
- if DATASTORE_SYSROOT_AZURE
171
- else None,
242
+ (
243
+ os.path.join(DATASTORE_SYSROOT_AZURE, CARD_SUFFIX)
244
+ if DATASTORE_SYSROOT_AZURE
245
+ else None
246
+ ),
172
247
  )
173
248
  CARD_GSROOT = from_conf(
174
249
  "CARD_GSROOT",
@@ -176,8 +251,6 @@ CARD_GSROOT = from_conf(
176
251
  )
177
252
  CARD_NO_WARNING = from_conf("CARD_NO_WARNING", False)
178
253
 
179
- SKIP_CARD_DUALWRITE = from_conf("SKIP_CARD_DUALWRITE", False)
180
-
181
254
  RUNTIME_CARD_RENDER_INTERVAL = from_conf("RUNTIME_CARD_RENDER_INTERVAL", 60)
182
255
 
183
256
  # Azure storage account URL
@@ -216,15 +289,22 @@ DEFAULT_CONTAINER_IMAGE = from_conf("DEFAULT_CONTAINER_IMAGE")
216
289
  # Default container registry
217
290
  DEFAULT_CONTAINER_REGISTRY = from_conf("DEFAULT_CONTAINER_REGISTRY")
218
291
  # Controls whether to include foreach stack information in metadata.
219
- # TODO(Darin, 05/01/24): Remove this flag once we are confident with this feature.
220
- INCLUDE_FOREACH_STACK = from_conf("INCLUDE_FOREACH_STACK", False)
292
+ INCLUDE_FOREACH_STACK = from_conf("INCLUDE_FOREACH_STACK", True)
221
293
  # Maximum length of the foreach value string to be stored in each ForeachFrame.
222
294
  MAXIMUM_FOREACH_VALUE_CHARS = from_conf("MAXIMUM_FOREACH_VALUE_CHARS", 30)
295
+ # The default runtime limit (In seconds) of jobs launched by any compute provider. Default of 5 days.
296
+ DEFAULT_RUNTIME_LIMIT = from_conf("DEFAULT_RUNTIME_LIMIT", 5 * 24 * 60 * 60)
223
297
 
224
298
  ###
225
299
  # Organization customizations
226
300
  ###
227
301
  UI_URL = from_conf("UI_URL")
302
+ PAGERDUTY_TEMPLATE_URL = from_conf("PAGERDUTY_TEMPLATE_URL")
303
+
304
+ ###
305
+ # Capture error logs from argo
306
+ ###
307
+ ARGO_WORKFLOWS_CAPTURE_ERROR_SCRIPT = from_conf("ARGO_WORKFLOWS_CAPTURE_ERROR_SCRIPT")
228
308
 
229
309
  # Contact information displayed when running the `metaflow` command.
230
310
  # Value should be a dictionary where:
@@ -240,6 +320,14 @@ CONTACT_INFO = from_conf(
240
320
  },
241
321
  )
242
322
 
323
+
324
+ ###
325
+ # Decorators
326
+ ###
327
+ # Format is a space separated string of decospecs (what is passed
328
+ # using --with)
329
+ DEFAULT_DECOSPECS = from_conf("DEFAULT_DECOSPECS", "")
330
+
243
331
  ###
244
332
  # AWS Batch configuration
245
333
  ###
@@ -264,6 +352,8 @@ SERVICE_INTERNAL_URL = from_conf("SERVICE_INTERNAL_URL", SERVICE_URL)
264
352
  # in all Metaflow deployments. Hopefully, some day we can flip the
265
353
  # default to True.
266
354
  BATCH_EMIT_TAGS = from_conf("BATCH_EMIT_TAGS", False)
355
+ # Default tags to add to AWS Batch jobs. These are in addition to the defaults set when BATCH_EMIT_TAGS is true.
356
+ BATCH_DEFAULT_TAGS = from_conf("BATCH_DEFAULT_TAGS", {})
267
357
 
268
358
  ###
269
359
  # AWS Step Functions configuration
@@ -286,10 +376,14 @@ SFN_EXECUTION_LOG_GROUP_ARN = from_conf("SFN_EXECUTION_LOG_GROUP_ARN")
286
376
  # Amazon S3 path for storing the results of AWS Step Functions Distributed Map
287
377
  SFN_S3_DISTRIBUTED_MAP_OUTPUT_PATH = from_conf(
288
378
  "SFN_S3_DISTRIBUTED_MAP_OUTPUT_PATH",
289
- os.path.join(DATASTORE_SYSROOT_S3, "sfn_distributed_map_output")
290
- if DATASTORE_SYSROOT_S3
291
- else None,
379
+ (
380
+ os.path.join(DATASTORE_SYSROOT_S3, "sfn_distributed_map_output")
381
+ if DATASTORE_SYSROOT_S3
382
+ else None
383
+ ),
292
384
  )
385
+ # Toggle for step command being part of the Step Function payload, or if it should be offloaded to S3
386
+ SFN_COMPRESS_STATE_MACHINE = from_conf("SFN_COMPRESS_STATE_MACHINE", False)
293
387
  ###
294
388
  # Kubernetes configuration
295
389
  ###
@@ -306,6 +400,8 @@ KUBERNETES_PERSISTENT_VOLUME_CLAIMS = from_conf(
306
400
  KUBERNETES_SECRETS = from_conf("KUBERNETES_SECRETS", "")
307
401
  # Default labels for kubernetes pods
308
402
  KUBERNETES_LABELS = from_conf("KUBERNETES_LABELS", "")
403
+ # Default annotations for kubernetes pods
404
+ KUBERNETES_ANNOTATIONS = from_conf("KUBERNETES_ANNOTATIONS", "")
309
405
  # Default GPU vendor to use by K8S jobs created by Metaflow (supports nvidia, amd)
310
406
  KUBERNETES_GPU_VENDOR = from_conf("KUBERNETES_GPU_VENDOR", "nvidia")
311
407
  # Default container image for K8S
@@ -314,14 +410,14 @@ KUBERNETES_CONTAINER_IMAGE = from_conf(
314
410
  )
315
411
  # Image pull policy for container images
316
412
  KUBERNETES_IMAGE_PULL_POLICY = from_conf("KUBERNETES_IMAGE_PULL_POLICY", None)
413
+ # Image pull secrets for container images
414
+ KUBERNETES_IMAGE_PULL_SECRETS = from_conf("KUBERNETES_IMAGE_PULL_SECRETS", "")
317
415
  # Default container registry for K8S
318
416
  KUBERNETES_CONTAINER_REGISTRY = from_conf(
319
417
  "KUBERNETES_CONTAINER_REGISTRY", DEFAULT_CONTAINER_REGISTRY
320
418
  )
321
419
  # Toggle for trying to fetch EC2 instance metadata
322
420
  KUBERNETES_FETCH_EC2_METADATA = from_conf("KUBERNETES_FETCH_EC2_METADATA", False)
323
- # Default port number to open on the pods
324
- KUBERNETES_PORT = from_conf("KUBERNETES_PORT", None)
325
421
  # Shared memory in MB to use for this step
326
422
  KUBERNETES_SHARED_MEMORY = from_conf("KUBERNETES_SHARED_MEMORY", None)
327
423
  # Default port number to open on the pods
@@ -330,11 +426,17 @@ KUBERNETES_PORT = from_conf("KUBERNETES_PORT", None)
330
426
  KUBERNETES_CPU = from_conf("KUBERNETES_CPU", None)
331
427
  KUBERNETES_MEMORY = from_conf("KUBERNETES_MEMORY", None)
332
428
  KUBERNETES_DISK = from_conf("KUBERNETES_DISK", None)
429
+ # Default kubernetes QoS class
430
+ KUBERNETES_QOS = from_conf("KUBERNETES_QOS", "burstable")
333
431
 
334
-
432
+ # Architecture of kubernetes nodes - used for @conda/@pypi in metaflow-dev
433
+ KUBERNETES_CONDA_ARCH = from_conf("KUBERNETES_CONDA_ARCH")
335
434
  ARGO_WORKFLOWS_KUBERNETES_SECRETS = from_conf("ARGO_WORKFLOWS_KUBERNETES_SECRETS", "")
336
435
  ARGO_WORKFLOWS_ENV_VARS_TO_SKIP = from_conf("ARGO_WORKFLOWS_ENV_VARS_TO_SKIP", "")
337
436
 
437
+ KUBERNETES_JOBSET_GROUP = from_conf("KUBERNETES_JOBSET_GROUP", "jobset.x-k8s.io")
438
+ KUBERNETES_JOBSET_VERSION = from_conf("KUBERNETES_JOBSET_VERSION", "v1alpha2")
439
+
338
440
  ##
339
441
  # Argo Events Configuration
340
442
  ##
@@ -347,6 +449,9 @@ ARGO_EVENTS_INTERNAL_WEBHOOK_URL = from_conf(
347
449
  "ARGO_EVENTS_INTERNAL_WEBHOOK_URL", ARGO_EVENTS_WEBHOOK_URL
348
450
  )
349
451
  ARGO_EVENTS_WEBHOOK_AUTH = from_conf("ARGO_EVENTS_WEBHOOK_AUTH", "none")
452
+ ARGO_EVENTS_SENSOR_NAMESPACE = from_conf(
453
+ "ARGO_EVENTS_SENSOR_NAMESPACE", KUBERNETES_NAMESPACE
454
+ )
350
455
 
351
456
  ARGO_WORKFLOWS_UI_URL = from_conf("ARGO_WORKFLOWS_UI_URL")
352
457
 
@@ -380,16 +485,36 @@ CONDA_PACKAGE_GSROOT = from_conf("CONDA_PACKAGE_GSROOT")
380
485
  # should result in an appreciable speedup in flow environment initialization.
381
486
  CONDA_DEPENDENCY_RESOLVER = from_conf("CONDA_DEPENDENCY_RESOLVER", "conda")
382
487
 
488
+ # Default to not using fast init binary.
489
+ CONDA_USE_FAST_INIT = from_conf("CONDA_USE_FAST_INIT", False)
490
+
383
491
  ###
384
492
  # Escape hatch configuration
385
493
  ###
386
494
  # Print out warning if escape hatch is not used for the target packages
387
495
  ESCAPE_HATCH_WARNING = from_conf("ESCAPE_HATCH_WARNING", True)
388
496
 
497
+ ###
498
+ # Features
499
+ ###
500
+ FEAT_ALWAYS_UPLOAD_CODE_PACKAGE = from_conf("FEAT_ALWAYS_UPLOAD_CODE_PACKAGE", False)
501
+ ###
502
+ # Profile
503
+ ###
504
+ PROFILE_FROM_START = from_conf("PROFILE_FROM_START", False)
389
505
  ###
390
506
  # Debug configuration
391
507
  ###
392
- DEBUG_OPTIONS = ["subcommand", "sidecar", "s3client", "tracing", "stubgen"]
508
+ DEBUG_OPTIONS = [
509
+ "subcommand",
510
+ "sidecar",
511
+ "s3client",
512
+ "tracing",
513
+ "stubgen",
514
+ "userconf",
515
+ "conda",
516
+ "package",
517
+ ]
393
518
 
394
519
  for typ in DEBUG_OPTIONS:
395
520
  vars()["DEBUG_%s" % typ.upper()] = from_conf("DEBUG_%s" % typ.upper(), False)
@@ -459,6 +584,11 @@ MAX_CPU_PER_TASK = from_conf("MAX_CPU_PER_TASK")
459
584
  # lexicographic ordering of attempts. This won't work if MAX_ATTEMPTS > 99.
460
585
  MAX_ATTEMPTS = 6
461
586
 
587
+ # Feature flag (experimental features that are *explicitly* unsupported)
588
+
589
+ # Process configs even when using the click_api for Runner/Deployer
590
+ CLICK_API_PROCESS_CONFIG = from_conf("CLICK_API_PROCESS_CONFIG", True)
591
+
462
592
 
463
593
  # PINNED_CONDA_LIBS are the libraries that metaflow depends on for execution
464
594
  # and are needed within a conda environment
@@ -471,10 +601,14 @@ def get_pinned_conda_libs(python_version, datastore_type):
471
601
  elif datastore_type == "azure":
472
602
  pins["azure-identity"] = ">=1.10.0"
473
603
  pins["azure-storage-blob"] = ">=12.12.0"
604
+ pins["azure-keyvault-secrets"] = ">=4.7.0"
605
+ pins["simple-azure-blob-downloader"] = ">=0.1.0"
474
606
  elif datastore_type == "gs":
475
607
  pins["google-cloud-storage"] = ">=2.5.0"
476
608
  pins["google-auth"] = ">=2.11.0"
477
609
  pins["google-cloud-secret-manager"] = ">=2.10.0"
610
+ pins["simple-gcp-object-downloader"] = ">=0.1.0"
611
+ pins["packaging"] = ">=24.0"
478
612
  elif datastore_type == "local":
479
613
  pass
480
614
  else:
@@ -488,6 +622,8 @@ def get_pinned_conda_libs(python_version, datastore_type):
488
622
  try:
489
623
  from metaflow.extension_support import get_modules
490
624
 
625
+ _TOGGLE_DECOSPECS = []
626
+
491
627
  ext_modules = get_modules("config")
492
628
  for m in ext_modules:
493
629
  # We load into globals whatever we have in extension_module
@@ -511,8 +647,18 @@ try:
511
647
  return d1
512
648
 
513
649
  globals()[n] = _new_get_pinned_conda_libs
650
+ elif n == "TOGGLE_DECOSPECS":
651
+ if any([x.startswith("-") for x in o]):
652
+ raise ValueError("Removing decospecs is not currently supported")
653
+ if any(" " in x for x in o):
654
+ raise ValueError("Decospecs cannot contain spaces")
655
+ _TOGGLE_DECOSPECS.extend(o)
514
656
  elif not n.startswith("__") and not isinstance(o, types.ModuleType):
515
657
  globals()[n] = o
658
+ # If DEFAULT_DECOSPECS is set, use that, else extrapolate from extensions
659
+ if not DEFAULT_DECOSPECS:
660
+ DEFAULT_DECOSPECS = " ".join(_TOGGLE_DECOSPECS)
661
+
516
662
  finally:
517
663
  # Erase all temporary names to avoid leaking things
518
664
  for _n in [
@@ -529,6 +675,7 @@ finally:
529
675
  "v",
530
676
  "f1",
531
677
  "f2",
678
+ "_TOGGLE_DECOSPECS",
532
679
  ]:
533
680
  try:
534
681
  del globals()[_n]
@@ -32,8 +32,40 @@ def init_config():
32
32
  return config
33
33
 
34
34
 
35
+ def init_local_config():
36
+ # This function is heavily inspired from LocalStorage.get_datastore_root_from_config
37
+ # but simplifies certain things and also does not depend on DATASTORE_SYSROOT_LOCAL.
38
+ #
39
+ # In other words, since this config is meant to be local to a directory, it does not
40
+ # check in DATASTORE_SYSROOT_LOCAL but only up the current getcwd() path. This also
41
+ # prevents nasty circular dependencies :)
42
+
43
+ from metaflow.metaflow_config import DATASTORE_LOCAL_DIR, LOCAL_CONFIG_FILE
44
+
45
+ current_path = os.getcwd()
46
+ check_dir = os.path.join(current_path, DATASTORE_LOCAL_DIR)
47
+ check_dir = os.path.realpath(check_dir)
48
+ while not os.path.isdir(check_dir):
49
+ new_path = os.path.dirname(current_path)
50
+ if new_path == current_path: # No longer making upward progress
51
+ return {}
52
+ current_path = new_path
53
+ check_dir = os.path.join(current_path, DATASTORE_LOCAL_DIR)
54
+ path_to_config = os.path.join(check_dir, LOCAL_CONFIG_FILE)
55
+ # We found a directory to look for the config file in
56
+ if os.path.exists(path_to_config):
57
+ with open(path_to_config, encoding="utf-8") as f:
58
+ return json.load(f)
59
+ return {}
60
+
61
+
35
62
  # Initialize defaults required to setup environment variables.
36
- METAFLOW_CONFIG = init_config()
63
+ # (initialized lazily in from_conf since init_local_config requires
64
+ # some configuration values
65
+
66
+ METAFLOW_CONFIG = None
67
+
68
+ METAFLOW_LOCAL_CONFIG = None
37
69
 
38
70
  _all_configs = {}
39
71
 
@@ -51,7 +83,13 @@ def config_values(include=0):
51
83
 
52
84
  def from_conf(name, default=None, validate_fn=None):
53
85
  """
54
- First try to pull value from environment, then from metaflow config JSON
86
+ Pull value from the environment or configuration.
87
+ Order is:
88
+ 1. Environment (use any environment variable explicitly set by user)
89
+ 2. Local config (use any value set in the local config file -- so stuff in
90
+ .metaflow/project.json for example)
91
+ 3. Global config (use any value set in the global config file)
92
+ 4. Default
55
93
 
56
94
  Prior to a value being returned, we will validate using validate_fn (if provided).
57
95
  Only non-None values are validated.
@@ -59,9 +97,19 @@ def from_conf(name, default=None, validate_fn=None):
59
97
  validate_fn should accept (name, value).
60
98
  If the value validates, return None, else raise an MetaflowException.
61
99
  """
100
+ global METAFLOW_CONFIG, METAFLOW_LOCAL_CONFIG
101
+
102
+ if METAFLOW_CONFIG is None:
103
+ METAFLOW_CONFIG = init_config()
104
+ if METAFLOW_LOCAL_CONFIG is None:
105
+ METAFLOW_LOCAL_CONFIG = init_local_config()
106
+
62
107
  is_default = True
63
108
  env_name = "METAFLOW_%s" % name
64
- value = os.environ.get(env_name, METAFLOW_CONFIG.get(env_name, default))
109
+ value = os.environ.get(
110
+ env_name,
111
+ METAFLOW_LOCAL_CONFIG.get(env_name, METAFLOW_CONFIG.get(env_name, default)),
112
+ )
65
113
  if validate_fn and value is not None:
66
114
  validate_fn(env_name, value)
67
115
  if default is not None:
@@ -4,7 +4,9 @@ from typing import Any, Optional, TYPE_CHECKING
4
4
 
5
5
  from metaflow.metaflow_config import TEMPDIR
6
6
 
7
- Parallel = namedtuple("Parallel", ["main_ip", "num_nodes", "node_index"])
7
+ Parallel = namedtuple(
8
+ "Parallel", ["main_ip", "num_nodes", "node_index", "control_task_id"]
9
+ )
8
10
 
9
11
  if TYPE_CHECKING:
10
12
  import metaflow
@@ -28,7 +30,7 @@ class Current(object):
28
30
  raise ex
29
31
 
30
32
  self.__class__.graph = property(
31
- fget=lambda _: _raise(RuntimeError("Graph is not available"))
33
+ fget=lambda self: _raise(RuntimeError("Graph is not available"))
32
34
  )
33
35
 
34
36
  def _set_env(
@@ -260,14 +262,6 @@ class Current(object):
260
262
  """
261
263
  return self._username
262
264
 
263
- @property
264
- def parallel(self):
265
- return Parallel(
266
- main_ip=os.environ.get("MF_PARALLEL_MAIN_IP", "127.0.0.1"),
267
- num_nodes=int(os.environ.get("MF_PARALLEL_NUM_NODES", "1")),
268
- node_index=int(os.environ.get("MF_PARALLEL_NODE_INDEX", "0")),
269
- )
270
-
271
265
  @property
272
266
  def tags(self):
273
267
  """