Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate public endpoint Patch Task Instance to FastAPI #44223

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

omkar-foss
Copy link
Collaborator

@omkar-foss omkar-foss commented Nov 20, 2024

closes: #43753 and #43754
related: #42370

This migrates the Patch Task Instance API from api_connexion to api_fastapi.

@boring-cyborg boring-cyborg bot added area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. labels Nov 20, 2024
@omkar-foss omkar-foss self-assigned this Nov 20, 2024
@omkar-foss omkar-foss added the legacy api Whether legacy API changes should be allowed in PR label Nov 20, 2024
@omkar-foss omkar-foss closed this Nov 20, 2024
@omkar-foss omkar-foss reopened this Nov 20, 2024
@omkar-foss omkar-foss marked this pull request as ready for review November 20, 2024 19:50
@omkar-foss
Copy link
Collaborator Author

All checks passed, PR is ready for review ✅

@omkar-foss
Copy link
Collaborator Author

@pierrejeambrun I'm adding the Set Task Instance Note functionality to this (Patch Task Instance) API as you mentioned here. Will update this PR in a while.

Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to include the update_mask as we do for other patch endpoints. (The state part would actually be the set_task_instance_state of your other PR)

Comment on lines +177 to +178
if len(note) > 1000:
raise ValueError("Note length should not exceed 1000 characters.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exists natively in pydantic Field. We can use that instead of coding a check manually.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shared the link above.

request: Request,
body: PatchTaskInstanceBody,
session: Annotated[Session, Depends(get_session)],
map_index: int = -1,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are missing the update mask.

You can take a look at others (not all of them are reworked yet), but patch_dag_run might be close to what you want.

Also, if mask is provided, None values should not be ignored but set to None.


dry_run: bool = True
new_state: str | None = None
note: str | None = None
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.pydantic.dev/latest/api/types/#pydantic.types.StringConstraints

Suggested change
note: str | None = None
note: Annotated[str, StringConstraints(max_length=1000)] | None = None

Copy link
Member

@pierrejeambrun pierrejeambrun Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that one.

Thanks for your input @Kludex :)

Comment on lines +177 to +178
if len(note) > 1000:
raise ValueError("Note length should not exceed 1000 characters.")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shared the link above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. legacy api Whether legacy API changes should be allowed in PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AIP-84 Patch Task Instance
3 participants