<commit_before># Copyright 2022 The Kubeflow Authors
#
# 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: tensorboard_experiment_creator
description: |
  Create a TensorboardExperiment for Pipeline usage.

  Args:
      tensorboad_resource_name (str):
          Required. Resource name used to retrieve tensorboard instances. Format example: projects/{project_number}/locations/{location}/tensorboards/{tensorboard_id}
      tensorboard_experiment_id (Optional[str]):
          The tensorboard experiment id.
          If not set, default to task name.
      tensorboard_experiment_display_name (Optional[str]):
          The display name of the tensorboard experiment. If not set, default to None.
      tensorboard_experiment_description (Optional[str]):
          The description of the tensorboard experiment. If not set, default to None.
      tensorboard_experiment_labels (Optional[dict]):
          The labels of the tensorboard experiment. If not set, default to None.
  Returns:
      gcp_resources (str):
          Gcp_resource with Full resource name of the TensorboardExperiment as uri. Format example: projects/{project_number}/locations/{location}/tensorboards/{tensorboard_id}/experiments/{experiment}

inputs:
  - { name: tensorboard_resource_name, type: String }
  - {
      name: tensorboard_experiment_id,
      type: String,
      default: "{{$.pipeline_task_name}}",
    }
  - { name: tensorboard_experiment_display_name, type: String, optional: true }
  - { name: tensorboard_experiment_description, type: String, optional: true }
  - { name: tensorboard_experiment_labels, type: Dict, optional: true }
#TODO(b/244597396)
outputs:
  - { name: gcp_resources, type: String }
implementation:
  container:
    image: gcr.io/ml-pipeline/google-cloud-pipeline-components:latest
    command:
      [
        python3,
        -u,
        -m,
        google_cloud_pipeline_components.container.experimental.tensorboard.tensorboard_experiment_creator,
      ]
    args:
      - --task
      - "tensorboard_experiment_creator"
      - --display_name
      - "tensorboard_experiment_creator-run"
      - --tensorboard_resource_name
      - { inputValue: tensorboard_resource_name }
      - --tensorboard_experiment_id
      - { inputValue: tensorboard_experiment_id }
      - if:
          cond:{isPresent: tensorboard_experiment_display_name}
          then:
            - --tensorboard_experiment_display_name
            - { inputValue: tensorboard_experiment_display_name }
      - if:
          cond:{isPresent: tensorboard_experiment_description}
          then:
            - --tensorboard_experiment_description
            - { inputValue: tensorboard_experiment_description }
      - if:
          cond:{isPresent: tensorboard_experiment_labels}
          then:
            - --tensorboard_experiment_labels
            - { inputValue: tensorboard_experiment_labels }
      - --gcp_resources
      - { outputPath: gcp_resources }<commit_msg>feat(component):Add tensorboard experiment creator component e2e test<commit_after># Copyright 2022 The Kubeflow Authors
#
# 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: tensorboard_experiment_creator
description: |
  Create a TensorboardExperiment for Pipeline usage.

  Args:
      tensorboad_resource_name (str):
          Required. Resource name used to retrieve tensorboard instances. Format example: projects/{project_number}/locations/{location}/tensorboards/{tensorboard_id}
      tensorboard_experiment_id (Optional[str]):
          The tensorboard experiment id.
          If not set, default to task name.
      tensorboard_experiment_display_name (Optional[str]):
          The display name of the tensorboard experiment. If not set, default to None.
      tensorboard_experiment_description (Optional[str]):
          The description of the tensorboard experiment. If not set, default to None.
      tensorboard_experiment_labels (Optional[dict]):
          The labels of the tensorboard experiment. If not set, default to None.
  Returns:
      gcp_resources (str):
          Gcp_resource with Full resource name of the TensorboardExperiment as uri. Format example: projects/{project_number}/locations/{location}/tensorboards/{tensorboard_id}/experiments/{experiment}

inputs:
  - { name: tensorboard_resource_name, type: String }
  - {
      name: tensorboard_experiment_id,
      type: String,
      default: "{{$.pipeline_task_name}}",
    }
  - { name: tensorboard_experiment_display_name, type: String, optional: true }
  - { name: tensorboard_experiment_description, type: String, optional: true }
  - { name: tensorboard_experiment_labels, type: Dict, optional: true }
#TODO(b/244597396)
outputs:
  - { name: gcp_resources, type: String }
implementation:
  container:
    image: gcr.io/ml-pipeline/google-cloud-pipeline-components:latest
    command:
      [
        python3,
        -u,
        -m,
        google_cloud_pipeline_components.container.experimental.tensorboard.tensorboard_experiment_creator,
      ]
    args:
      - --task
      - "tensorboard_experiment_creator"
      - --display_name
      - "tensorboard_experiment_creator-run"
      - --tensorboard_resource_name
      - { inputValue: tensorboard_resource_name }
      - --tensorboard_experiment_id
      - { inputValue: tensorboard_experiment_id }
      - if:
          cond: { isPresent: tensorboard_experiment_display_name }
          then:
            - --tensorboard_experiment_display_name
            - { inputValue: tensorboard_experiment_display_name }
      - if:
          cond: { isPresent: tensorboard_experiment_description }
          then:
            - --tensorboard_experiment_description
            - { inputValue: tensorboard_experiment_description }
      - if:
          cond: { isPresent: tensorboard_experiment_labels }
          then:
            - --tensorboard_experiment_labels
            - { inputValue: tensorboard_experiment_labels }
      - --gcp_resources
      - { outputPath: gcp_resources }
{'fraction_non_alphanumeric': 0.07912433824581486, 'fraction_numerical': 0.005294033481184719, 'mean_word_length': 3.140995260663507, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '836901', 'n_tokens_mistral': 1909, 'n_tokens_neox': 1878, 'n_words': 525}