From 9f37af25ae7eb85fa8dbb70b7dbb23bbd5505323 Mon Sep 17 00:00:00 2001 From: Kaxil Naik Date: Thu, 4 Mar 2021 19:20:05 +0000 Subject: [PATCH] Fix docstrings for Kubernetes code (#14605) We don't use "@param" type od docstring. This PR fixes it --- airflow/kubernetes/pod_generator.py | 11 ++++++----- airflow/utils/db.py | 16 ++++++++++------ tests/executors/test_kubernetes_executor.py | 2 -- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/airflow/kubernetes/pod_generator.py b/airflow/kubernetes/pod_generator.py index 0782f1af9d069..0d4056c40cade 100644 --- a/airflow/kubernetes/pod_generator.py +++ b/airflow/kubernetes/pod_generator.py @@ -411,13 +411,13 @@ def construct_pod( # pylint: disable=too-many-arguments return reduce(PodGenerator.reconcile_pods, pod_list) @staticmethod - def serialize_pod(pod: k8s.V1Pod): + def serialize_pod(pod: k8s.V1Pod) -> dict: """ Converts a k8s.V1Pod into a jsonified object - @param pod: - @return: + :param pod: k8s.V1Pod object + :return: Serialized version of the pod returned as dict """ api_client = ApiClient() return api_client.sanitize_for_serialization(pod) @@ -445,8 +445,9 @@ def deserialize_model_file(path: str) -> k8s.V1Pod: def deserialize_model_dict(pod_dict: dict) -> k8s.V1Pod: """ Deserializes python dictionary to k8s.V1Pod - @param pod_dict: - @return: + + :param pod_dict: Serialized dict of k8s.V1Pod object + :return: De-serialized k8s.V1Pod """ api_client = ApiClient() return api_client._ApiClient__deserialize_model(pod_dict, k8s.V1Pod) # pylint: disable=W0212 diff --git a/airflow/utils/db.py b/airflow/utils/db.py index eab62a0d58688..46ace4aa7b523 100644 --- a/airflow/utils/db.py +++ b/airflow/utils/db.py @@ -586,8 +586,9 @@ def _get_alembic_config(): def check_migrations(timeout): """ Function to wait for all airflow migrations to complete. - @param timeout: - @return: + + :param timeout: Timeout for the migration in seconds + :return: None """ from alembic.runtime.migration import MigrationContext from alembic.script import ScriptDirectory @@ -708,8 +709,9 @@ def resetdb(): def drop_airflow_models(connection): """ Drops all airflow models. - @param connection: - @return: None + + :param connection: SQLAlchemy Connection + :return: None """ from airflow.models.base import Base @@ -742,8 +744,9 @@ def drop_airflow_models(connection): def drop_flask_models(connection): """ Drops all Flask models. - @param connection: - @return: + + :param connection: SQLAlchemy Connection + :return: None """ from flask_appbuilder.models.sqla import Base @@ -754,6 +757,7 @@ def drop_flask_models(connection): def check(session=None): """ Checks if the database works. + :param session: session of the sqlalchemy """ session.execute('select 1 as is_alive;') diff --git a/tests/executors/test_kubernetes_executor.py b/tests/executors/test_kubernetes_executor.py index dc7cbbbf7b532..2b76c7a67db95 100644 --- a/tests/executors/test_kubernetes_executor.py +++ b/tests/executors/test_kubernetes_executor.py @@ -313,8 +313,6 @@ def test_not_adopt_unassigned_task(self, mock_kube_client): """ We should not adopt any tasks that were not assigned by the scheduler. This ensures that there is no contention over pod management. - @param mock_kube_client: - @return: """ executor = self.kubernetes_executor