# ==============================================================================
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
apiVersion: batch/v1
kind: Job
metadata:
  name: trainer-job-alpha
spec:
  activeDeadlineSeconds: 1800
  ttlSecondsAfterFinished: 1800
  template:
    metadata:
      name: trainer-job-alpha
    spec:
      serviceAccountName: sa-trainer
      containers:
      - name: anomaly
        # image: gcr.io/virtual-anomaly/trainer
        image: us-east1-docker.pkg.dev/virtual-anomaly/training/trainer
        env:
          - name: TRAIN_FEATURE_PATH
            # Update below to change the input location
            value: "gs://virtual-anomaly-vertex-ai/sklearn_models_data/isolation_forest/train/train.csv"
          - name: JOB_DIR
            # Update below to change the output location
            value: "gs://prediction_mk/training_model"
            # value: "gs://virtual-anomaly-vertex-ai/sklearn_models/custom_container_isolation_forest_101521_0915"
        args: ["--input=$(TRAIN_FEATURE_PATH)", "--job-dir=$(JOB_DIR)"]
      restartPolicy: Never
  backoffLimit: 2
