You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/03/31 19:19:54 UTC

[GitHub] [airflow] MatrixManAtYrService commented on issue #22665: Superfluous TypeError when passing not-iterables to `expand()`

MatrixManAtYrService commented on issue #22665:
URL: https://github.com/apache/airflow/issues/22665#issuecomment-1085007964


   @uranusjr suggested this change:
   
   ```
   --- a/airflow/settings.py
   +++ b/airflow/settings.py
   @@ -120,7 +120,14 @@ def custom_show_warning(message, category, filename, lineno, file=None, line=Non
        write_console.print(msg, soft_wrap=True)
   
   
   -warnings.showwarning = custom_show_warning
   +def replace_showwarning(replacement):
   +    original = warnings.showwarning
   +    warnings.showwarning = replacement
   +    return original
   +
   +
   +original_show_warning = replace_showwarning(custom_show_warning)
   +atexit.register(functools.partial(replace_showwarning, original_show_warning))
   ```
   
   which altered the output, but didn't suppress it:
   
   ```
   Traceback (most recent call last):
     File "/Users/matt/2022/03/30/dags/the_dag.py", line 13, in <module>
       PythonOperator.partial(
     File "/Users/matt/src/airflow/airflow/models/mappedoperator.py", line 187, in expand
       validate_mapping_kwargs(self.operator_class, "expand", mapped_kwargs)
     File "/Users/matt/src/airflow/airflow/models/mappedoperator.py", line 116, in validate_mapping_kwargs
       raise ValueError(error)
   ValueError: PythonOperator.expand() got an unexpected type 'bool' for keyword argument op_args
   /Users/matt/src/airflow/airflow/models/mappedoperator.py:182: UserWarning: PythonOperator.partial(python_callable=<function <lambda> at 0x10db770d0>, dag=<DAG: singleton_expanded>, task_group=<airflow.utils.task_group.TaskGroup object at 0x1105c8b20>, task_id='foo', start_date=None, end_date=None, owner='airflow', email=None, params=<airflow.models.param.ParamsDict object at 0x10dcb5fd0>, trigger_rule=<TriggerRule.ALL_SUCCESS: 'all_success'>, depends_on_past=False, wait_for_downstream=False, retries=0, queue='default', pool='default_pool', pool_slots=1, execution_timeout=None, retry_delay=datetime.timedelta(seconds=300), retry_exponential_backoff=False, priority_weight=1, weight_rule=<WeightRule.DOWNSTREAM: 'downstream'>, sla=None, max_active_tis_per_dag=None, on_execute_callback=None, on_failure_callback=None, on_retry_callback=None, on_success_callback=None, run_as_user=None, executor_config={}, inlets=None, outlets=None, resources=None) was never mapped!
     warnings.warn(f"{self!r} was never mapped!")
   ```


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org