{
   "components": {
     "comp-getworkerpoolspecsop": {
       "executorLabel": "exec-getworkerpoolspecsop",
       "inputDefinitions": {
         "parameters": {
           "best_hyperparameters": {
             "parameterType": "LIST"
           },
           "worker_pool_specs": {
             "parameterType": "LIST"
           }
         }
       },
       "outputDefinitions": {
         "parameters": {
           "Output": {
             "parameterType": "LIST"
           }
         }
       }
     }
   },
   "deploymentSpec": {
     "executors": {
       "exec-getworkerpoolspecsop": {
         "container": {
           "args": [
             "--executor_input",
             "{{$}}",
             "--function_to_execute",
             "GetWorkerPoolSpecsOp"
           ],
           "command": [
             "sh",
             "-c",
             "\nif ! [ -x \"$(command -v pip)\" ]; then\n    python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet     --no-warn-script-location 'google-cloud-aiplatform' 'kfp==2.0.0-beta.12' && \"$0\" \"$@\"\n",
             "sh",
             "-ec",
             "program_path=$(mktemp -d)\nprintf \"%s\" \"$0\" > \"$program_path/ephemeral_component.py\"\npython3 -m kfp.components.executor_main                         --component_module_path                         \"$program_path/ephemeral_component.py\"                         \"$@\"\n",
             "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import *\n\ndef GetWorkerPoolSpecsOp(best_hyperparameters: list,\n                         worker_pool_specs: list) -> list:\n  \"\"\"Constructs worker_pool_specs based on the best hyperparameters.\n\n  Args:\n      best_hyperparameters (list):\n        Required. List representing the intermediate\n        JSON representation of the best hyperparameters from the\n        hyperparameter tuning job.\n      worker_pool_specs (list):\n        Required. The spec of the worker pools\n        including machine type and Docker image. All worker pools except the\n        first one are optional and can be skipped by providing an empty value.\n\n  Returns:\n      List containing an intermediate JSON representation of the\n      worker_pool_specs updated with the best hyperparameters as arguments\n      in the container_spec.\n\n  \"\"\"\n  from google.cloud.aiplatform.aiplatform_v1.types import study\n\n  for worker_pool_spec in worker_pool_specs:\n    if 'args' not in worker_pool_spec['container_spec']:\n      worker_pool_spec['container_spec']['args'] = []\n    for param in best_hyperparameters:\n      p = study.Trial.Parameter.from_json(param)\n      worker_pool_spec['container_spec']['args'].append(\n          f'--{p.parameter_id}={p.value}')\n\n  return worker_pool_specs\n\n"
           ],
           "image": "python:3.7"
         }
       }
     }
   },
   "pipelineInfo": {
     "name": "get-worker-pool-specs-op-test"
   },
   "root": {
     "dag": {
       "tasks": {
         "getworkerpoolspecsop": {
           "cachingOptions": {
             "enableCache": true
           },
           "componentRef": {
             "name": "comp-getworkerpoolspecsop"
           },
           "inputs": {
             "parameters": {
               "best_hyperparameters": {
                 "runtimeValue": {
                   "constant": [
                     "{\n \"parameterId\": \"learning_rate\",\n \"value\": 0.028\n}",
                     "{\n \"parameterId\": \"momentum\",\n \"value\": 0.49\n}",
                     "{\n \"parameterId\": \"num_neurons\",\n \"value\": 512.0\n}"
                   ]
                 }
               },
               "worker_pool_specs": {
                 "runtimeValue": {
                   "constant": [
                     {
                       "container_spec": {
                         "image_uri": "gcr.io/project_id/test"
                       },
                       "machine_spec": {
                         "accelerator_count": 1.0,
                         "accelerator_type": "NVIDIA_TESLA_T4",
                         "machine_type": "n1-standard-4"
                       },
                       "replica_count": 1.0
                     }
                   ]
                 }
               }
             }
           },
           "taskInfo": {
             "name": "getworkerpoolspecsop"
           }
         }
       }
     }
   }
 }