Skip to content

Commit

Permalink
remove create or update function
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanluciano committed Sep 4, 2024
1 parent 009c0f7 commit 6646bc6
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions src/prefect/server/models/concurrency_limits_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,32 +185,6 @@ async def delete_concurrency_limit(
return result.rowcount > 0


async def create_or_update_concurrency_limit(
session: AsyncSession,
concurrency_limit: Union[
schemas.actions.ConcurrencyLimitV2Create, schemas.core.ConcurrencyLimitV2
],
concurrency_limit_id: Optional[UUID] = None,
name: Optional[str] = None,
) -> orm_models.ConcurrencyLimitV2:
if not concurrency_limit_id and not name:
raise ValueError("Must provide either concurrency_limit_id or name")

current_concurrency_limit = await read_concurrency_limit(
session, concurrency_limit_id=concurrency_limit_id, name=name
)

if not current_concurrency_limit:
return await create_concurrency_limit(session, concurrency_limit)
else:
return await update_concurrency_limit(
session,
concurrency_limit,
concurrency_limit_id=concurrency_limit_id,
name=name,
)


async def bulk_read_or_create_concurrency_limits(
session: AsyncSession,
names: List[str],
Expand Down

0 comments on commit 6646bc6

Please sign in to comment.