예제 #1
0
class Downscaling(Thread):
    def __init__(self, config):

        Thread.__init__(self)
        self.config = config

    def run(self):
        LOG.info("Starting Downscaling")

        # Get information about available clouds
        self.clouds = Clouds(self.config)

        # Potentially terminate some/all instances from the previous experiment
        self.clouds.selected_terminate()

        # Launch master and worker nodes
        self.master = Master(self.config, self.clouds)
        self.clouds = Clouds(self.config)

        self.phantom_client = PhantomClient(self.config, self.master)
        self.phantom_client.connect()
        self.phantom_client.create_launch_configs()
        self.phantom_client.create_auto_scaling_group()

        # Wait until all workers register with master (as Idle resources)
        self.initialmonitor = InitialMonitor(self.config, self.master, self.phantom_client.asg.desired_capacity)
        self.initialmonitor.start()
        self.initialmonitor.join()

        # Launch workload submission thread
        self.workload = Workload(self.config, self.master)
        self.workload.start()

        # Start downscaling policy
        self.policy = Policy(self.config, self.master, self.phantom_client)
        self.policy.start()

        # Sleep while there is work to be done still
        self.workload.join()

        # Stop downscaling policy
        self.policy.stop()
        time.sleep(60)

        # Copy the master log back
        self.workload.scp_log_back()

        # Terminate some/all instances

        self.phantom_client.delete_all_launch_config()
        self.phantom_client.delete_all_domains()
        #self.master.terminate()

        return
예제 #2
0
파일: cleanup.py 프로젝트: dmdu/downscaling
    def run(self):
        LOG.info("Starting Cleanup")

        phantom_client = PhantomClient(self.config, master=None)
        phantom_client.connect()
        phantom_client.delete_all_launch_config()
        phantom_client.delete_all_domains()

        all_domains = phantom_client.conn.get_all_groups()
        for domain in all_domains:
            print phantom_client.get_autoscale_groups_info(domain.name)