# 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: 'Subscribe - Watson OpenScale'
description: |
  Binding deployed models and subscribe them to Watson OpenScale service.
metadata:
  annotations: {platform: 'IBM Watson OpenScale'}
inputs:
  - {name: model_name,             description: 'Deployed model name.', default: 'AIOS Spark German Risk Model - Final'}
  - {name: model_uid,              description: 'Deployed model uid.', default: 'dummy uid'}
  - {name: aios_schema,            description: 'OpenScale Schema Name', default: 'data_mart_credit_risk'}
  - {name: label_column,           description: 'Model label column name.', default: 'Risk'}
  - {name: aios_manifest_path,     description: 'Object storage file path for the aios manifest file', default: ''}
  - {name: bucket_name,            description: 'Object storage bucket name', default: 'dummy-bucket-name'}
  - {name: problem_type,           description: 'Model problem type', default: 'BINARY_CLASSIFICATION'}
outputs:
  - {name: model_name,             description: 'Deployed model name.'}
implementation:
  container:
    image: docker.io/aipipeline/subscribe:latest
    command: ['python']
    args: [
      -u, subscribe.py,
      --model_name, {inputValue: model_name},
      --model_uid, {inputValue: model_uid},
      --aios_schema, {inputValue: aios_schema},
      --label_column, {inputValue: label_column},
      --aios_manifest_path, {inputValue: aios_manifest_path},
      --bucket_name, {inputValue: bucket_name},
      --problem_type, {inputValue: problem_type},
      --output_model_name_path, {outputPath: model_name}
    ]
