# 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
#
# http://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.

name: 'Store Spark Model - Watson Machine Learning'
description: |
  Store any trained Spark Model using IBM Watson Machine Learning Service
metadata:
  annotations: {platform: 'IBM Watson Machine Learning Service'}
inputs:
  - {name: bucket_name,          description: 'Required. Object storage bucket name'}
  - {name: aios_manifest_path,   description: 'Required. Object storage file path for the aios manifest file'}
  - {name: problem_type,         description: 'Required. Model problem type'}
  - {name: model_name,           description: 'Required. Model name for the trained model'}
  - {name: deployment_name,      description: 'Required. Deployment name for the trained model'}
  - {name: model_filepath,       description: 'Required. Name of the trained model zip'}
  - {name: train_data_filepath,  description: 'Required. Name of the training data zip'}
outputs:
  - {name: model_uid,            description: 'Stored model UID'}
implementation:
  container:
    image: docker.io/aipipeline/store_spark_model:latest
    command: ['python']
    args: [
      -u, store_spark_model.py,
      --bucket_name, {inputValue: bucket_name},
      --aios_manifest_path, {inputValue: aios_manifest_path},
      --problem_type, {inputValue: problem_type},
      --model_name, {inputValue: model_name},
      --deployment_name, {inputValue: deployment_name},
      --model_filepath, {inputValue: model_filepath},
      --train_data_filepath, {inputValue: train_data_filepath},
      --output_model_uid_path, {outputPath: model_uid}
    ]
