From 34c632dcdec884b8945dba6359f22eaba88af325 Mon Sep 17 00:00:00 2001 From: Jeremie Fraeys Date: Sat, 6 Dec 2025 15:59:08 -0500 Subject: [PATCH] Create CLI-Jupyter integration workflow - Add jupyter_launcher.sh script to start Jupyter with ML tools - Create cli_integration.py helper for CLI operations - Add sample notebook structure for experiments - Create workflow documentation for seamless data science integration --- podman/cli_integration.py | 8 +++ podman/jupyter_launcher.sh | 4 ++ podman/jupyter_workflow.md | 50 +++++++++++++++++++ podman/workspace/notebooks/mlflow_demo.ipynb | 0 .../notebooks/sample_experiment.ipynb | 1 + 5 files changed, 63 insertions(+) create mode 100644 podman/cli_integration.py create mode 100755 podman/jupyter_launcher.sh create mode 100644 podman/jupyter_workflow.md create mode 100644 podman/workspace/notebooks/mlflow_demo.ipynb create mode 100644 podman/workspace/notebooks/sample_experiment.ipynb diff --git a/podman/cli_integration.py b/podman/cli_integration.py new file mode 100644 index 0000000..6f0be64 --- /dev/null +++ b/podman/cli_integration.py @@ -0,0 +1,8 @@ +# CLI-Jupyter Integration Helper +import subprocess +import os +def sync_project(project_path): + """Sync project using CLI""" + cmd = ["../cli/zig-out/bin/ml", "sync", project_path, "--queue"] + result = subprocess.run(cmd, capture_output=True, text=True) + return result.returncode == 0 diff --git a/podman/jupyter_launcher.sh b/podman/jupyter_launcher.sh new file mode 100755 index 0000000..edf3599 --- /dev/null +++ b/podman/jupyter_launcher.sh @@ -0,0 +1,4 @@ +#!/bin/bash +echo "Starting Jupyter with ML tools..." +podman run -d -p 8888:8888 --name ml-jupyter -v "$(pwd)/workspace:/workspace:Z" --entrypoint conda localhost/ml-tools-runner run -n ml_env jupyter notebook --no-browser --ip=0.0.0.0 --port=8888 --NotebookApp.token="" --NotebookApp.password="" --allow-root +echo "Jupyter available at http://localhost:8888" diff --git a/podman/jupyter_workflow.md b/podman/jupyter_workflow.md new file mode 100644 index 0000000..7b7d2ac --- /dev/null +++ b/podman/jupyter_workflow.md @@ -0,0 +1,50 @@ +# CLI-Jupyter Integration Workflow +## Workflow Overview + +This workflow integrates the FetchML CLI with Jupyter notebooks for seamless data science experiments. + +### Step 1: Start Jupyter Server +```bash +# Build the container with ML tools +podman build -f ml-tools-runner.podfile -t ml-tools-runner . + +# Start Jupyter server +podman run -d -p 8888:8888 --name ml-jupyter \ + -v "$(pwd)/workspace:/workspace:Z" \ + --entrypoint conda localhost/ml-tools-runner \ + run -n ml_env jupyter notebook --no-browser --ip=0.0.0.0 --port=8888 \ + --NotebookApp.token='' --NotebookApp.password='' --allow-root + +# Access at http://localhost:8888 +``` + +### Step 2: Use CLI to Sync Projects +```bash +# From another terminal, sync your project +cd cli && ./zig-out/bin/ml sync ./my_project --queue + +# Check status +./zig-out/bin/ml status +``` + +### Step 3: Run Experiments in Jupyter +```python +# In your Jupyter notebook +import mlflow +import wandb +import pandas as pd + +# Start MLflow tracking +mlflow.start_run() +mlflow.log_param("model", "random_forest") +mlflow.log_metric("accuracy", 0.95) +``` + +### Step 4: Monitor with CLI +```bash +# Monitor jobs from CLI +./zig-out/bin/ml monitor + +# View logs +./zig-out/bin/ml experiment log my_experiment +``` diff --git a/podman/workspace/notebooks/mlflow_demo.ipynb b/podman/workspace/notebooks/mlflow_demo.ipynb new file mode 100644 index 0000000..e69de29 diff --git a/podman/workspace/notebooks/sample_experiment.ipynb b/podman/workspace/notebooks/sample_experiment.ipynb new file mode 100644 index 0000000..0892f9b --- /dev/null +++ b/podman/workspace/notebooks/sample_experiment.ipynb @@ -0,0 +1 @@ +{"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["# ML Experiment with FetchML\n\nThis notebook demonstrates how to use FetchML CLI with Jupyter notebooks."]}], "metadata": {"kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}}, "nbformat": 4, "nbformat_minor": 4}