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 2021/02/18 21:10:34 UTC

[GitHub] [airflow] hedrickw opened a new issue #14300: EmailOperator CC parameter does not support DagParam type like To parameter does

hedrickw opened a new issue #14300:
URL: https://github.com/apache/airflow/issues/14300


   <!--
   
   Welcome to Apache Airflow!  For a smooth issue process, try to answer the following questions.
   Don't worry if they're not all applicable; just try to include what you can :-)
   
   If you need to include code snippets or logs, please put them in fenced code
   blocks.  If they're super-long, please use the details tag like
   <details><summary>super-long log</summary> lots of stuff </details>
   
   Please delete these comment blocks before submitting the issue.
   
   -->
   
   <!--
   
   IMPORTANT!!!
   
   PLEASE CHECK "SIMILAR TO X EXISTING ISSUES" OPTION IF VISIBLE
   NEXT TO "SUBMIT NEW ISSUE" BUTTON!!!
   
   PLEASE CHECK IF THIS ISSUE HAS BEEN REPORTED PREVIOUSLY USING SEARCH!!!
   
   Please complete the next sections or the issue will be closed.
   These questions are the first thing we need to know to understand the context.
   
   -->
   
   **Apache Airflow version**: 2.0.1
   
   
   **Kubernetes version (if you are using kubernetes)** (use `kubectl version`):
   
   **Environment**: Linux
   
   - **Cloud provider or hardware configuration**:
   - **OS** (e.g. from /etc/os-release):
   - **Kernel** (e.g. `uname -a`):
   - **Install tools**:
   - **Others**:
   
   **What happened**:
   Following the example here (https://github.com/apache/airflow/blob/master/airflow/example_dags/example_dag_decorator.py) I tried to add cc param for the email operator like below
   ```
   @dag(default_args=DEFAULT_ARGS, schedule_interval=None, start_date=days_ago(2), tags=['example'])
   def example_dag_decorator(email: str = 'example@example.com', email_cc: str = 'example2@example.com'):
       """
       DAG to send server IP to email.
       :param email: Email to send IP to. Defaults to example@example.com.
       :type email: str
       """
       get_ip = GetRequestOperator(task_id='get_ip', url="http://httpbin.org/get")
   
       @task(multiple_outputs=True)
       def prepare_email(raw_json: Dict[str, Any]) -> Dict[str, str]:
           external_ip = raw_json['origin']
           return {
               'subject': f'Server connected from {external_ip}',
               'body': f'Seems like today your server executing Airflow is connected from IP {external_ip}<br>',
           }
   
       email_info = prepare_email(get_ip.output)
   
       EmailOperator(
           task_id='send_email', to=email, cc=email_cc, subject=email_info['subject'], html_content=email_info['body']
       )
   
   
   dag = example_dag_decorator()
   # [END dag_decorator_usage]
   ```
   I get the following error:
   
    cc = get_email_address_list(cc)
     File "/opt/app-root/lib64/python3.8/site-packages/airflow/utils/email.py", line 213, in get_email_address_list
       raise TypeError(f"Unexpected argument type: Received '{received_type}'.")
   TypeError: Unexpected argument type: Received 'DagParam'.
   
   <!-- (please include exact error messages if you can) -->
   
   **What you expected to happen**:
   CC parameter to work like the To parameter
   
   <!-- What do you think went wrong? -->
   
   **How to reproduce it**:
   <!---
   
   
   As minimally and precisely as possible. Keep in mind we do not have access to your cluster or dags.
   
   If you are using kubernetes, please attempt to recreate the issue using minikube or kind.
   
   ## Install minikube/kind
   
   - Minikube https://minikube.sigs.k8s.io/docs/start/
   - Kind https://kind.sigs.k8s.io/docs/user/quick-start/
   
   If this is a UI bug, please provide a screenshot of the bug or a link to a youtube video of the bug in action
   
   You can include images using the .md style of
   ![alt text](http://url/to/img.png)
   
   To record a screencast, mac users can use QuickTime and then create an unlisted youtube video with the resulting .mov file.
   
   --->
   
   See Example above
   
   
   **Anything else we need to know**:
   I dont know if this is a bug or not if its not a bug can we mark this a feature request?
   <!--
   
   How often does this problem occur? Once? Every time etc?
   
   Any relevant logs to include? Put them here in side a detail tag:
   <details><summary>x.log</summary> lots of stuff </details>
   
   -->
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [airflow] hedrickw closed issue #14300: EmailOperator CC parameter does not support DagParam type like To parameter does

Posted by GitBox <gi...@apache.org>.
hedrickw closed issue #14300:
URL: https://github.com/apache/airflow/issues/14300


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [airflow] VBhojawala commented on issue #14300: EmailOperator CC parameter does not support DagParam type like To parameter does

Posted by GitBox <gi...@apache.org>.
VBhojawala commented on issue #14300:
URL: https://github.com/apache/airflow/issues/14300#issuecomment-782561172


   I think you are passing string to  "cc=email_cc" instead of list of string that is why you are getting
    TypeError(f"Unexpected argument type: Received '{received_type}'.")
   
   Kindly check the official document describing arguments type of EmailOperator in below link :
   
   https://airflow.apache.org/docs/apache-airflow/1.10.9/_modules/airflow/operators/email_operator.html


----------------------------------------------------------------
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:
users@infra.apache.org