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

AIP-84: Migrate get_log endpoint #44238

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

Conversation

utkarsharma2
Copy link
Contributor

@utkarsharma2 utkarsharma2 commented Nov 21, 2024

Related: #42370

@boring-cyborg boring-cyborg bot added the area:UI Related to UI/UX. For Frontend Developers. label Nov 21, 2024
@utkarsharma2 utkarsharma2 marked this pull request as draft November 21, 2024 09:14
@utkarsharma2 utkarsharma2 marked this pull request as ready for review November 21, 2024 10:05
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.

Nice thanks !

A few suggestions and ready to merge :)

airflow/api_fastapi/core_api/datamodels/task_instances.py Outdated Show resolved Hide resolved
dag_id: str,
dag_run_id: str,
task_id: str,
task_try_number: int,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
task_try_number: int,
task_try_number: NonNegativeInt,

Copy link
Collaborator

Choose a reason for hiding this comment

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

we can import this from pydantic
from pydantic import NonNegativeInt

Copy link
Collaborator

Choose a reason for hiding this comment

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

This will automatically raise 422. We don't need to separately check if its less than 0

Copy link
Contributor

@bbovenzi bbovenzi Nov 21, 2024

Choose a reason for hiding this comment

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

try_number: int = 1

Let's add a default try number value. and just try_number is sufficient. There is no need for the task_ prefix

Copy link
Collaborator

Choose a reason for hiding this comment

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

I forgot that try_number can be >0. In that case, we should use PositiveInt

Comment on lines +71 to +72
if task_try_number <= 0:
raise HTTPException(status.HTTP_400_BAD_REQUEST, "task_try_number must be a positive integer")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if task_try_number <= 0:
raise HTTPException(status.HTTP_400_BAD_REQUEST, "task_try_number must be a positive integer")

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.

Minor nitpick, after addressing @rawwar suggestions, should be good to merge.


@task_instances_log_router.get(
"/{task_id}/logs/{task_try_number}",
responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]),
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 documentation for text/plain mimetype.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:UI Related to UI/UX. For Frontend Developers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants