diff --git a/src/components/DeploymentForm.vue b/src/components/DeploymentForm.vue
index eeba49a2d..7b667fccc 100644
--- a/src/components/DeploymentForm.vue
+++ b/src/components/DeploymentForm.vue
@@ -35,6 +35,10 @@
+
+
+
+
@@ -84,7 +88,7 @@
import { JobVariableOverridesInput, WorkPoolCombobox, WorkPoolQueueCombobox } from '@/components'
import ToastParameterValidationError from '@/components/ToastParameterValidationError.vue'
import { localization } from '@/localization'
- import { Deployment, DeploymentUpdateV2 } from '@/models'
+ import { Deployment, deploymentCollisionStrategies, DeploymentUpdateV2 } from '@/models'
import { DeploymentCreate } from '@/models/DeploymentCreate'
import { SchemaInputV2 } from '@/schemas'
import { useSchemaValidation } from '@/schemas/compositions/useSchemaValidation'
@@ -104,6 +108,7 @@
const workPoolName = ref(props.deployment.workPoolName)
const workQueueName = ref(props.deployment.workQueueName)
const concurrencyLimit = ref(props.deployment.concurrencyLimit)
+ const concurrencyLimitCollisionStrategy = ref(props.deployment.concurrencyOptions?.collisionStrategy)
const parameters = ref(props.deployment.parameters)
const tags = ref(props.deployment.tags)
const jobVariables = ref(stringify(props.deployment.jobVariables))
@@ -186,6 +191,7 @@
infrastructureDocumentId: props.deployment.infrastructureDocumentId,
pullSteps: props.deployment.pullSteps,
concurrencyLimit: concurrencyLimit.value,
+ concurrencyOptions: concurrencyLimitCollisionStrategy.value ? { collisionStrategy: concurrencyLimitCollisionStrategy.value } : null,
}
emit('submit', deploymentCreate)
} else {
@@ -198,11 +204,10 @@
enforceParameterSchema: enforceParameterSchema.value,
jobVariables: JSON.parse(jobVariables.value),
concurrencyLimit: concurrencyLimit.value,
+ concurrencyOptions: concurrencyLimitCollisionStrategy.value ? { collisionStrategy: concurrencyLimitCollisionStrategy.value } : null,
}
emit('submit', deploymentUpdate)
}
-
-
}
const cancel = (): void => {
diff --git a/src/maps/deployment.ts b/src/maps/deployment.ts
index c3226a430..a9dcb36e9 100644
--- a/src/maps/deployment.ts
+++ b/src/maps/deployment.ts
@@ -1,8 +1,9 @@
import { sortStringArray } from '@prefecthq/prefect-design'
import { DeploymentFlowRunCreate, DeploymentFlowRunRequest, DeploymentUpdateRequest, DeploymentUpdateV2 } from '@/models'
+import { DeploymentApiConcurrencyOptions } from '@/models/api/DeploymentApiConcurrencyOptions'
import { DeploymentCreateRequest } from '@/models/api/DeploymentCreateRequest'
import { DeploymentResponse } from '@/models/api/DeploymentResponse'
-import { Deployment } from '@/models/Deployment'
+import { Deployment, DeploymentConcurrencyOptions } from '@/models/Deployment'
import { DeploymentCreate } from '@/models/DeploymentCreate'
import { createObjectLevelCan } from '@/models/ObjectLevelCan'
import { schemaV2Mapper } from '@/schemas'
@@ -37,10 +38,17 @@ export const mapDeploymentResponseToDeployment: MapFunction = function(source) {
return {
description: source.description,
@@ -52,6 +60,7 @@ export const mapDeploymentUpdateV2ToDeploymentUpdateRequest: MapFunction?]>
status: this.create('deploymentStatus'),
disabled: disabled,
concurrencyLimit: null,
+ globalConcurrencyLimit: null,
+ concurrencyOptions: null,
...overrides,
}
}
diff --git a/src/models/Deployment.ts b/src/models/Deployment.ts
index c0d2f7907..e6454af17 100644
--- a/src/models/Deployment.ts
+++ b/src/models/Deployment.ts
@@ -1,8 +1,17 @@
+import { ConcurrencyV2Limit } from '@/models/ConcurrencyV2Limit'
import { CreatedOrUpdatedBy } from '@/models/CreatedOrUpdatedBy'
import { DeploymentSchedule } from '@/models/DeploymentSchedule'
import { DeploymentStatus } from '@/models/DeploymentStatus'
import { ObjectLevelCan } from '@/models/ObjectLevelCan'
import { SchemaV2, SchemaValuesV2 } from '@/schemas'
+import { createTuple } from '@/utilities'
+
+export const { values: deploymentCollisionStrategies, isValue: isDeploymentCollisionStrategy } = createTuple(['ENQUEUE', 'CANCEL_NEW'])
+export type DeploymentCollisionStrategy = typeof deploymentCollisionStrategies[number]
+
+export type DeploymentConcurrencyOptions = {
+ collisionStrategy: DeploymentCollisionStrategy,
+}
export interface IDeployment {
id: string,
@@ -32,7 +41,8 @@ export interface IDeployment {
can: ObjectLevelCan<'deployment'>,
status: DeploymentStatus,
disabled: boolean,
- concurrencyLimit: number | null,
+ globalConcurrencyLimit: ConcurrencyV2Limit | null,
+ concurrencyOptions: DeploymentConcurrencyOptions | null,
}
export class Deployment implements IDeployment {
@@ -64,7 +74,8 @@ export class Deployment implements IDeployment {
public can: ObjectLevelCan<'deployment'>
public status: DeploymentStatus
public disabled: boolean
- public concurrencyLimit: number | null
+ public globalConcurrencyLimit: ConcurrencyV2Limit | null
+ public concurrencyOptions: DeploymentConcurrencyOptions | null
public constructor(deployment: IDeployment) {
this.id = deployment.id
@@ -94,7 +105,12 @@ export class Deployment implements IDeployment {
this.can = deployment.can
this.status = deployment.status
this.disabled = deployment.disabled
- this.concurrencyLimit = deployment.concurrencyLimit
+ this.globalConcurrencyLimit = deployment.globalConcurrencyLimit
+ this.concurrencyOptions = deployment.concurrencyOptions
+ }
+
+ public get concurrencyLimit(): number | null {
+ return this.globalConcurrencyLimit?.limit ?? null
}
public get deprecated(): boolean {
diff --git a/src/models/DeploymentCreate.ts b/src/models/DeploymentCreate.ts
index 0f65875d7..de91dafe7 100644
--- a/src/models/DeploymentCreate.ts
+++ b/src/models/DeploymentCreate.ts
@@ -1,3 +1,4 @@
+import { DeploymentConcurrencyOptions } from '@/models/Deployment'
import { DeploymentSchedule } from '@/models/DeploymentSchedule'
import { SchemaValuesV2 } from '@/schemas'
@@ -22,4 +23,5 @@ export type DeploymentCreate = {
enforceParameterSchema: boolean,
pullSteps: unknown,
concurrencyLimit: number | null,
+ concurrencyOptions: DeploymentConcurrencyOptions | null,
}
diff --git a/src/models/DeploymentUpdate.ts b/src/models/DeploymentUpdate.ts
index e8111f44c..c0f6128eb 100644
--- a/src/models/DeploymentUpdate.ts
+++ b/src/models/DeploymentUpdate.ts
@@ -1,3 +1,4 @@
+import { DeploymentConcurrencyOptions } from '@/models/Deployment'
import { SchemaValuesV2 } from '@/schemas'
type Base = {
@@ -9,6 +10,7 @@ type Base = {
jobVariables?: Record | null,
enforceParameterSchema?: boolean,
concurrencyLimit?: number | null,
+ concurrencyOptions?: DeploymentConcurrencyOptions | null,
}
type WithoutParameters = Base & {
diff --git a/src/models/api/DeploymentApiConcurrencyOptions.ts b/src/models/api/DeploymentApiConcurrencyOptions.ts
new file mode 100644
index 000000000..8f43cbc1b
--- /dev/null
+++ b/src/models/api/DeploymentApiConcurrencyOptions.ts
@@ -0,0 +1,3 @@
+export type DeploymentApiConcurrencyOptions = {
+ collision_strategy: 'ENQUEUE' | 'CANCEL_NEW',
+}
diff --git a/src/models/api/DeploymentCreateRequest.ts b/src/models/api/DeploymentCreateRequest.ts
index fe017263a..a2d231670 100644
--- a/src/models/api/DeploymentCreateRequest.ts
+++ b/src/models/api/DeploymentCreateRequest.ts
@@ -1,3 +1,4 @@
+import { DeploymentApiConcurrencyOptions } from '@/models/api/DeploymentApiConcurrencyOptions'
import { SchemaValues } from '@/schemas/types/schemaValues'
export type DeploymentCreateRequest = {
@@ -21,4 +22,5 @@ export type DeploymentCreateRequest = {
version: string | null,
paused: boolean,
concurrency_limit: number | null,
+ concurrency_options: DeploymentApiConcurrencyOptions | null,
}
diff --git a/src/models/api/DeploymentResponse.ts b/src/models/api/DeploymentResponse.ts
index 155b7400f..7a82fae0c 100644
--- a/src/models/api/DeploymentResponse.ts
+++ b/src/models/api/DeploymentResponse.ts
@@ -1,5 +1,6 @@
import { ConcurrencyV2Response } from '@/models/api/ConcurrencyV2Response'
import { CreatedOrUpdatedByResponse } from '@/models/api/CreatedOrUpdatedByResponse'
+import { DeploymentApiConcurrencyOptions } from '@/models/api/DeploymentApiConcurrencyOptions'
import { DeploymentScheduleResponse } from '@/models/api/DeploymentScheduleResponse'
import { ScheduleResponse } from '@/models/api/ScheduleResponse'
import { ServerDeploymentStatus } from '@/models/DeploymentStatus'
@@ -36,6 +37,8 @@ export type DeploymentResponse = {
pull_steps: unknown,
status: ServerDeploymentStatus,
disabled?: boolean,
+ /** @deprecated Prefer `global_concurrency_limit */
concurrency_limit: number | null,
global_concurrency_limit: ConcurrencyV2Response | null,
+ concurrency_options: DeploymentApiConcurrencyOptions | null,
}
diff --git a/src/models/api/DeploymentUpdateRequest.ts b/src/models/api/DeploymentUpdateRequest.ts
index 8c9c26572..e27d73d67 100644
--- a/src/models/api/DeploymentUpdateRequest.ts
+++ b/src/models/api/DeploymentUpdateRequest.ts
@@ -1,4 +1,5 @@
import { ScheduleResponse } from '@/models'
+import { DeploymentApiConcurrencyOptions } from '@/models/api/DeploymentApiConcurrencyOptions'
import { SchemaValues } from '@/types/schemas'
export type DeploymentUpdateRequest = Partial<{
@@ -16,4 +17,5 @@ export type DeploymentUpdateRequest = Partial<{
job_variables: Record | null,
enforce_parameter_schema: boolean,
concurrency_limit: number | null,
+ concurrency_options: DeploymentApiConcurrencyOptions | null,
}>
\ No newline at end of file