diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 11125a40..51af3db2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,6 +16,7 @@ Fix - Booleans have been added as strings to the database table in SQLite. This has been fixed by adding a converting the values accordingly before writing them to the database. - Bugfix, where the same experiment has been pulled multiple times when using `n_jobs` > 1. +- Bugfix where the ssh passphrase was not correctly addressed in the documentation, and not been used correctly in the code. v1.4.0 (20.02.2024) diff --git a/docs/source/usage/database_credential_file.rst b/docs/source/usage/database_credential_file.rst index 602cb282..88d27ee0 100644 --- a/docs/source/usage/database_credential_file.rst +++ b/docs/source/usage/database_credential_file.rst @@ -35,11 +35,11 @@ The following example shows how to connect to a database server using an SSH ser server: example.mysqlserver.com (address from ssh server) address: ssh_hostname (either name/ip address of the ssh server or a name from you local ssh config file) port: optional_ssh_port (default: 22) - passphrase: passphrase + ssh_private_key_password: passphrase remote_address: optional_mysql_server_address (default: 127.0.0.1) remote_port: optional_mysql_server_port (default: 3306) local_address: optional_local_address (default: 127.0.0.1) local_port: optional_local_port (default: 3306) .. note:: - Note that we do not support further parameters for the SSH connection, such as explicitly setting the private key file. To use these, you have to adapt your local ssh config file. + Note that we do not support further parameters for the SSH connection, such as explicitly setting the private key file. To use these, you have to adapt your local ssh config file. \ No newline at end of file diff --git a/py_experimenter/database_connector_mysql.py b/py_experimenter/database_connector_mysql.py index 87b0a251..8c98db02 100644 --- a/py_experimenter/database_connector_mysql.py +++ b/py_experimenter/database_connector_mysql.py @@ -31,7 +31,7 @@ def get_ssh_tunnel(self, logger: Logger): parameters = dict(credentials["Ssh"]) ssh_address_or_host = parameters["address"] ssh_address_or_host_port = parameters["port"] if "port" in parameters else 22 - ssh_keypass = parameters["ssh_keypass"] if "ssh_keypass" in parameters else None + ssh_private_key_password = parameters["ssh_private_key_password"] if "ssh_private_key_password" in parameters else None remote_bind_address = parameters["remote_address"] if "remote_address" in parameters else "127.0.0.1" remote_bind_address_port = parameters["remote_port"] if "remote_port" in parameters else 3306 local_bind_address = parameters["local_address"] if "local_address" in parameters else "127.0.0.1" @@ -40,7 +40,7 @@ def get_ssh_tunnel(self, logger: Logger): try: tunnel = sshtunnel.SSHTunnelForwarder( ssh_address_or_host=(ssh_address_or_host, ssh_address_or_host_port), - ssh_pkey=ssh_keypass, + ssh_private_key_password=ssh_private_key_password, remote_bind_address=(remote_bind_address, remote_bind_address_port), local_bind_address=(local_bind_address, local_bind_address_port), logger=logger, @@ -179,4 +179,4 @@ def _get_column_names_from_entries(entries): self.execute(cursor, f"SHOW COLUMNS FROM {self.database_configuration.table_name}") column_names = _get_column_names_from_entries(self.fetchall(cursor)) - return column_names \ No newline at end of file + return column_names diff --git a/py_experimenter/experimenter.py b/py_experimenter/experimenter.py index cc7834b7..d25b8756 100644 --- a/py_experimenter/experimenter.py +++ b/py_experimenter/experimenter.py @@ -296,9 +296,13 @@ def unpause_experiment(self, experiment_id: int, experiment_function: Callable) :param experiment_function: _description_ The experiment function to use to continue the given experiment :type experiment_function: Callable """ + self._write_codecarbon_config() + keyfield_dict, _ = self.db_connector.pull_paused_experiment(experiment_id) self._execute_experiment(experiment_id, keyfield_dict, experiment_function) + self._delete_codecarbon_config() + def _worker(self, experiment_function: Callable[[Dict, Dict, ResultProcessor], None], random_order: bool) -> None: """ Worker that repeatedly pulls open experiments from the database table and executes them. diff --git a/pyproject.toml b/pyproject.toml index ba94262f..91619d19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "py-experimenter" -version = "1.4.1a3" +version = "1.4.1a4" description = "The PyExperimenter is a tool for the automatic execution of experiments, e.g. for machine learning (ML), capturing corresponding results in a unified manner in a database." authors = [ "Tanja Tornede ",