Skip to content

Commit a59753f

Browse files
authored
Merge branch 'master' into upgrade-typeguard
2 parents 52181a5 + 71a5e8c commit a59753f

File tree

6 files changed

+73
-21
lines changed

6 files changed

+73
-21
lines changed

devtools/Makefile

+20-10
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ help:
88
@echo " ui - Open Metaflow UI"
99
@echo " dashboard - Open Minikube dashboard"
1010
@echo " down - Stop and clean up the environment"
11+
@echo " all-up - Start the development environment with all services"
1112
@echo " help - Show this help message"
1213

1314
HELM_VERSION := v3.14.0
@@ -24,10 +25,10 @@ MINIKUBE := $(MINIKUBE_DIR)/minikube
2425
TILT_DIR := $(DEVTOOLS_DIR)/tilt
2526
TILT := $(TILT_DIR)/tilt
2627
TILTFILE := $(MKFILE_DIR)/Tiltfile
27-
MAKE_CMD := $(MAKE) -C "$(MKFILE_DIR)"
28+
MAKE_CMD := $(MAKE) -f "$(MKFILE_PATH)"
2829

2930
MINIKUBE_CPUS ?= 4
30-
MINIKUBE_MEMORY ?= 6000
31+
MINIKUBE_MEMORY ?= 6144
3132
MINIKUBE_DISK_SIZE ?= 20g
3233

3334
ifeq ($(shell uname), Darwin)
@@ -129,7 +130,8 @@ setup-minikube:
129130
--cpus $(MINIKUBE_CPUS) \
130131
--memory $(MINIKUBE_MEMORY) \
131132
--disk-size $(MINIKUBE_DISK_SIZE) \
132-
--driver docker; \
133+
--driver docker \
134+
|| { echo "❌ Failed to start Minikube (check if Docker is running)"; exit 1; }; \
133135
echo "🔌 Enabling metrics-server and dashboard (quietly)..."; \
134136
$(MINIKUBE) addons enable metrics-server >/dev/null 2>&1; \
135137
$(MINIKUBE) addons enable dashboard >/dev/null 2>&1; \
@@ -170,7 +172,6 @@ up: install-brew check-docker install-curl install-gum setup-minikube install-he
170172
@echo 'trap "exit" INT TERM' >> $(DEVTOOLS_DIR)/start.sh
171173
@echo 'trap "kill 0" EXIT' >> $(DEVTOOLS_DIR)/start.sh
172174
@echo 'eval $$($(MINIKUBE) docker-env)' >> $(DEVTOOLS_DIR)/start.sh
173-
174175
@echo 'if [ -n "$$SERVICES_OVERRIDE" ]; then' >> "$(DEVTOOLS_DIR)/start.sh"
175176
@echo ' echo "🌐 Using user-provided list of services: $$SERVICES_OVERRIDE"' >> "$(DEVTOOLS_DIR)/start.sh"
176177
@echo ' SERVICES="$$SERVICES_OVERRIDE"' >> "$(DEVTOOLS_DIR)/start.sh"
@@ -186,11 +187,14 @@ up: install-brew check-docker install-curl install-gum setup-minikube install-he
186187
@chmod +x $(DEVTOOLS_DIR)/start.sh
187188
@$(DEVTOOLS_DIR)/start.sh
188189

190+
all-up:
191+
@echo "🚀 Starting up all services..."
192+
SERVICES_OVERRIDE=all $(MAKE_CMD) up
193+
189194
down:
190195
@echo "🛑 Stopping all services..."
191196
@-pkill -f "$(MINIKUBE) tunnel" 2>/dev/null || true
192197
@echo "⏹️ Stopping Tilt..."
193-
-PATH="$(MINIKUBE_DIR):$(TILT_DIR):$$PATH" tilt down -f $(TILTFILE)
194198
@echo "🧹 Cleaning up Minikube..."
195199
$(MAKE_CMD) teardown-minikube
196200
@echo "🗑️ Removing Tilt binary and directory..."
@@ -201,7 +205,7 @@ down:
201205

