code: def main():
      parser = ArgumentParser()
      parser.add_argument(
          "--run",
          help="Run the autoscaler after wizard finished",
          action="store_true",
          default=False,
      )
      parser.add_argument(
          "--remote",
          help="Run the autoscaler as a service, launch on the `services` queue",
          action="store_true",
          default=False,
      )
      parser.add_argument(
          "--config-file",
          help="Configuration file name",
          type=Path,
          default=Path("aws_autoscaler.yaml"),
      )
      args = parser.parse_args()
  
      if running_remotely():
          conf = default_config
      else:
          print(
              "AWS Autoscaler setup wizard\n"
              "---------------------------\n"
              "Follow the wizard to configure your AWS auto-scaler service.\n"
              "Once completed, you will be able to view and change the configuration in the clearml-server web UI.\n"
              "It means there is no need to worry about typos or mistakes :)\n"
          )
  
          if args.config_file.exists() and input_bool(
              "Load configurations from config file '{}' [Y/n]? ".format(
                  args.config_file
              ),
              default=True,
          ):
              with args.config_file.open("r") as f:
                  conf = yaml.load(f, Loader=yaml.SafeLoader)
          else:
              configurations, hyper_params = run_wizard()
              conf = {
                  "hyper_params": hyper_params,
                  "configurations": configurations,
              }
              # noinspection PyBroadException
              try:
                  with args.config_file.open("w+") as f:
                      yaml.safe_dump(conf, f)
              except Exception:
                  print(
                      "Error! Could not write configuration file at: {}".format(
                          args.config_file
                      )
                  )
                  return
  
      # Connecting ClearML with the current process,
      # from here on everything is logged automatically
      task = Task.init(
          project_name="DevOps",
          task_name="AWS Auto-Scaler",
          task_type=Task.TaskTypes.service,
      )
      task.connect(conf["hyper_params"])
      configurations = conf["configurations"]
      configurations.update(
          json.loads(
              task.get_configuration_object(name="General") or "{}"
          )
      )
      task.set_configuration_object(
          name="General",
          config_text=json.dumps(configurations, indent=2),
      )
  
      if args.remote or args.run:
          print(
              "Running AWS auto-scaler as a service\nExecution log {}".format(
                  task.get_output_log_web_page()
              )
          )
  
      if args.remote:
          # if we are running remotely enqueue this run, and leave the process
          # the clearml-agent services will pick it up and execute it for us.
          task.execute_remotely(queue_name="services")
  
      driver = AWSDriver.from_config(conf)
      conf = ScalerConfig.from_config(conf)
      autoscaler = AutoScaler(conf, driver)
      if running_remotely() or args.run:
          autoscaler.start()
  
file_path: clearml/examples/services/aws-autoscaler/aws_autoscaler.py
imports: import json
  from argparse import ArgumentParser
  from collections import defaultdict
  from itertools import chain
  from pathlib import Path
  from typing import Tuple
  import yaml
  from clearml import Task
  from clearml.automation.auto_scaler import AutoScaler, ScalerConfig
  from clearml.automation.aws_driver import AWSDriver
  from clearml.config import running_remotely
  from clearml.utilities.wizard.user_input import get_input, input_bool, input_int, input_list, multiline_input
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types