Ejemplo n.º 1
0
 def _journal_thread(self):
     self._remoter = RemoteCmdRunnerBase.create_remoter(**self._remoter_params)
     read_from_timestamp = None
     while not self._termination_event.is_set():
         self._wait_ssh_up(verbose=False)
         self._retrieve_journal(since=read_from_timestamp)
         read_from_timestamp = datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S")
def provision_instances_with_fallback(
        provisioner: Provisioner, definitions: List[InstanceDefinition],
        pricing_model: PricingModel,
        fallback_on_demand: bool) -> List[VmInstance]:
    try:
        provision_with_retry(provisioner,
                             definitions=definitions,
                             pricing_model=pricing_model)
    except ProvisionError:
        if pricing_model.is_spot() and fallback_on_demand:
            provision_with_retry(provisioner,
                                 definitions=definitions,
                                 pricing_model=PricingModel.ON_DEMAND)
        else:
            raise

    provisioned_instances = provisioner.get_or_create_instances(
        definitions=definitions)
    for v_m in provisioned_instances:
        ssh_login_info = {
            'hostname': v_m.public_ip_address,
            'user': v_m.user_name,
            'key_file': f"~/.ssh/{v_m.ssh_key_name}"
        }
        remoter = RemoteCmdRunnerBase.create_remoter(**ssh_login_info)
        wait_cloud_init_completes(remoter=remoter, instance=v_m)
        # todo: wait for scylla-machine-image service to complete if instance is scylla-db?
        # todo: download cloud-init logs
    return provisioned_instances
Ejemplo n.º 3
0
 def get_remoter(self, host):
     self._ssh_pkey_file = tempfile.NamedTemporaryFile(mode="w",
                                                       delete=False)
     self._ssh_pkey_file.write(self.key_pair().private_key.decode())
     self._ssh_pkey_file.flush()
     return RemoteCmdRunnerBase.create_remoter(
         hostname=host,
         user=self.LOGIN_USER,
         key_file=self._ssh_pkey_file.name)
Ejemplo n.º 4
0
    def __init__(self):
        self.ssh_login_info = {
            'hostname': '34.253.205.91',
            'user': '******',
            'key_file': '~/.ssh/scylla-qa-ec2'
        }

        self.remoter = RemoteCmdRunnerBase.create_remoter(
            **self.ssh_login_info)
        self.ip_address = '34.253.205.91'
        self.cassandra_stress_version = '3.11'
Ejemplo n.º 5
0
 def get_remoter(
         self,
         host,
         connect_timeout: Optional[float] = None) -> RemoteCmdRunnerBase:
     self._ssh_pkey_file = tempfile.NamedTemporaryFile(mode="w",
                                                       delete=False)  # pylint: disable=consider-using-with
     self._ssh_pkey_file.write(self.key_pair.private_key.decode())
     self._ssh_pkey_file.flush()
     return RemoteCmdRunnerBase.create_remoter(
         hostname=host,
         user=self.LOGIN_USER,
         key_file=self._ssh_pkey_file.name,
         connect_timeout=connect_timeout)