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/11/08 07:30:50 UTC

[GitHub] [airflow] matejpavlovic-maistra commented on issue #19426: ECS operator not fetching CloudWatch logs

matejpavlovic-maistra commented on issue #19426:
URL: https://github.com/apache/airflow/issues/19426#issuecomment-962881110


   ![image](https://user-images.githubusercontent.com/56387646/140700300-54acbe0e-2d73-4ba5-b278-f31529f8594a.png)
   
   My awslogs_stream_prefix already follows that naming.
   
   My curretn solution is 
   ```python
   class MyECSOperator(ECSOperator):
       @apply_defaults
       def __init__(self, xcom_push=False, **kwargs):
           super(MyECSOperator, self).__init__(**kwargs)
           self.xcom_push_flag = xcom_push
   
       def execute(self, context):
           try:
               super().execute(context)
   
           except Exception as e:
               XCom.set( key = 'return_value', value = self.arn.split("/")[-1],dag_id=  'aaaaa', task_id= 'print_the_context',
                         execution_date= context.get('execution_date'))
               raise ValueError(e)
   ```
   And on failure function reads id of log from xcom and fetchs it using boto3.


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