202206
shell: setup-tilt
203207
@echo "⏳ Checking if development environment is up..."
204-
@set -e; \
208+
@set -eu; \
205209
for i in $$(seq 1 90); do \
206210
if "$(TILT)" get session >/dev/null 2>&1; then \
207211
found_session=1; \
@@ -210,7 +214,7 @@ shell: setup-tilt
210214
sleep 2; \
211215
fi; \
212216
done; \
213-
if [ -z "$${found_session}" ]; then \
217+
if [ -z "$${found_session:-}" ]; then \
214218
echo "❌ Development environment is not up."; \
215219
echo " Please run 'metaflow-dev up' in another terminal, then re-run 'metaflow-dev shell'."; \
216220
exit 1; \
@@ -220,7 +224,10 @@ shell: setup-tilt
220224
"$(TILT)" get uiresource generate-configs >/dev/null 2>&1; \
221225
status=$$?; \
222226
if [ $$status -eq 0 ]; then \
223-
"$(TILT)" wait --for=condition=Ready uiresource/generate-configs; \
227+
if ! "$(TILT)" wait --for=condition=Ready uiresource/generate-configs --timeout=300s; then \
228+
echo "❌ Timed out waiting for development environment to be ready."; \
229+
exit 1; \
230+
fi; \
224231
break; \
225232
elif [ $$status -eq 127 ]; then \
226233
echo "❌ Development environment is not up."; \
@@ -267,7 +274,10 @@ create-dev-shell: setup-tilt
267274
echo "fi" >> $$SHELL_PATH && \
268275
echo "" >> $$SHELL_PATH && \
269276
echo "echo \"⏳ Waiting for development environment to be ready...\"" >> $$SHELL_PATH && \
270-
echo "$(TILT) wait --for=condition=Ready uiresource/generate-configs" >> $$SHELL_PATH && \
277+
echo "if ! $(TILT) wait --for=condition=Ready uiresource/generate-configs --timeout=300s; then" >> $$SHELL_PATH && \
278+
echo " echo \"❌ Timed out waiting for development environment to be ready.\"" >> $$SHELL_PATH && \
279+
echo " exit 1" >> $$SHELL_PATH && \
280+
echo "fi" >> $$SHELL_PATH && \
271281
echo "" >> $$SHELL_PATH && \
272282
echo "echo \"🔧 Starting a new shell for development environment...\"" >> $$SHELL_PATH && \
273283
echo "if [ -n \"\$$SHELL\" ]; then" >> $$SHELL_PATH && \
@@ -317,6 +327,6 @@ ui: setup-tilt
317327
@echo "🔗 Opening Metaflow UI at http://localhost:3000"
318328
@open http://localhost:3000
319329

320-
.PHONY: install-helm setup-minikube setup-tilt teardown-minikube tunnel up down check-docker install-curl install-gum install-brew up down dashboard shell ui help
330+
.PHONY: install-helm setup-minikube setup-tilt teardown-minikube tunnel up down check-docker install-curl install-gum install-brew up down dashboard shell ui all-up help
321331

322332
.DEFAULT_GOAL := up

devtools/Tiltfile

+10-5
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,13 @@ components = {
2323
"argo-events": ["argo-workflows"],
2424
}
2525

26-
if os.getenv("SERVICES", "").strip():
27-
requested_components = os.getenv("SERVICES", "").split(",")
26+
services_env = os.getenv("SERVICES", "").strip().lower()
27+
28+
if services_env:
29+
if services_env == "all":
30+
requested_components = list(components.keys())
31+
else:
32+
requested_components = services_env.split(",")
2833
else:
2934
requested_components = list(components.keys())
3035

@@ -78,7 +83,7 @@ for component in requested_components:
7883
if result not in enabled_components:
7984
enabled_components.append(result)
8085

