diff --git a/examples/quickstart/quickstart.ipynb b/examples/quickstart/quickstart.ipynb index 03ef6b283f2..ee14d95ef73 100644 --- a/examples/quickstart/quickstart.ipynb +++ b/examples/quickstart/quickstart.ipynb @@ -628,8 +628,8 @@ " dataset_trn, dataset_tst = feature_engineering()\n", " else:\n", " # Load the datasets from an older pipeline\n", - " dataset_trn = client.get_artifact_version(id=train_dataset_id)\n", - " dataset_tst = client.get_artifact_version(id=test_dataset_id) \n", + " dataset_trn = client.get_artifact_version(name_id_or_prefix=train_dataset_id)\n", + " dataset_tst = client.get_artifact_version(name_id_or_prefix=test_dataset_id) \n", "\n", " trained_model = model_trainer(\n", " dataset_trn=dataset_trn,\n", @@ -970,8 +970,8 @@ "@pipeline\n", "def inference(preprocess_pipeline_id: UUID):\n", " \"\"\"Model batch inference pipeline\"\"\"\n", - " # random_state = client.get_artifact_version(id=preprocess_pipeline_id).metadata[\"random_state\"].value\n", - " # target = client.get_artifact_version(id=preprocess_pipeline_id).run_metadata['target'].value\n", + " # random_state = client.get_artifact_version(name_id_or_prefix=preprocess_pipeline_id).metadata[\"random_state\"].value\n", + " # target = client.get_artifact_version(name_id_or_prefix=preprocess_pipeline_id).run_metadata['target'].value\n", " random_state = 42\n", " target = \"target\"\n", "\n", @@ -981,7 +981,7 @@ " df_inference = inference_preprocessor(\n", " dataset_inf=df_inference,\n", " # We use the preprocess pipeline from the feature engineering pipeline\n", - " preprocess_pipeline=client.get_artifact_version(id=preprocess_pipeline_id),\n", + " preprocess_pipeline=client.get_artifact_version(name_id_or_prefix=preprocess_pipeline_id),\n", " target=target,\n", " )\n", " inference_predict(\n", diff --git a/src/zenml/analytics/context.py b/src/zenml/analytics/context.py index 8c360bd56e5..fbe8cb38cdf 100644 --- a/src/zenml/analytics/context.py +++ b/src/zenml/analytics/context.py @@ -52,6 +52,7 @@ def __init__(self) -> None: self.user_id: Optional[UUID] = None self.external_user_id: Optional[UUID] = None + self.executed_by_service_account: Optional[bool] = None self.client_id: Optional[UUID] = None self.server_id: Optional[UUID] = None @@ -82,11 +83,17 @@ def __enter__(self) -> "AnalyticsContext": auth_context = get_auth_context() if auth_context is not None: self.user_id = auth_context.user.id + self.executed_by_service_account = ( + auth_context.user.is_service_account + ) self.external_user_id = auth_context.user.external_user_id else: # If the code is running on the client, use the default user. active_user = gc.zen_store.get_user() self.user_id = active_user.id + self.executed_by_service_account = ( + active_user.is_service_account + ) self.external_user_id = active_user.external_user_id # Fetch the `client_id` @@ -247,6 +254,7 @@ def track( "server_id": str(self.server_id), "deployment_type": str(self.deployment_type), "database_type": str(self.database_type), + "executed_by_service_account": self.executed_by_service_account, } )