mik-laj commented on a change in pull request #6596: [AIRFLOW-6004] Untangle
Executors class to avoid cyclic imports
URL: https://github.com/apache/airflow/pull/6596#discussion_r352310146
##########
File path: airflow/executors/kubernetes_executor.py
##########
@@ -703,10 +735,12 @@ def _create_or_update_secret(secret_name, secret_path):
for service_account in name_path_pair_list:
_create_or_update_secret(service_account['name'],
service_account['path'])
- def start(self):
+ def start(self) -> None:
"""Starts the executor"""
self.log.info('Start Kubernetes executor')
self.worker_uuid =
KubeWorkerIdentifier.get_or_create_current_kube_worker_uuid()
+ if not self.worker_uuid:
+ raise AirflowException("Could not get worker_uuid")
Review comment:
I use assertion if I want to improve types in this project.
```
00:31 $ find airflow/ -name '*.py' -type f | grep -v "vendor" |grep -v
"node_modules" | xargs grep -i 'assert ' airflow/
grep: airflow/: Is a directory
airflow//logging_config.py: assert (isinstance(logging_config,
dict))
airflow//serialization/base_serialization.py: assert
isinstance(encoded_var, dict)
airflow//providers/google/cloud/operators/dataproc.py: assert not
(self.custom_image and self.image_version), \
airflow//providers/google/cloud/operators/dataproc.py: assert (
airflow//providers/google/cloud/hooks/vision.py: assert project_id is
not None
airflow//providers/google/cloud/hooks/vision.py: assert project_id is
not None
airflow//providers/google/cloud/hooks/vision.py: assert project_id is
not None
airflow//providers/google/cloud/hooks/vision.py: assert project_id is
not None
airflow//providers/google/cloud/hooks/vision.py: assert project_id is
not None
airflow//providers/google/cloud/hooks/vision.py: assert project_id is
not None
airflow//providers/google/cloud/hooks/vision.py: assert project_id is
not None
airflow//providers/google/cloud/hooks/vision.py: assert project_id is
not None
airflow//providers/google/cloud/hooks/vision.py: assert project_id is
not None
airflow//providers/google/cloud/hooks/vision.py: assert project_id is
not None
airflow//providers/google/cloud/hooks/vision.py: assert project_id is
not None
airflow//providers/google/cloud/hooks/vision.py: assert project_id is
not None
airflow//providers/google/cloud/hooks/pubsub.py: assert project_id is
not None
airflow//providers/google/cloud/hooks/pubsub.py: assert project_id is
not None
airflow//providers/google/cloud/hooks/pubsub.py: assert project_id is
not None
airflow//providers/google/cloud/hooks/pubsub.py: assert project_id is
not None
airflow//providers/google/cloud/hooks/pubsub.py: assert project_id is
not None
airflow//providers/google/cloud/hooks/pubsub.py: assert project_id is
not None
airflow//providers/google/cloud/hooks/pubsub.py: assert project_id is
not None
airflow//utils/cli.py: assert args
airflow//utils/cli.py: assert isinstance(args[0], Namespace), \
airflow//utils/cli.py: assert isinstance(namespace, Namespace)
airflow//gcp/operators/gcs.py: assert objects is not None or prefix
is not None
airflow//gcp/operators/bigquery.py: This operator does not assert
idempotency.
airflow//gcp/utils/credentials_provider.py: assert key_file_path or
key_file_dict, msg
airflow//gcp/hooks/functions.py: assert project_id is not None
airflow//gcp/hooks/functions.py: assert project_id is not None
airflow//gcp/hooks/cloud_storage_transfer_service.py: assert
project_id is not None
airflow//gcp/hooks/cloud_storage_transfer_service.py: assert
isinstance(request_filter, Dict)
airflow//gcp/hooks/cloud_storage_transfer_service.py: assert
project_id is not None
airflow//gcp/hooks/cloud_storage_transfer_service.py: assert
isinstance(request_filter, Dict)
airflow//gcp/hooks/cloud_sql.py: assert project_id is not None
airflow//gcp/hooks/cloud_sql.py: assert project_id is not None
airflow//gcp/hooks/cloud_sql.py: assert project_id is not None
airflow//gcp/hooks/cloud_sql.py: assert project_id is not None
airflow//gcp/hooks/cloud_sql.py: assert project_id is not None
airflow//gcp/hooks/cloud_sql.py: assert project_id is not None
airflow//gcp/hooks/cloud_sql.py: assert project_id is not None
airflow//gcp/hooks/cloud_sql.py: assert project_id is not None
airflow//gcp/hooks/cloud_sql.py: assert project_id is not None
airflow//gcp/hooks/cloud_sql.py: assert project_id is not None
airflow//gcp/hooks/cloud_sql.py: assert project_id is not None
airflow//gcp/hooks/cloud_sql.py: assert self.database_type is not None
airflow//gcp/hooks/cloud_sql.py: assert self.sql_proxy_unique_path is
not None
airflow//gcp/hooks/cloud_sql.py: assert self.db_hook is not None
airflow//gcp/hooks/cloud_sql.py: assert isinstance(self.db_hook,
PostgresHook)
airflow//gcp/hooks/bigtable.py: assert project_id is not None
airflow//gcp/hooks/bigtable.py: assert project_id is not None
airflow//gcp/hooks/bigtable.py: assert project_id is not None
airflow//gcp/hooks/bigtable.py: assert project_id is not None
airflow//gcp/hooks/spanner.py: assert project_id is not None
airflow//gcp/hooks/spanner.py: assert project_id is not None
airflow//gcp/hooks/spanner.py: assert project_id is not None
airflow//gcp/hooks/spanner.py: assert project_id is not None
airflow//gcp/hooks/spanner.py: assert project_id is not None
airflow//gcp/hooks/spanner.py: assert project_id is not None
airflow//gcp/hooks/spanner.py: assert project_id is not None
airflow//gcp/hooks/spanner.py: assert project_id is not None
airflow//gcp/hooks/spanner.py: assert project_id is not None
airflow//gcp/hooks/mlengine.py: assert project_id is not None
airflow//gcp/hooks/mlengine.py: assert project_id is not None
airflow//gcp/hooks/mlengine.py: assert project_id is not None
airflow//gcp/hooks/bigquery_dts.py: assert project_id is not None
airflow//gcp/hooks/bigquery_dts.py: assert project_id is not None
airflow//gcp/hooks/bigquery_dts.py: assert project_id is not None
airflow//gcp/hooks/bigquery_dts.py: assert project_id is not None
airflow//gcp/hooks/dataflow.py: assert self._jobs is not None
airflow//gcp/hooks/dataflow.py: assert self._jobs is not None
airflow//gcp/hooks/dataflow.py: assert project_id is not None
airflow//gcp/hooks/dataflow.py: assert project_id is not None
airflow//gcp/hooks/dataflow.py: assert project_id is not None
airflow//gcp/hooks/dataflow.py: assert project_id is not None
airflow//gcp/hooks/cloud_build.py: assert project_id is not None
airflow//gcp/hooks/automl.py: assert project_id is not None
airflow//gcp/hooks/automl.py: assert project_id is not None
airflow//gcp/hooks/automl.py: assert project_id is not None
airflow//gcp/hooks/automl.py: assert project_id is not None
airflow//gcp/hooks/automl.py: assert project_id is not None
airflow//gcp/hooks/automl.py: assert project_id is not None
airflow//gcp/hooks/automl.py: assert project_id is not None
airflow//gcp/hooks/automl.py: assert project_id is not None
airflow//gcp/hooks/automl.py: assert project_id is not None
airflow//gcp/hooks/automl.py: assert project_id is not None
airflow//gcp/hooks/automl.py: assert project_id is not None
airflow//gcp/hooks/automl.py: assert project_id is not None
airflow//gcp/hooks/automl.py: assert project_id is not None
airflow//gcp/hooks/base.py: assert keyfile_dict is not None
airflow//gcp/hooks/compute.py: assert project_id is not None
airflow//gcp/hooks/compute.py: assert project_id is not None
airflow//gcp/hooks/compute.py: assert project_id is not None
airflow//gcp/hooks/compute.py: assert project_id is not None
airflow//gcp/hooks/compute.py: assert project_id is not None
airflow//gcp/hooks/compute.py: assert project_id is not None
airflow//gcp/hooks/compute.py: assert project_id is not None
airflow//contrib/example_dags/example_kubernetes_executor_config.py:
assert return_code == 0
airflow//contrib/example_dags/example_kubernetes_executor.py: assert
return_code == 0
airflow//contrib/hooks/databricks_hook.py: assert
h._parse_host('https://xx.cloud.databricks.com') == \
airflow//contrib/hooks/databricks_hook.py: assert
h._parse_host('xx.cloud.databricks.com') == 'xx.cloud.databricks.com'
airflow//example_dags/example_xcom.py: assert pulled_value_1 == value_1
airflow//example_dags/example_xcom.py: assert pulled_value_2 == value_2
airflow//example_dags/example_xcom.py: assert (pulled_value_1,
pulled_value_2) == (value_1, value_2)
airflow//api/common/experimental/trigger_dag.py: assert
timezone.is_localized(execution_date)
```
``
00:33 $ find airflow/ -name '*.py' -type f | grep -v "vendor" |grep -v
"node_modules" | xargs grep -i 'assert ' airflow/ | wc -l
grep: airflow/: Is a directory
106
``
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services