81-
# Print a friendly summary when running `tilt up`.
86+
# Print a friendly summary when running `tilt up`.
8287
if config.tilt_subcommand == 'up':
8388
print("\n📦 Components to install:")
8489
for component in enabled_components:
@@ -499,7 +504,7 @@ if "argo-events" in enabled_components:
499504
'argo-events-controller-manager',
500505
labels=['argo-events'],
501506
)
502-
507+
503508
metaflow_config["METAFLOW_ARGO_EVENTS_EVENT"] = "metaflow-event"
504509
metaflow_config["METAFLOW_ARGO_EVENTS_EVENT_BUS"] = "default"
505510
metaflow_config["METAFLOW_ARGO_EVENTS_EVENT_SOURCE"] = "argo-events-webhook"
@@ -617,4 +622,4 @@ local_resource(
617622
name="generate-configs",
618623
cmd=write_config_files(),
619624
resource_deps=config_resources,
620-
)
625+
)

metaflow/cmd/develop/stub_generator.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1133,13 +1133,16 @@ def _extract_signature_from_decorator(
11331133
result = result[1:]
11341134
# Add doc to first and last overloads. Jedi uses the last one and pycharm
11351135
# the first one. Go figure.
1136+
result_docstring = docs["func_doc"]
1137+
if docs["param_doc"]:
1138+
result_docstring += "\nParameters\n----------\n" + docs["param_doc"]
11361139
result[0] = (
11371140
result[0][0],
1138-
docs["func_doc"] + "\nParameters\n----------\n" + docs["param_doc"],
1141+
result_docstring,
11391142
)
11401143
result[-1] = (
11411144
result[-1][0],
1142-
docs["func_doc"] + "\nParameters\n----------\n" + docs["param_doc"],
1145+
result_docstring,
11431146
)
11441147
return result
11451148

metaflow/cmd/make_wrapper.py

+35-3
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,47 @@
22
import subprocess
33
from pathlib import Path
44
import sysconfig
5+
import site
6+
7+
8+
def find_makefile():
9+
possible_dirs = []
10+
11+
# 1) The standard sysconfig-based location
12+
data_dir = sysconfig.get_paths()["data"]
13+
possible_dirs.append(Path(data_dir) / "share" / "metaflow" / "devtools")
14+
15+
# 2) The user base (e.g. ~/.local on many systems)
16+
user_base = site.getuserbase() # e.g. /home/runner/.local
17+
possible_dirs.append(Path(user_base) / "share" / "metaflow" / "devtools")
18+
19+
# 3) site-packages can vary, we can guess share/.. near each site-packages
20+
# (Works if pip actually placed devtools near site-packages.)
21+
for p in site.getsitepackages():
22+
possible_dirs.append(Path(p).parent / "share" / "metaflow" / "devtools")
23+
user_site = site.getusersitepackages()
24+
possible_dirs.append(Path(user_site).parent / "share" / "metaflow" / "devtools")
25+
26+
for candidate_dir in possible_dirs:
27+
makefile_candidate = candidate_dir / "Makefile"
28+
if makefile_candidate.is_file():
29+
return makefile_candidate
30+
31+
return None
532

633

734
def main():
8-
share_dir = Path(sysconfig.get_paths()["data"]) / "share" / "metaflow" / "devtools"
9-
makefile_path = share_dir / "Makefile"
35+
makefile_path = find_makefile()
36+
if not makefile_path:
37+
print("ERROR: Could not find executable in any known location.")
38+
sys.exit(1)
1039
cmd = ["make", "-f", str(makefile_path)] + sys.argv[1:]
11-
# subprocess.run(cmd, check=True)
40+
1241
try:
1342
completed = subprocess.run(cmd, check=True)
1443
sys.exit(completed.returncode)
1544
except subprocess.CalledProcessError as ex:
1645
sys.exit(ex.returncode)
46+
except KeyboardInterrupt:
47+
print("Process interrupted by user. Exiting cleanly.")
48+
sys.exit(1)

metaflow/plugins/kubernetes/kubernetes_jobsets.py

+2
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,8 @@ def _fetch_pod(self):
319319
def kill(self):
320320
plural = "jobsets"
321321
client = self._client.get()
322+
if not (self.is_running or self.is_waiting):
323+
return
322324
try:
323325
# Killing the control pod will trigger the jobset to mark everything as failed.
324326
# Since jobsets have a successPolicy set to `All` which ensures that everything has

metaflow/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
metaflow_version = "2.15.0"
1+
metaflow_version = "2.15.2"

0 commit comments

Comments
 (0)