From ac1f4b01be775c262e595cec8c12d8526a3f982d Mon Sep 17 00:00:00 2001 From: Aolin Date: Mon, 5 Dec 2022 12:07:18 +0800 Subject: [PATCH 1/3] wait_for_ready is deprecated and replaced by wait_for_available Signed-off-by: Aolin --- README.md | 4 ++-- examples/2_1_create_serverless_cluster.py | 2 +- examples/2_2_create_dedicated_cluster.py | 2 +- examples/4_scale_a_cluster.py | 2 +- tidbcloudy/project.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b45f1e7..2fafbed 100644 --- a/README.md +++ b/README.md @@ -160,7 +160,7 @@ config\ cluster = project.create_cluster(config) print(cluster) -cluster.wait_for_ready() +cluster.wait_for_available() ``` ### Connect to TiDB @@ -223,7 +223,7 @@ print("The original config is: {}".format(cluster.config.components.to_object()) new_config = UpdateClusterConfig() new_config.update_component("tiflash", node_quantity=1, node_size="8C64G", storage_size_gib=500) cluster.update(new_config) -cluster.wait_for_ready() +cluster.wait_for_available() print("The new config is: {}".format(cluster.config.components.to_object())) ``` diff --git a/examples/2_1_create_serverless_cluster.py b/examples/2_1_create_serverless_cluster.py index 2b2dcfb..6705876 100644 --- a/examples/2_1_create_serverless_cluster.py +++ b/examples/2_1_create_serverless_cluster.py @@ -23,4 +23,4 @@ cluster = project.create_cluster(config) print(cluster) -cluster.wait_for_ready() +cluster.wait_for_available() diff --git a/examples/2_2_create_dedicated_cluster.py b/examples/2_2_create_dedicated_cluster.py index ee78c2f..da661cc 100644 --- a/examples/2_2_create_dedicated_cluster.py +++ b/examples/2_2_create_dedicated_cluster.py @@ -25,4 +25,4 @@ cluster = project.create_cluster(config) print(cluster) -cluster.wait_for_ready() +cluster.wait_for_available() diff --git a/examples/4_scale_a_cluster.py b/examples/4_scale_a_cluster.py index ca436e7..579dbdf 100644 --- a/examples/4_scale_a_cluster.py +++ b/examples/4_scale_a_cluster.py @@ -17,5 +17,5 @@ new_config = UpdateClusterConfig() new_config.update_component("tiflash", node_quantity=1, node_size="8C64G", storage_size_gib=500) cluster.update(new_config) -cluster.wait_for_ready() +cluster.wait_for_available() print("The new config is: {}".format(cluster.config.components.to_object())) diff --git a/tidbcloudy/project.py b/tidbcloudy/project.py index c55de7a..d7dff20 100644 --- a/tidbcloudy/project.py +++ b/tidbcloudy/project.py @@ -45,7 +45,7 @@ def create_cluster(self, config: Union[CreateClusterConfig, dict]) -> Cluster: .add_ip_access(cidr="your ip") \ .add_ip_access(cidr="your ip") cluster = project.create_cluster(config) - cluster.wait_for_ready() + cluster.wait_for_available() """ if isinstance(config, CreateClusterConfig): config = config.to_object() From 6ecac49ce60e47872b573f3619b7097a5c18f5c0 Mon Sep 17 00:00:00 2001 From: Aolin Date: Mon, 5 Dec 2022 12:07:49 +0800 Subject: [PATCH 2/3] Fix the issue that wait_for_available fails to get the status of a cluster when creating Signed-off-by: Aolin --- tidbcloudy/cluster.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tidbcloudy/cluster.py b/tidbcloudy/cluster.py index ac1f541..c372669 100644 --- a/tidbcloudy/cluster.py +++ b/tidbcloudy/cluster.py @@ -51,11 +51,10 @@ def wait_for_available(self, *, timeout_sec: int = None, interval_sec: int = 10) cluster_config = CreateClusterConfig() cluster_config.set_name("your_cluster_name").set_cluster_type("your_cluster_type").set_cloud_provider("your_cloud_provider").set_region("your_region").set_port(4000).set_root_password("your_root_password") cluster = project.create_cluster(cluster_config) - cluster.wait_for_ready() + cluster.wait_for_available() """ time_start = time.monotonic() counter = 1 - log("Cluster id={} is {}".format(self.id, self.status.cluster_status.value)) while True: duration = time.monotonic() - time_start minutes = duration - 60 * counter From 6407627904eed25ee2b9000b630944e4951bf66a Mon Sep 17 00:00:00 2001 From: Aolin Date: Mon, 5 Dec 2022 12:08:31 +0800 Subject: [PATCH 3/3] Release 1.0.3 Signed-off-by: Aolin --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f379234..74e5fb4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "tidbcloudy" -version = "1.0.2" +version = "1.0.3" description = "Python SDK for TiDB Cloud" readme = "README.md" authors = ["Aolin "]