-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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 Get Task to FastAPI #43718
base: main
Are you sure you want to change the base?
Conversation
619aaa5
to
535b646
Compare
53bbc36
to
7cc3eed
Compare
7467a22
to
f0f1850
Compare
@pierrejeambrun PR rebased and synced with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looking good. Need rebasing and conflicts resolution. Thanks
airflow/api_fastapi/common/types.py
Outdated
def get_class_ref(obj: Operator) -> dict[str, str | None]: | ||
"""Return the class_ref dict for obj.""" | ||
is_mapped_or_serialized = isinstance(obj, (MappedOperator, SerializedBaseOperator)) | ||
|
||
module_path = None | ||
if is_mapped_or_serialized: | ||
module_path = obj._task_module | ||
else: | ||
module_type = inspect.getmodule(obj) | ||
module_path = module_type.__name__ if module_type else None | ||
|
||
class_name = None | ||
if is_mapped_or_serialized: | ||
class_name = obj._task_type | ||
elif obj.__class__ is type: | ||
class_name = obj.__name__ | ||
else: | ||
class_name = type(obj).__name__ | ||
|
||
return { | ||
"module_path": module_path, | ||
"class_name": class_name, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we use field validator as in the legacy code to populate class_ref
and operator_name
? This code should not be in types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we don't get the __class__
and other special properties of task
in TaskResponse
, so we need to perform isinstance()
and other checks before building the TaskResponse
model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pierrejeambrun where shall I move this code to? Can we keep a helpers.py
file to have such helper functions or similar?
Since we cannot access the type related properties in the validators, we'll need to call this function before creating TaskResponse
model.
c78d799
to
9bf4670
Compare
Done! Rebased and conflicts resolved ✅ |
3ef30fa
to
f8e9b09
Compare
f8e9b09
to
bc1d210
Compare
closes: #42874
related: #42370
This migrates the Get Task API from
api_connexion
toapi_fastapi
.