From 97b894ce49af76868e86eb701c738288ad2c0946 Mon Sep 17 00:00:00 2001 From: AlexejPenner Date: Fri, 26 Jul 2024 16:23:22 +0200 Subject: [PATCH 1/6] Better error message sagemaker, better documentation server env vars --- .../deploying-zenml/deploy-with-docker.md | 3 ++- src/zenml/config/server_config.py | 3 +++ .../aws/orchestrators/sagemaker_orchestrator.py | 17 +++++++++++++---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/docs/book/getting-started/deploying-zenml/deploy-with-docker.md b/docs/book/getting-started/deploying-zenml/deploy-with-docker.md index f460674799f..0ca3c8d4a04 100644 --- a/docs/book/getting-started/deploying-zenml/deploy-with-docker.md +++ b/docs/book/getting-started/deploying-zenml/deploy-with-docker.md @@ -44,7 +44,8 @@ The following environment variables can be passed to the container: * **ZENML\_SERVER\_RATE\_LIMIT\_ENABLED**: This variable controls the rate limiting for ZenML API (currently only for the `LOGIN` endpoint). It is disabled by default, so set it to `1` only if you need to enable rate limiting. To determine unique users a `X_FORWARDED_FOR` header or `request.client.host` is used, so before enabling this make sure that your network configuration is associating proper information with your clients in order to avoid disruptions for legitimate requests. * **ZENML\_SERVER\_LOGIN\_RATE\_LIMIT\_MINUTE**: If rate limiting is enabled, this variable controls how many requests will be allowed to query the login endpoint in a one minute interval. Set it to a desired integer value; defaults to `5`. * **ZENML\_SERVER\_LOGIN\_RATE\_LIMIT\_DAY**: If rate limiting is enabled, this variable controls how many requests will be allowed to query the login endpoint in an interval of day interval. Set it to a desired integer value; defaults to `1000`. - +* **ZENML\_SERVER\_JWT\_SECRET\_KEY**: If you want to make sure your session tokens remain valid when spinning servers down and up again, a constant JWT secret key should be set. Feel free to choose a random string. Change this value to invalidate all existing issued sessions. +* If none of the `ZENML_STORE_*` variables are set, the container will default to creating and using an SQLite database file stored at `/zenml/.zenconfig/local_stores/default_zen_store/zenml.db` inside the container. The `/zenml/.zenconfig/local_stores` base path where the default SQLite database is located can optionally be overridden by setting the `ZENML_LOCAL_STORES_PATH` environment variable to point to a different path (e.g. a persistent volume or directory that is mounted from the host). ### Secret store environment variables diff --git a/src/zenml/config/server_config.py b/src/zenml/config/server_config.py index 0fc4c336022..19521b82b6c 100644 --- a/src/zenml/config/server_config.py +++ b/src/zenml/config/server_config.py @@ -65,6 +65,9 @@ def generate_jwt_secret_key() -> str: class ServerConfiguration(BaseModel): """ZenML Server configuration attributes. + All these attributes can be set through the environment with the `ZENML_SERVER_`-Prefix. + The value of `$ZENML_SERVER_DEPLOYMENT_TYPE` will be extracted to deployment_type. + Attributes: deployment_type: The type of ZenML server deployment that is running. server_url: The URL where the ZenML server API is reachable. Must be diff --git a/src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py b/src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py index 98797069bb9..ecc5cf115ba 100644 --- a/src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py +++ b/src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py @@ -20,6 +20,7 @@ import boto3 import sagemaker +from botocore.exceptions import WaiterError from sagemaker.network import NetworkConfig from sagemaker.processing import ProcessingInput, ProcessingOutput from sagemaker.workflow.execution_variables import ExecutionVariables @@ -373,10 +374,18 @@ def prepare_or_run_pipeline( logger.info( "Executing synchronously. Waiting for pipeline to finish..." ) - pipeline_execution.wait( - delay=POLLING_DELAY, max_attempts=MAX_POLLING_ATTEMPTS - ) - logger.info("Pipeline completed successfully.") + try: + pipeline_execution.wait( + delay=POLLING_DELAY, max_attempts=MAX_POLLING_ATTEMPTS + ) + logger.info("Pipeline completed successfully.") + except WaiterError: + raise RuntimeError( + "Timed out while waiting for pipeline execution to finish. For long-running " + "pipelines we recommend configuring your orchestrator for asynchronous execution. " + "The following command does this for you: \n" + "`zenml orchestrator update --synchronous=False`" + ) def _get_region_name(self) -> str: """Returns the AWS region name. From 609cb09e009d2300599706a9c56629ced6034c05 Mon Sep 17 00:00:00 2001 From: Alexej Penner Date: Fri, 26 Jul 2024 16:31:53 +0200 Subject: [PATCH 2/6] Update src/zenml/config/server_config.py Co-authored-by: Michael Schuster --- src/zenml/config/server_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zenml/config/server_config.py b/src/zenml/config/server_config.py index 19521b82b6c..06b40752cee 100644 --- a/src/zenml/config/server_config.py +++ b/src/zenml/config/server_config.py @@ -66,7 +66,7 @@ class ServerConfiguration(BaseModel): """ZenML Server configuration attributes. All these attributes can be set through the environment with the `ZENML_SERVER_`-Prefix. - The value of `$ZENML_SERVER_DEPLOYMENT_TYPE` will be extracted to deployment_type. + The value of the `ZENML_SERVER_DEPLOYMENT_TYPE` environment variable will be extracted to deployment_type. Attributes: deployment_type: The type of ZenML server deployment that is running. From 7cf9c4fcec814ccaf2774cf5017a9a5552b2e117 Mon Sep 17 00:00:00 2001 From: AlexejPenner Date: Fri, 26 Jul 2024 16:34:24 +0200 Subject: [PATCH 3/6] Applied code review --- .../integrations/aws/orchestrators/sagemaker_orchestrator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py b/src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py index ecc5cf115ba..33fa9595a31 100644 --- a/src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py +++ b/src/zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py @@ -384,7 +384,7 @@ def prepare_or_run_pipeline( "Timed out while waiting for pipeline execution to finish. For long-running " "pipelines we recommend configuring your orchestrator for asynchronous execution. " "The following command does this for you: \n" - "`zenml orchestrator update --synchronous=False`" + f"`zenml orchestrator update {self.name} --synchronous=False`" ) def _get_region_name(self) -> str: From 7a79563349f9a90691752944405b93272c013a97 Mon Sep 17 00:00:00 2001 From: AlexejPenner Date: Mon, 29 Jul 2024 13:20:37 +0200 Subject: [PATCH 4/6] Removed duplicate --- .../book/getting-started/deploying-zenml/deploy-with-docker.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/book/getting-started/deploying-zenml/deploy-with-docker.md b/docs/book/getting-started/deploying-zenml/deploy-with-docker.md index 0ca3c8d4a04..766723ea7b4 100644 --- a/docs/book/getting-started/deploying-zenml/deploy-with-docker.md +++ b/docs/book/getting-started/deploying-zenml/deploy-with-docker.md @@ -44,7 +44,6 @@ The following environment variables can be passed to the container: * **ZENML\_SERVER\_RATE\_LIMIT\_ENABLED**: This variable controls the rate limiting for ZenML API (currently only for the `LOGIN` endpoint). It is disabled by default, so set it to `1` only if you need to enable rate limiting. To determine unique users a `X_FORWARDED_FOR` header or `request.client.host` is used, so before enabling this make sure that your network configuration is associating proper information with your clients in order to avoid disruptions for legitimate requests. * **ZENML\_SERVER\_LOGIN\_RATE\_LIMIT\_MINUTE**: If rate limiting is enabled, this variable controls how many requests will be allowed to query the login endpoint in a one minute interval. Set it to a desired integer value; defaults to `5`. * **ZENML\_SERVER\_LOGIN\_RATE\_LIMIT\_DAY**: If rate limiting is enabled, this variable controls how many requests will be allowed to query the login endpoint in an interval of day interval. Set it to a desired integer value; defaults to `1000`. -* **ZENML\_SERVER\_JWT\_SECRET\_KEY**: If you want to make sure your session tokens remain valid when spinning servers down and up again, a constant JWT secret key should be set. Feel free to choose a random string. Change this value to invalidate all existing issued sessions. * If none of the `ZENML_STORE_*` variables are set, the container will default to creating and using an SQLite database file stored at `/zenml/.zenconfig/local_stores/default_zen_store/zenml.db` inside the container. The `/zenml/.zenconfig/local_stores` base path where the default SQLite database is located can optionally be overridden by setting the `ZENML_LOCAL_STORES_PATH` environment variable to point to a different path (e.g. a persistent volume or directory that is mounted from the host). @@ -254,7 +253,7 @@ The environment variables starting with _ZENML\_SERVER\_SECURE\_HEADERS\__\* can The following secure headers environment variables are supported: -* _ZENML\_SERVER\_SECURE\_HEADERS\_SERVER_\*: The `Server` HTTP header value used to identify the server. The default value is the ZenML server ID. +* **ZENML\_SERVER\_SECURE\_HEADERS\_SERVER**: The `Server` HTTP header value used to identify the server. The default value is the ZenML server ID. * **ZENML\_SERVER\_SECURE\_HEADERS\_HSTS**: The `Strict-Transport-Security` HTTP header value. The default value is `max-age=63072000; includeSubDomains`. * **ZENML\_SERVER\_SECURE\_HEADERS\_XFO**: The `X-Frame-Options` HTTP header value. The default value is `SAMEORIGIN`. * **ZENML\_SERVER\_SECURE\_HEADERS\_XXP**: The `X-XSS-Protection` HTTP header value. The default value is `0`. NOTE: this header is deprecated and should not be customized anymore. The `Content-Security-Policy` header should be used instead. From 2f3cd46841e09e9dec27da94a73abc85b4932308 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 29 Jul 2024 11:23:03 +0000 Subject: [PATCH 5/6] Auto-update of Starter template --- examples/quickstart/.copier-answers.yml | 2 +- examples/quickstart/README.md | 8 ++++---- examples/quickstart/quickstart.ipynb | 12 ++++++------ examples/quickstart/requirements.txt | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/quickstart/.copier-answers.yml b/examples/quickstart/.copier-answers.yml index c620a904e70..b809d130c67 100644 --- a/examples/quickstart/.copier-answers.yml +++ b/examples/quickstart/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: 2024.06.06 +_commit: 2024.07.26 _src_path: gh:zenml-io/template-starter email: info@zenml.io full_name: ZenML GmbH diff --git a/examples/quickstart/README.md b/examples/quickstart/README.md index 23c8f24e66a..10dc01e622d 100644 --- a/examples/quickstart/README.md +++ b/examples/quickstart/README.md @@ -139,7 +139,7 @@ zenml model list This will show you a new `breast_cancer_classifier` model with two versions, `sgd` and `rf` created. You can find out how this was configured in the [YAML pipeline configuration files](configs/). -If you are a [ZenML Cloud](https://zenml.io/cloud) user, you can see all of this visualized in the dashboard: +If you are a [ZenML Pro](https://zenml.io/pro) user, you can see all of this visualized in the dashboard: Model Control Plane @@ -165,7 +165,7 @@ While we've demonstrated a manual promotion process for clarity, a more in-depth Model Control Plane -Again, if you are a [ZenML Cloud](https://zenml.io/cloud) user, you would be able to see all this in the cloud dashboard. +Again, if you are a [ZenML Pro](https://zenml.io/pro) user, you would be able to see all this in the cloud dashboard. @@ -184,7 +184,7 @@ that were returned in the pipeline. This completes the MLOps loop of training to Inference pipeline -You can also see all predictions ever created as a complete history in the dashboard (Again only for [ZenML Cloud](https://zenml.io/cloud) users): +You can also see all predictions ever created as a complete history in the dashboard (Again only for [ZenML Pro](https://zenml.io/pro) users): Model Control Plane @@ -203,7 +203,7 @@ If you want to learn more about ZenML as a tool, then the to get started. In particular, the [Production Guide](https://docs.zenml.io/user-guide/production-guide/) goes into more detail as to how to transition these same pipelines into production on the cloud. -The best way to get a production ZenML instance up and running with all batteries included is the [ZenML Cloud](https://zenml.io/cloud). Check it out! +The best way to get a production ZenML instance up and running with all batteries included is the [ZenML Pro](https://zenml.io/pro). Check it out! Also, make sure to join our Slack diff --git a/examples/quickstart/quickstart.ipynb b/examples/quickstart/quickstart.ipynb index a91efa28792..91737c968da 100644 --- a/examples/quickstart/quickstart.ipynb +++ b/examples/quickstart/quickstart.ipynb @@ -101,14 +101,14 @@ "id": "966ce581", "metadata": {}, "source": [ - "## ☁️ Step 1: Connect to ZenML Cloud\n", + "## ☁️ Step 1: Connect to ZenML Pro\n", "\n", - "If you are using [ZenML Cloud](https://zenml.io/cloud), execute the following\n", + "If you are using [ZenML Pro](https://zenml.io/pro), execute the following\n", "cell with your tenant URL. Otherwise ignore.\n", "\n", - "ZenML Cloud is a managed service that provides a hosted ZenML environment. It\n", + "ZenML Pro is a managed service that provides a hosted ZenML environment. It\n", "allows you to run your pipelines on the cloud, manage your metadata, and\n", - "collaborate with your team. Sign up at [ZenML Cloud](https://zenml.io/cloud) for\n", + "collaborate with your team. Sign up [here](https://zenml.io/pro) for\n", "a free trial and to get started!" ] }, @@ -858,7 +858,7 @@ "id": "53517a9a", "metadata": {}, "source": [ - "If you are a [ZenML Cloud](https://zenml.io/cloud) user, you can see all of this visualized in the dashboard:\n", + "If you are a [ZenML Pro](https://zenml.io/pro) user, you can see all of this visualized in the dashboard:\n", "\n", "\"Model" ] @@ -1102,7 +1102,7 @@ "## What next?\n", "\n", "* If you have questions or feedback... join our [**Slack Community**](https://zenml.io/slack) and become part of the ZenML family!\n", - "* If you want to quickly get started with ZenML, check out the [ZenML Cloud](https://zenml.io/cloud)." + "* If you want to quickly get started with ZenML, check out [ZenML Pro](https://zenml.io/pro)." ] } ], diff --git a/examples/quickstart/requirements.txt b/examples/quickstart/requirements.txt index 060cab40b59..d38ead5e262 100644 --- a/examples/quickstart/requirements.txt +++ b/examples/quickstart/requirements.txt @@ -1,4 +1,4 @@ zenml[server]>=0.50.0 notebook -scikit-learn<1.3 +scikit-learn pyarrow From 8556c7d4679c9d2b6e4608cd0ba89dfdb3e56f41 Mon Sep 17 00:00:00 2001 From: AlexejPenner Date: Mon, 29 Jul 2024 13:26:02 +0200 Subject: [PATCH 6/6] Removed duplicate --- docs/book/getting-started/deploying-zenml/deploy-with-docker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/book/getting-started/deploying-zenml/deploy-with-docker.md b/docs/book/getting-started/deploying-zenml/deploy-with-docker.md index 766723ea7b4..ab0bb0393f9 100644 --- a/docs/book/getting-started/deploying-zenml/deploy-with-docker.md +++ b/docs/book/getting-started/deploying-zenml/deploy-with-docker.md @@ -44,7 +44,7 @@ The following environment variables can be passed to the container: * **ZENML\_SERVER\_RATE\_LIMIT\_ENABLED**: This variable controls the rate limiting for ZenML API (currently only for the `LOGIN` endpoint). It is disabled by default, so set it to `1` only if you need to enable rate limiting. To determine unique users a `X_FORWARDED_FOR` header or `request.client.host` is used, so before enabling this make sure that your network configuration is associating proper information with your clients in order to avoid disruptions for legitimate requests. * **ZENML\_SERVER\_LOGIN\_RATE\_LIMIT\_MINUTE**: If rate limiting is enabled, this variable controls how many requests will be allowed to query the login endpoint in a one minute interval. Set it to a desired integer value; defaults to `5`. * **ZENML\_SERVER\_LOGIN\_RATE\_LIMIT\_DAY**: If rate limiting is enabled, this variable controls how many requests will be allowed to query the login endpoint in an interval of day interval. Set it to a desired integer value; defaults to `1000`. -* + If none of the `ZENML_STORE_*` variables are set, the container will default to creating and using an SQLite database file stored at `/zenml/.zenconfig/local_stores/default_zen_store/zenml.db` inside the container. The `/zenml/.zenconfig/local_stores` base path where the default SQLite database is located can optionally be overridden by setting the `ZENML_LOCAL_STORES_PATH` environment variable to point to a different path (e.g. a persistent volume or directory that is mounted from the host). ### Secret store environment variables