Starts EC2 machines and builds a cluster.
350145
public static void launchEC2(Class<? extends Job> job, int boxes) throws Exception {
    EC2 ec2 = new EC2();
    ec2.boxes = boxes;
    Cloud c = ec2.resize();
    launch(c, job);
  }
13270
public void start() throws Exception {
    // Disable HDFS client caching to avoid file system close() affecting other clients
    System.setProperty("fs.hdfs.impl.disable.cache", "true");

    resetClientPools();

    setupTest();
    startMasters();
    startWorkers();
    startProxy();

    // Reset contexts so that they pick up the updated configuration.
    reset();
  }
1310511
def up_ec2(connection,
           region,
           instance_id,
           wait_for_ssh_available=True,
           log=False,
           timeout=600):
    

    # boot the ec2 instance
    instance = connection.start_instances(instance_ids=instance_id)[0]
    instance.update()
    while instance.state != "running" and timeout > 1:
        log_yellow("Instance state: %s" % instance.state)
        if log:
            log_yellow("Instance state: %s" % instance.state)
        sleep(10)
        timeout = timeout - 10
        instance.update()

    # and make sure we don't return until the instance is fully up
    if wait_for_ssh_available:
        wait_for_ssh(instance.ip_address)
351460
public void start() {
        stop();  // Make sure any currently running dispatchers are stopped.
        // Create the cache dispatcher and start it.
        mCacheDispatcher = new CacheDispatcher(mCacheQueue, mNetworkQueue, mCache, mDelivery);
        mCacheDispatcher.start();

        // Create network dispatchers (and corresponding threads) up to the pool size.
        for (int i = 0; i < mDispatchers.length; i++) {
            NetworkDispatcher networkDispatcher = new NetworkDispatcher(mNetworkQueue, mNetwork,
                    mCache, mDelivery);
            mDispatchers[i] = networkDispatcher;
            networkDispatcher.start();
        }
    }
472531
public function main()
    {
        $ec2 = $this->getService();

        $instance = $ec2->describeInstances([
            'InstanceIds' => [$this->getInstanceId()]
        ]);

        $tag = array_filter(
            $instance['Reservations'][0]['Instances'][0]['Tags'],
            function ($tag) {
                return $tag['Key'] == 'aws:autoscaling:groupName';
            }
        );
        
        $this->project->setProperty($this->getProperty(), array_shift($tag)['Value']);
    }
40959
private void startServer(ServerHeartbeat server,
                           ClusterHeartbeat cluster,
                           Consumer<UpdateRackHeartbeat> consumer,
                           JoinFuture future)
  {
    String address = server.getAddress();
    int port = server.port();

    if (port <= 0) {
      throw new IllegalStateException(String.valueOf(server));
    }
    
    if ("".equals(address)) {
      address = "127.0.0.1";
    }
    
    int seedIndex = getSeedIndex(server, cluster);
    
    ServiceManagerClient client = createBartenderClient(server); // address, port);
    
    /*
    ServerHeartbeat serverHeartbeat = (ServerHeartbeat) server;
    int portBartender = serverHeartbeat.getPortBartender();
    */

    JoinServerResult result = new JoinServerResult(future,
                                                   client,
                                                   consumer);
    
    try {
      HeartbeatService heartbeat = client.service("remote://" + HeartbeatService.PATH)
                                         .as(HeartbeatService.class);

      heartbeat.join(address, port,
                     _selfServer.getClusterId(),
                     _selfServer.getAddress(),
                     _selfServer.port(),
                     _selfServer.getPortBartender(),
                     _selfServer.getDisplayName(),
                     _selfServer.getMachineHash(),
                     seedIndex,
                     result);
    } catch (Throwable e) {
      result.fail(e);
    }
  }
1081013
def build():
    
    try:
        cloud_config = CloudConfig()
        config_data = cloud_config.config_data('cluster')
        cloud_init = CloudInit()
        print(cloud_init.build(config_data))
    except CloudComposeException as ex:
        print(ex)
