{#- Context variables:
   - company: str (e.g., "ACME Bank")
   - industry: str (e.g., "fsi")
   - catalog: str (e.g., "acme_fsi_demo")
   - bundle_name: str (e.g., "acme-bank-fsi-demo")
   - app_name: str (e.g., "acme-bank-fsi-app")
   - warehouse_id: str
   - workspace_host: str
   - databricks_profile: str | None
   - lakebase_url: str | None
   - notification_email: str
-#}
resources:
  jobs:
    {{ bundle_name | replace('-', '_') }}_ml_training:
      name: {{ bundle_name }}_ml_training

      tasks:
        - task_key: train_sample_model
          notebook_task:
            notebook_path: ${workspace.file_path}/src/ml/train_sample_model
            source: WORKSPACE
            base_parameters:
              catalog: ${var.catalog}
          environment_key: ml_env

        # Additional ML tasks are added by /plan + /build-next

      queue:
        enabled: true

      environments:
        - environment_key: Default
          spec:
            environment_version: "4"

        - environment_key: ml_env
          spec:
            dependencies:
              - -r
                ${workspace.file_path}/requirements.txt
              - mlflow
              - scikit-learn
              - pandas
              - numpy
              - pyarrow
              - xgboost
              - databricks-feature-engineering
            environment_version: "4"

      performance_target: PERFORMANCE_OPTIMIZED

      email_notifications:
        on_failure:
          - ${var.notification_email}
        on_success:
          - ${var.notification_email}

      tags:
        project: ${bundle.name}
        component: ml_training
        environment: ${bundle.target}
