You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ajitg25 (via GitHub)" <gi...@apache.org> on 2024/12/02 04:58:10 UTC
Re: [I] AIP-84 Standardize PATCH Behavior Across Endpoints in FastAPI [airflow]
ajitg25 commented on issue #43650:
URL: https://github.com/apache/airflow/issues/43650#issuecomment-2510581533
Hello @pierrejeambrun,
I went through the related links provided in the description, and here’s my understanding:
To standardize the implementation, I need to add a `mask` parameter to the function. If the parameter is passed, I will use the specified values; otherwise, I will validate the entire payload.
I have updated the `create_or_update_pool` function accordingly:
`@staticmethod
@provide_session
def create_or_update_pool(
name: str,
slots: int | None,
description: str | None,
include_deferred: bool | None,
session: Session = NEW_SESSION,
mask: list[str] | None = None,
) -> Pool:
"""Create a pool with given parameters or update it if it already exists."""
if not name:
raise ValueError("Pool name must not be empty")
pool = session.scalar(select(Pool).filter_by(pool=name))
if pool is None:
pool = Pool(pool=name, slots=slots, description=description, include_deferred=include_deferred)
session.add(pool)
else:
if mask:
if 'slots' in mask:
pool.slots = slots
if 'description' in mask:
pool.description = description
if 'include_deferred' in mask:
pool.include_deferred = include_deferred
else:
pool.slots = slots
pool.description = description
pool.include_deferred = include_deferred
session.commit()
return pool
`
Does this align with the requirements?
Additionally, regarding the description mentioning changes in different parts of the codebase, I found several functions with create_or_update. Are there any others that I should look into? Let me know your thoughts on the scope of changes and the specific files that need to be updated.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org