292052
def start(self):
        
        cert_path = os.path.join(self.work_dir, 'certificates')
        public_keys_dir = os.path.join(cert_path, 'public_keys')
        private_keys_dir = os.path.join(cert_path, 'private_keys')

        client_secret_file = os.path.join(private_keys_dir, "client.key")
        client_public, client_secret = zmq.auth.load_certificate(client_secret_file)
        server_public_file = os.path.join(public_keys_dir, "server.key")
        server_public, _ = zmq.auth.load_certificate(server_public_file)

        self.outgoing_msg_greenlet = gevent.spawn(self.outgoing_server_comms, server_public,
                                                  client_public, client_secret)
        self.outgoing_msg_greenlet.link_exception(self.on_exception)
        self.incoming_msg_greenlet = gevent.spawn(self.incoming_server_comms, server_public,
                                                  client_public, client_secret)
        self.incoming_msg_greenlet.link_exception(self.on_exception)

        logger.info('Waiting for detailed configuration from Beeswarm server.')
        gevent.joinall([self.outgoing_msg_greenlet])
534715
def create_server_ec2(connection,
                      region,
                      disk_name,
                      disk_size,
                      ami,
                      key_pair,
                      instance_type,
                      tags={},
                      security_groups=None,
                      delete_on_termination=True,
                      log=False,
                      wait_for_ssh_available=True):
    

    if log:
        log_green("Started...")
        log_yellow("...Creating EC2 instance...")

    ebs_volume = EBSBlockDeviceType()
    ebs_volume.size = disk_size
    bdm = BlockDeviceMapping()
    bdm[disk_name] = ebs_volume

    # get an ec2 ami image object with our choosen ami
    image = connection.get_all_images(ami)[0]
    # start a new instance
    reservation = image.run(1, 1,
                            key_name=key_pair,
                            security_groups=security_groups,
                            block_device_map=bdm,
                            instance_type=instance_type)

    # and get our instance_id
    instance = reservation.instances[0]

    #  and loop and wait until ssh is available
    while instance.state == u'pending':
        if log:
            log_yellow("Instance state: %s" % instance.state)
        sleep(10)
        instance.update()
    if log:
        log_green("Instance state: %s" % instance.state)
    if wait_for_ssh_available:
        wait_for_ssh(instance.public_dns_name)

    # update the EBS volumes to be deleted on instance termination
    if delete_on_termination:
        for dev, bd in instance.block_device_mapping.items():
            instance.modify_attribute('BlockDeviceMapping',
                                      ["%s=%d" % (dev, 1)])

    # add a tag to our instance
    connection.create_tags([instance.id], tags)

    if log:
        log_green("Public dns: %s" % instance.public_dns_name)

    # returns our new instance
    return instance
1367354
def start(name, call=None):
    '''
    
    '''
    if call != 'action':
        raise SaltCloudSystemExit(
            'The stop action must be called with -a or --action.'
        )

    log.info('Starting node %s', name)

    instanceId = _get_node(name)['InstanceId']

    params = {'Action': 'StartInstance',
              'InstanceId': instanceId}
    result = query(params)

    return result
645220
public void launch() throws IOException, InterruptedException {
    this.eventBus.register(this);

    // Create Helix cluster and connect to it
    HelixUtils.createGobblinHelixCluster(this.zkConnectionString, this.helixClusterName, false);
    LOGGER.info("Created Helix cluster " + this.helixClusterName);

    connectHelixManager();

    // Core logic to launch cluster
    this.clusterId = getClusterId();

    // TODO: Add cluster monitoring
    countDownLatch.await();
  }
