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 2020/10/19 16:45:11 UTC

[GitHub] [airflow] zachliu opened a new issue #11663: ECSOperator failed to display logs from Cloudwatch randomly

zachliu opened a new issue #11663:
URL: https://github.com/apache/airflow/issues/11663


   <!--
   
   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**: v1.10.12
   
   
   **Kubernetes version (if you are using kubernetes)** (use `kubectl version`): N/A
   
   **Environment**:
   
   - **Cloud provider or hardware configuration**: AWS
   - **OS** (e.g. from /etc/os-release): Deployed in ECS Fargate
   - **Install tools**: poetry
   
   **What happened**:
   
   I'm having this issue **randomly** (I've calculated the error rate to be between 1~2% based on the # of ECS tasks running each day) where the `aws_logs_hook` is unable the obtain existing log entries from Cloudwatch:
   ```
   Traceback (most recent call last):
     File "/usr/local/lib/python3.8/site-packages/airflow/models/taskinstance.py", line 979, in _run_raw_task
       result = task_copy.execute(context=context)
     File "/usr/local/lib/python3.8/site-packages/airflow/contrib/operators/ecs_operator.py", line 152, in execute
       self._check_success_task()
     File "/usr/local/lib/python3.8/site-packages/airflow/contrib/operators/ecs_operator.py", line 175, in _check_success_task
       for event in self.get_logs_hook().get_log_events(self.awslogs_group, stream_name):
     File "/usr/local/lib/python3.8/site-packages/airflow/contrib/hooks/aws_logs_hook.py", line 81, in get_log_events
       response = self.get_conn().get_log_events(logGroupName=log_group,
     File "/usr/local/lib/python3.8/site-packages/botocore/client.py", line 337, in _api_call
       return self._make_api_call(operation_name, kwargs)
     File "/usr/local/lib/python3.8/site-packages/botocore/client.py", line 656, in _make_api_call
       raise error_class(parsed_response, operation_name)
   botocore.errorfactory.ResourceNotFoundException: An error occurred (ResourceNotFoundException) when calling the GetLogEvents operation: The specified log stream does not exist.
   ```
   The resource does exist when I check the cloudwatch UI.
   Note: this is not the same issue as https://github.com/apache/airflow/issues/9486 where the log stream name setup is erroneous. 
   
   <!-- (please include exact error messages if you can) -->
   
   **What you expected to happen**:
   
   This could be a simple API glitch when using boto3 to get the log events. We could add a retry mechanism [here](https://github.com/apache/airflow/blob/6416d898060706787861ff8ecbc4363152a35f45/airflow/contrib/hooks/aws_logs_hook.py#L81).
   
   <!-- What do you think went wrong? -->
   
   **How to reproduce it**: 
   
   Running enough # of ECS task with ECS Operator
   <!---
   
   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.
   
   --->
   
   
   **Anything else we need to know**:
   
   <!--
   
   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] zachliu commented on issue #11663: ECSOperator failed to display logs from Cloudwatch randomly

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


   Most likely AWS's :hankey: 
   See my comments here https://github.com/apache/airflow/issues/15000#issuecomment-824404502


-- 
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] sparrovv commented on issue #11663: ECSOperator failed to display logs from Cloudwatch randomly

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


   Hi, we only noticed that behaviour in our setup. For some tasks, cloudwatch logs are just not fetched/displayed. 


----------------------------------------------------------------
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] eladkal commented on issue #11663: ECSOperator failed to display logs from Cloudwatch randomly

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


   We have some hooks that have such functionality using tenacity
   For example:
   [TelegramHook](https://github.com/apache/airflow/blob/b40dffa08547b610162f8cacfa75847f3c4ca364/airflow/providers/telegram/hooks/telegram.py#L126)
   [GoogleDataprepHook](https://github.com/apache/airflow/blob/b40dffa08547b610162f8cacfa75847f3c4ca364/airflow/providers/google/cloud/hooks/dataprep.py#L61)
   
   @feluelle WDYT? 


----------------------------------------------------------------
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] feluelle commented on issue #11663: ECSOperator failed to display logs from Cloudwatch randomly

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


   @eladkal could work.
   
   What I don't like about the error is that it tells us that the resource does not exist. I would like to narrow the issue down before retrying. But if we cannot get more information about this, we can use tenacity to start doing retries.
   
   On the user end you can set task retries when this issue appears.


----------------------------------------------------------------
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] zachliu closed issue #11663: ECSOperator failed to display logs from Cloudwatch randomly

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


   


-- 
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