mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-29 16:15:51 +00:00
improve global cache to s3 panel
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
import Toggle from '$lib/components/Toggle.svelte'
|
||||
import Tooltip from '$lib/components/Tooltip.svelte'
|
||||
import { WorkerService, type WorkerPing, SettingService } from '$lib/gen'
|
||||
import { enterpriseLicense } from '$lib/stores'
|
||||
import { enterpriseLicense, superadmin } from '$lib/stores'
|
||||
import { sendUserToast } from '$lib/toast'
|
||||
import { displayDate, groupBy } from '$lib/utils'
|
||||
import { onDestroy, onMount } from 'svelte'
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
async function loadGlobalCache() {
|
||||
try {
|
||||
globalCache = (await SettingService.getGlobal({ key: worker_s3_bucket_sync })) ?? false
|
||||
globalCache = (await SettingService.getGlobal({ key: worker_s3_bucket_sync })) ?? true
|
||||
} catch (err) {
|
||||
sendUserToast(`Could not load global cache: ${err}`, true)
|
||||
}
|
||||
@@ -75,31 +75,36 @@
|
||||
documentationLink="https://www.windmill.dev/docs/core_concepts/worker_groups"
|
||||
/>
|
||||
|
||||
<div class="flex flex-row-reverse w-full pb-2 items-center gap-2">
|
||||
<Tooltip
|
||||
>global cache to s3 is an enterprise feature that enable workers to do fast cold start and
|
||||
share a single cache backed by s3 to ensure that even with a high number of workers,
|
||||
dependencies for python/deno/bun/go are only downloaded for the first time only once by the
|
||||
whole fleet. require S3_CACHE_BUCKET to be set.</Tooltip
|
||||
>
|
||||
<Toggle
|
||||
checked={globalCache}
|
||||
on:change={async (e) => {
|
||||
try {
|
||||
console.log('Setting global cache to', e.detail)
|
||||
await SettingService.setGlobal({
|
||||
key: worker_s3_bucket_sync,
|
||||
requestBody: { value: e.detail }
|
||||
})
|
||||
globalCache = e.detail
|
||||
} catch (err) {
|
||||
sendUserToast(`Could not set global cache: ${err}`, true)
|
||||
}
|
||||
}}
|
||||
options={{ right: 'global cache to s3' }}
|
||||
disabled={!$enterpriseLicense}
|
||||
/>
|
||||
</div>
|
||||
{#if $superadmin}
|
||||
<div class="flex flex-row-reverse w-full pb-2 items-center gap-2">
|
||||
<Tooltip
|
||||
><p
|
||||
>global cache to s3 is an enterprise feature that enable workers to do fast cold start and
|
||||
share a single cache backed by s3 to ensure that even with a high number of workers,
|
||||
dependencies for python/deno/bun/go are only downloaded for the first time only once by
|
||||
the whole fleet.
|
||||
</p>require S3_CACHE_BUCKET to be set and has NO effect otherwise (even if this setting is
|
||||
on)</Tooltip
|
||||
>
|
||||
<Toggle
|
||||
checked={globalCache}
|
||||
on:change={async (e) => {
|
||||
try {
|
||||
console.log('Setting global cache to', e.detail)
|
||||
await SettingService.setGlobal({
|
||||
key: worker_s3_bucket_sync,
|
||||
requestBody: { value: e.detail }
|
||||
})
|
||||
globalCache = e.detail
|
||||
} catch (err) {
|
||||
sendUserToast(`Could not set global cache: ${err}`, true)
|
||||
}
|
||||
}}
|
||||
options={{ right: 'global cache to s3' }}
|
||||
disabled={!$enterpriseLicense}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
{#if workers != undefined}
|
||||
{#if groupedWorkers.length == 0}
|
||||
<p>No workers seems to be available</p>
|
||||
|
||||
Reference in New Issue
Block a user