1001287
def _launch_instance(self):
        """"""
        resource = self._connect()

        instance_name = ipa_utils.generate_instance_name('ec2-ipa-test')
        kwargs = {
            'InstanceType': self.instance_type or EC2_DEFAULT_TYPE,
            'ImageId': self.image_id,
            'MaxCount': 1,
            'MinCount': 1,
            'TagSpecifications': [
                {
                    'ResourceType': 'instance',
                    'Tags': [
                        {
                            'Key': 'Name',
                            'Value': instance_name
                        }
                    ]
                }
            ]
        }

        if self.zone:
            kwargs['Placement'] = {'AvailabilityZone': self.zone}

        if self.ssh_key_name:
            kwargs['KeyName'] = self.ssh_key_name
        else:
            kwargs['UserData'] = self._get_user_data()

        if self.subnet_id:
            kwargs['SubnetId'] = self.subnet_id

        if self.security_group_id:
            kwargs['SecurityGroupIds'] = [self.security_group_id]

        try:
            instances = resource.create_instances(**kwargs)
        except Exception as error:
            raise EC2CloudException(
                'Unable to create instance: {0}.'.format(error)
            )

        self.running_instance_id = instances[0].instance_id
        self.logger.debug('ID of instance: %s' % self.running_instance_id)
        self._wait_on_instance('running', self.timeout)
63870
def build_and_start(query, directory):
    """"""

    Async(target=grep, args=[query, directory]).start()
1317765
def create_cluster(self):
        
        self.create_stack(
            self.cluster_name,
            'amazon-eks-cluster.yaml',
            parameters=define_parameters(
                ClusterName=self.cluster_name,
                ControlPlaneSecurityGroup=self.security_groups,
                Subnets=self.subnet_ids
            )
        )
578782
def run(
            self,
            cluster_config,
            rg_parser,
            partition_measurer,
            cluster_balancer,
            args,
    ):
        """"""
        self.cluster_config = cluster_config
        self.args = args
        with ZK(self.cluster_config) as self.zk:
            self.log.debug(
                'Starting %s for cluster: %s and zookeeper: %s',
                self.__class__.__name__,
                self.cluster_config.name,
                self.cluster_config.zookeeper,
            )
            brokers = self.zk.get_brokers()
            assignment = self.zk.get_cluster_assignment()
            pm = partition_measurer(
                self.cluster_config,
                brokers,
                assignment,
                args,
            )
            ct = ClusterTopology(
                assignment,
                brokers,
                pm,
                rg_parser.get_replication_group,
            )
            if len(ct.partitions) == 0:
                self.log.info("The cluster is empty. No actions to perform.")
                return

            # Exit if there is an on-going reassignment
            if self.is_reassignment_pending():
                self.log.error('Previous reassignment pending.')
                sys.exit(1)

            self.run_command(ct, cluster_balancer(ct, args))
878056
def _start_instance(self):
        
        try:
            vm_start = self.compute.virtual_machines.start(
                self.running_instance_id, self.running_instance_id
            )
        except Exception as error:
            raise AzureCloudException(
                'Unable to start instance: {0}.'.format(error)
            )

        vm_start.wait()
728567
function startWorkers(instances) {
	let stopping = false;

	cluster.on("exit", function(worker, code) {
		if (!stopping) {
			// only restart the worker if the exit was by an error
			if (production && code !== 0) {
				logger.info(`The worker #${worker.id} has disconnected`);
				logger.info(`Worker #${worker.id} restarting...`);
				cluster.fork();
				logger.info(`Worker #${worker.id} restarted`);
			} else {
				process.exit(code);
			}
		}
	});

	const workerCount = Number.isInteger(instances) && instances > 0 ? instances : os.cpus().length;

	logger.info(`Starting ${workerCount} workers...`);

	for (let i = 0; i < workerCount; i++) {
		cluster.fork();
	}

	stopSignals.forEach(function (signal) {
		process.on(signal, () => {
			logger.info(`Got ${signal}, stopping workers...`);
			stopping = true;
			cluster.disconnect(function () {
				logger.info("All workers stopped, exiting.");
				process.exit(0);
			});
		});
	});
}