Skip to content

Update climate zones tutorial for new GWS - #28

Open
Stephen Haddad (stevehadd) wants to merge 12 commits into
mainfrom
new_gws_climate_zones_update
Open

Update climate zones tutorial for new GWS#28
Stephen Haddad (stevehadd) wants to merge 12 commits into
mainfrom
new_gws_climate_zones_update

Conversation

@stevehadd

Copy link
Copy Markdown
Collaborator

THis PR updates the climate zones tutorial for the new JASMIN GWS. Updates include:

  • changing config to point to the new data location
  • rerunning all notebook to check they still work
  • Creating batch script version of the pytorch notebook to demonstrate submitting a training script to the GPU cluster via the SLURM batch scheduler (which has much greater capacity that accessing GPUs through the notebook server).
  • some helper bash scripts for submitting to the batch scheduler.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the climate zones tutorial materials for the new JASMIN GWS environment, including new data paths and an example of running the PyTorch training workflow via Slurm batch jobs.

Changes:

  • Updated JASMIN data root in the tutorial config and refreshed notebook outputs/metadata after re-running.
  • Refactored the scikit-learn training pipeline into a CLI-friendly, modular Python script.
  • Added a PyTorch training script plus Slurm sbatch helper scripts to run training on the GPU partition.

Reviewed changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
util/submit_train_climate_zones.sh Adds a local wrapper to submit the climate-zones torch training job via sbatch and route logs to a user directory.
util/run_train_climate_zones.sh Adds the Slurm batch script that activates an environment and runs the PyTorch training entrypoint.
src/ai4c_hack/ClimateZones_TrainingPipeline.py Refactors the training pipeline into a structured CLI module with clear stages (load/split/train/eval).
src/ai4c_hack/ClimateZones_Training_Torch.py Introduces a standalone PyTorch tabular training script with saving of model + metrics.
notebooks/config.json Updates the configured JASMIN default data directory to the new GWS location.
notebooks/ClimateZones_TrainingPipeline.ipynb Refreshes notebook outputs to reflect the new paths and re-executed cells.
notebooks/ClimateZones_Training_Torch.ipynb Updates notebook metadata (kernel/python version) after re-run.
notebooks/ClimateZones_DataPrep.ipynb Updates notebook metadata (kernel/python version) after re-run.
notebooks/ClimateZones_DataExploration.ipynb Refreshes path outputs and execution counts for the new data location.
Suppressed comments (1)

util/run_train_climate_zones.sh:18

  • Typo in comment: "doe" → "does".
# uncomment if the mlflow directory doe not exist
# mkdir -p ${MLFLOW_DIR}

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread util/submit_train_climate_zones.sh Outdated
Comment thread util/run_train_climate_zones.sh Outdated
Comment thread src/ai4c_hack/ClimateZones_TrainingPipeline.py Outdated
Comment thread src/ai4c_hack/ClimateZones_Training_Torch.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 11 changed files in this pull request and generated no new comments.

Suppressed comments (5)

util/submit_train_climate_zones.sh:24

  • The log path messages and the sbatch invocation look incorrect: the second line prints stdout again (should be stderr), paths are unquoted, and Slurm’s --export option should be passed with = (and usually include ALL) so USER_DIR is actually available inside the job.
echo "writing logs to:"
echo "stdout ${STD_OUT_PATH}"
echo "stderr ${STD_ERR_PATH}"
sbatch -o "${STD_OUT_PATH}" -e "${STD_ERR_PATH}" --export=ALL,USER_DIR util/run_train_climate_zones.sh

util/run_train_climate_zones.sh:9

  • The Slurm job name (era5_ae_train_ai4c) doesn’t match what this script runs (climate zones PyTorch training). This will make squeue/log searching confusing when multiple jobs are running.
#SBATCH --job-name=climatezones_train_torch

util/submit_train_climate_zones.sh:15

  • This script hard-codes the repo location (~/prog/ai4c_hackathon/). That makes the helper unusable for users who clone the repo elsewhere. It’s more robust to cd to the repo root relative to the script location.
cd ~/prog/ai4c_hackathon/

util/run_train_climate_zones.sh:17

  • Typo in comment: “doe” → “does”.
# uncomment if the mlflow directory doe not exist

util/run_train_climate_zones.sh:23

  • This script hard-codes the repo path ($HOME/prog/ai4c_hackathon). If users follow a different clone location, the job will fail at cd. Consider resolving the repo root relative to the script path, similar to the submit helper.
export AI4C_REPO=$HOME/prog/ai4c_hackathon
cd ${AI4C_REPO}

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 11 changed files in this pull request and generated no new comments.

Suppressed comments (6)

util/submit_train_climate_zones.sh:24

  • sbatch is invoked with a relative script path (util/run_train_climate_zones.sh), which depends on the current working directory. Use an absolute path based on the submit script's directory to avoid failures when run from another location.
sbatch -o "${STD_OUT_PATH}" -e "${STD_ERR_PATH}" --export=ALL,USER_DIR util/run_train_climate_zones.sh

util/run_train_climate_zones.sh:23

  • The job script hard-codes the repo path ($HOME/prog/ai4c_hackathon). This will fail when the repo is elsewhere (or when the submit script runs from a different checkout). Resolve the repo root relative to this script instead.
export AI4C_REPO=$HOME/prog/ai4c_hackathon
cd ${AI4C_REPO}

util/submit_train_climate_zones.sh:14

  • The script hard-codes the repo location via cd ~/prog/ai4c_hackathon/, which will break if the repository is checked out elsewhere. Derive the repo root from the script location instead so the submit helper is portable.

This issue also appears on line 24 of the same file.

cd ~/prog/ai4c_hackathon/

util/run_train_climate_zones.sh:17

  • Typo in comment: "doe" → "does".

This issue also appears on line 22 of the same file.

# uncomment if the mlflow directory doe not exist

src/ai4c_hack/ClimateZones_TrainingPipeline.py:20

  • os is imported but never used, which adds noise and can trip linters. Remove the unused import.
import argparse
import datetime
import json
import os
import pathlib
from typing import Any

src/ai4c_hack/ClimateZones_Training_Torch.py:13

  • os is imported but never used, which adds noise and can trip linters. Remove the unused import.
import argparse
import json
import os
import pathlib
from dataclasses import dataclass
from typing import Any

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants