diff --git a/packages/cli/src/concurrency/concurrency-control.service.ts b/packages/cli/src/concurrency/concurrency-control.service.ts index f5ba27e6b0..2849d19ae5 100644 --- a/packages/cli/src/concurrency/concurrency-control.service.ts +++ b/packages/cli/src/concurrency/concurrency-control.service.ts @@ -16,15 +16,15 @@ import { ConcurrencyQueue } from './concurrency-queue'; export const CLOUD_TEMP_PRODUCTION_LIMIT = 999; export const CLOUD_TEMP_REPORTABLE_THRESHOLDS = [5, 10, 20, 50, 100, 200]; -export type ConcurrencyType = 'production' | 'evaluation'; +export type ConcurrencyQueueType = 'production' | 'evaluation'; @Service() export class ConcurrencyControlService { private isEnabled: boolean; - private readonly limits: Map; + private readonly limits: Map; - private readonly queues: Map; + private readonly queues: Map; private readonly limitsToReport = CLOUD_TEMP_REPORTABLE_THRESHOLDS.map( (t) => CLOUD_TEMP_PRODUCTION_LIMIT - t, @@ -77,7 +77,7 @@ export class ConcurrencyControlService { if (this.shouldReport(capacity)) { this.telemetry.track('User hit concurrency limit', { threshold: CLOUD_TEMP_PRODUCTION_LIMIT - capacity, - concurrencyType: type, + concurrencyQueue: type, }); } }); @@ -87,7 +87,7 @@ export class ConcurrencyControlService { this.eventService.emit('execution-throttled', { executionId, type }); }); - queue.on('execution-released', async (executionId) => { + queue.on('execution-released', (executionId) => { this.logger.debug('Execution released', { executionId, type }); }); }); @@ -108,11 +108,7 @@ export class ConcurrencyControlService { async throttle({ mode, executionId }: { mode: ExecutionMode; executionId: string }) { if (!this.isEnabled || this.isUnlimited(mode)) return; - const queue = this.getQueue(mode); - - if (queue) { - await queue.enqueue(executionId); - } + await this.getQueue(mode)?.enqueue(executionId); } /** @@ -121,11 +117,7 @@ export class ConcurrencyControlService { release({ mode }: { mode: ExecutionMode }) { if (!this.isEnabled || this.isUnlimited(mode)) return; - const queue = this.getQueue(mode); - - if (queue) { - queue.dequeue(); - } + this.getQueue(mode)?.dequeue(); } /** @@ -134,11 +126,7 @@ export class ConcurrencyControlService { remove({ mode, executionId }: { mode: ExecutionMode; executionId: string }) { if (!this.isEnabled || this.isUnlimited(mode)) return; - const queue = this.getQueue(mode); - - if (queue) { - queue.remove(executionId); - } + this.getQueue(mode)?.remove(executionId); } /** @@ -190,9 +178,7 @@ export class ConcurrencyControlService { } private isUnlimited(mode: ExecutionMode) { - const queue = this.getQueue(mode); - - return queue === undefined; + return this.getQueue(mode) === undefined; } private shouldReport(capacity: number) { diff --git a/packages/editor-ui/src/components/executions/global/GlobalExecutionsList.vue b/packages/editor-ui/src/components/executions/global/GlobalExecutionsList.vue index 92f5f38c3e..1ab314ee03 100644 --- a/packages/editor-ui/src/components/executions/global/GlobalExecutionsList.vue +++ b/packages/editor-ui/src/components/executions/global/GlobalExecutionsList.vue @@ -73,6 +73,10 @@ const isAnnotationEnabled = computed( () => settingsStore.isEnterpriseFeatureEnabled[EnterpriseEditionFeature.AdvancedExecutionFilters], ); +/** + * Calculate the number of executions counted towards the production executions concurrency limit. + * Evaluation executions are not counted towards this limit and the evaluation limit isn't shown in the UI. + */ const runningExecutionsCount = computed(() => { return props.executions.filter( (execution) => diff --git a/packages/editor-ui/src/components/executions/workflow/WorkflowExecutionsSidebar.vue b/packages/editor-ui/src/components/executions/workflow/WorkflowExecutionsSidebar.vue index f578a85a1c..1255320c40 100644 --- a/packages/editor-ui/src/components/executions/workflow/WorkflowExecutionsSidebar.vue +++ b/packages/editor-ui/src/components/executions/workflow/WorkflowExecutionsSidebar.vue @@ -54,6 +54,10 @@ const executionListRef = ref(null); const workflowPermissions = computed(() => getResourcePermissions(props.workflow?.scopes).workflow); +/** + * Calculate the number of executions counted towards the production executions concurrency limit. + * Evaluation executions are not counted towards this limit and the evaluation limit isn't shown in the UI. + */ const runningExecutionsCount = computed(() => { return props.executions.filter( (execution) =>