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/06/07 19:43:16 UTC

[GitHub] [airflow] nullhack opened a new pull request #9173: fix auto_remove of DockerOperator

nullhack opened a new pull request #9173:
URL: https://github.com/apache/airflow/pull/9173


   Solves the issue https://github.com/apache/airflow/issues/9172
   
   **Issue**
   When using DockerOperator and setting auto_remove=True data is not stored on xcom.
   
   **Root of the problem**
   When `auto_remove` is set to `True`, the container is removed [when It's done](https://github.com/apache/airflow/blob/master/airflow/providers/docker/operators/docker.py#L260), after that, if `xcom=True` It tries to retrieve the [logs](https://github.com/apache/airflow/blob/master/airflow/providers/docker/operators/docker.py#L266) at a moment that the container is potentially removed.
   
   **Solution**
   Set 
   ```python
   auto_remove = False
   ``` 
   when creating the container, to always run without being removed and remove the container after running all the commands if `auto_remove=True`
   ```python
   if self.auto_remove:
       self.cli.remove_container(self.container['Id'])
   ```
   
   **Sample output**
   ![image](https://user-images.githubusercontent.com/11466701/83978425-f4972e80-a939-11ea-9bc6-95b1e368d1e2.png)
   
   
   ---
   Make sure to mark the boxes below before creating PR: [x]
   
   - [X] Description above provides context of the change
   - [X] Unit tests coverage for changes (not needed for documentation changes) `Unnecessary`
   - [X] Target Github ISSUE in description if exists
   - [X] Commits follow "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)"
   - [X] Relevant documentation is updated including usage instructions. `Unnecessary`
   - [X] I will engage committers as explained in [Contribution Workflow Example](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#contribution-workflow-example).
   


----------------------------------------------------------------
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] mik-laj merged pull request #9173: fix auto_remove of DockerOperator

Posted by GitBox <gi...@apache.org>.
mik-laj merged pull request #9173:
URL: https://github.com/apache/airflow/pull/9173


   


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