From d63f5ee26e41ee763505b5fda220c5a30865c60e Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sat, 23 Mar 2024 18:42:38 +0100 Subject: [PATCH] fix: add support for azure storage on distributed cache/logs --- backend/windmill-api/openapi.yaml | 31 +++- backend/windmill-api/src/settings.rs | 9 +- .../windmill-worker/src/python_executor.rs | 2 +- .../ObjectStoreConfigSettings.svelte | 149 ++++++++++++++---- .../src/lib/components/TestConnection.svelte | 2 +- .../src/lib/components/instanceSettings.ts | 2 +- 6 files changed, 149 insertions(+), 46 deletions(-) diff --git a/backend/windmill-api/openapi.yaml b/backend/windmill-api/openapi.yaml index 34b9027bd2..130e1014e9 100644 --- a/backend/windmill-api/openapi.yaml +++ b/backend/windmill-api/openapi.yaml @@ -718,24 +718,47 @@ paths: schema: type: string - /settings/test_s3_config: + + # pub use_ssl: Option, + # #[serde(rename = "accountName")] + # pub account_name: String, + # #[serde(rename = "tenantId")] + # pub tenant_id: Option, + # #[serde(rename = "clientId")] + # pub client_id: Option, + # #[serde(rename = "containerName")] + # pub container_name: String, + # #[serde(rename = "accessKey")] + # pub access_key: Option, + + /settings/test_object_storage_config: post: - summary: test s3 config - operationId: testS3Config + summary: test object storage config + operationId: testObjectStorageConfig tags: - setting requestBody: - description: test s3 config + description: test object storage config required: true content: application/json: schema: type: object properties: + type: + type: string bucket: type: string region: type: string + accessKey: + type: string + accountName: + type: string + tenantId: + type: string + clientId: + type: string access_key: type: string secret_key: diff --git a/backend/windmill-api/src/settings.rs b/backend/windmill-api/src/settings.rs index 43c144066b..197b529014 100644 --- a/backend/windmill-api/src/settings.rs +++ b/backend/windmill-api/src/settings.rs @@ -44,7 +44,7 @@ pub fn global_service() -> Router { #[cfg(feature = "parquet")] { - return r.route("/test_s3_config", post(test_s3_bucket)); + return r.route("/test_object_storage_config", post(test_s3_bucket)); } #[cfg(not(feature = "parquet"))] @@ -126,7 +126,7 @@ pub async fn test_s3_bucket( "/test-s3-bucket-{uuid}", uuid = uuid::Uuid::new_v4() )); - tracing::info!("Testing s3 bucket at path: {path}"); + tracing::info!("Testing blob storage at path: {path}"); client .put(&path, Bytes::from_static(b"hello")) .await @@ -140,13 +140,14 @@ pub async fn test_s3_bucket( .map_err(to_anyhow)?; if content != Bytes::from_static(b"hello") { return Err(error::Error::InternalErr( - "Failed to read back from s3".to_string(), + "Failed to read back from blob storage".to_string(), )); } client.delete(&path).await.map_err(to_anyhow)?; - Ok("Tested bucket successfully".to_string()) + Ok("Tested blob storage successfully".to_string()) } + #[derive(Deserialize)] pub struct TestKey { pub license_key: String, diff --git a/backend/windmill-worker/src/python_executor.rs b/backend/windmill-worker/src/python_executor.rs index eab0d419f2..fbcae34469 100644 --- a/backend/windmill-worker/src/python_executor.rs +++ b/backend/windmill-worker/src/python_executor.rs @@ -860,7 +860,7 @@ pub async fn handle_python_reqs( job_id.clone(), w_id.to_string(), format!( - "pulled {} from s3 cache in {}ms", + "pulled {} from distributed cache in {}ms", pulled.join(", "), start.elapsed().as_millis() ), diff --git a/frontend/src/lib/components/ObjectStoreConfigSettings.svelte b/frontend/src/lib/components/ObjectStoreConfigSettings.svelte index d0814ea8f8..fa1734abc2 100644 --- a/frontend/src/lib/components/ObjectStoreConfigSettings.svelte +++ b/frontend/src/lib/components/ObjectStoreConfigSettings.svelte @@ -1,12 +1,12 @@