Skip to content

Commit

Permalink
Fix docstrings for Kubernetes code (#14605)
Browse files Browse the repository at this point in the history
We don't use "@param" type od docstring. This PR fixes it
  • Loading branch information
kaxil authored Mar 4, 2021
1 parent 1c23e91 commit 9f37af2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
11 changes: 6 additions & 5 deletions airflow/kubernetes/pod_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
16 changes: 10 additions & 6 deletions airflow/utils/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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;')
Expand Down
2 changes: 0 additions & 2 deletions tests/executors/test_kubernetes_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9f37af2

Please sign in to comment.