amoghrajesh commented on PR #51048:
URL: https://github.com/apache/airflow/pull/51048#issuecomment-2969224126
@Bowrna I also think its not a great idea to add this in unit tests but in
precommit checks to catch things earlier and repeatedly.
Did you try using the inspect library and matching signatures.
```
Python 3.9.22 (main, Apr 30 2025, 00:01:18)
[GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>> import sys
>>> import inspect
>>> from airflow.decorators import task
>>> from airflow.providers.cncf.kubernetes.operators.pod import
KubernetesPodOperator
>>> op_sig = inspect.signature(KubernetesPodOperator.__init__)
>>> dec_sig = inspect.signature(task.kubernetes)
>>> op_params = {k for k in op_sig.parameters}
>>> dec_params = {k for k in dec_sig.parameters}
>>>
>>>
>>> diff_op = op_params - dec_params
>>> diff_dec = dec_params - op_params
>>>
>>>
>>> diff_op
{'volume_mounts', 'env_from', 'base_container_status_polling_interval',
'kubernetes_conn_id', 'ports', 'on_finish_action', 'do_xcom_push', 'cmds',
'arguments', 'image', 'random_name_suffix', 'name', 'dnspolicy', 'config_file',
'cluster_context', 'full_pod_spec', 'dns_config', 'labels', 'self',
'termination_message_policy', 'volumes', 'skip_on_exit_code',
'is_delete_operator_pod', 'init_container_logs', 'active_deadline_seconds',
'container_resources', 'logging_interval', 'container_security_context',
'affinity', 'startup_timeout_seconds', 'termination_grace_period',
'hostnetwork', 'callbacks', 'startup_check_interval_seconds',
'init_containers', 'image_pull_secrets', 'host_aliases', 'deferrable',
'base_container_name', 'log_pod_spec_on_failure', 'poll_interval', 'get_logs',
'pod_template_dict', 'security_context', 'in_cluster', 'configmaps',
'subdomain', 'pod_runtime_info_envs', 'service_account_name', 'hostname',
'secrets', 'container_logs', 'trigger_kwargs', 'schedule_timeout_se
conds', 'log_events_on_failure', 'reattach_on_restart', 'image_pull_policy',
'tolerations', 'progress_callback', 'namespace',
'automount_service_account_token', 'node_selector', 'priority_class_name',
'env_vars', 'pod_template_file', 'schedulername', 'annotations'}
>>> diff_dec
{'multiple_outputs', 'python_callable'}
```
Tried with the console and it works pretty consistently.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]