code: def scale_cluster_up(num_cpus):
      print(f"Start to scale up to {num_cpus} cpus")
  
      def get_curr_cpus():
          return int(
              sum(
                  [
                      r.get("Resources", {}).get("CPU", 0)
                      for r in ray.nodes()
                  ]
              )
          )
  
      step = 1000
      curr_cpus = get_curr_cpus()
      target_cpus = curr_cpus
  
      while curr_cpus < num_cpus:
          curr_cpus = get_curr_cpus()
          new_target_cpus = min(curr_cpus + step, num_cpus)
          if new_target_cpus != target_cpus:
              target_cpus = new_target_cpus
              ray.autoscaler.sdk.request_resources(num_cpus=target_cpus)
          print(
              f"Waiting for cluster to be up: {curr_cpus}->{target_cpus}->{num_cpus}"
          )
          sleep(10)
  
file_path: ray/release/benchmarks/distributed/many_nodes_tests/actor_test.py
imports: import argparse
  import os
  import math
  from time import sleep, perf_counter
  import json
  import ray
  import psutil
label_desc: Use image node_id 3 for calling a global function with example usage: scale_cluster_up(num_cpus) and returns: int