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/05/05 13:29:01 UTC

[GitHub] [airflow] ephraimbuddy opened a new pull request #15671: Update example dag task to try more before failing

ephraimbuddy opened a new pull request #15671:
URL: https://github.com/apache/airflow/pull/15671


   This change will have the `task_with_volume` task try to mount volume more times before
   failing. The same idea is used in sharedvolume mount in the same dag.
   
   It will help us to run the kubernetes_tests with other executors
   as it was found that this fails on the first few tries in other executors.
   
   Also, we will no longer develop separate integration tests for each executor
   but add more tests and ensure the executors passes the tests.
   
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   


-- 
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] ephraimbuddy closed pull request #15671: Update example dag task to try more before failing

Posted by GitBox <gi...@apache.org>.
ephraimbuddy closed pull request #15671:
URL: https://github.com/apache/airflow/pull/15671


   


-- 
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] jedcunningham commented on a change in pull request #15671: Update example dag task to try more before failing

Posted by GitBox <gi...@apache.org>.
jedcunningham commented on a change in pull request #15671:
URL: https://github.com/apache/airflow/pull/15671#discussion_r626637797



##########
File path: airflow/example_dags/example_kubernetes_executor_config.py
##########
@@ -61,12 +61,17 @@ def test_volume_mount():
             """
             Tests whether the volume has been mounted.
             """
-            with open('/foo/volume_mount_test.txt', 'w') as foo:
-                foo.write('Hello')
-
-            return_code = os.system("cat /foo/volume_mount_test.txt")
-            if return_code != 0:
-                raise ValueError(f"Error when checking volume mount. Return code {return_code}")
+            for i in range(5):
+                try:
+                    return_code = os.system("cat /foo/volume_mount_test.txt")
+                    if return_code != 0:
+                        raise ValueError(f"Error when checking volume mount. Return code {return_code}")
+                    else:
+                        with open('/foo/volume_mount_test.txt', 'w') as foo:
+                            foo.write('Hello')
+                except ValueError as e:
+                    if i > 4:
+                        raise e

Review comment:
       ```suggestion
                   except ValueError:
                       if i > 3:
                           raise
   ```
   
   `range` starts at 0. 

##########
File path: airflow/example_dags/example_kubernetes_executor_config.py
##########
@@ -61,12 +61,17 @@ def test_volume_mount():
             """
             Tests whether the volume has been mounted.
             """
-            with open('/foo/volume_mount_test.txt', 'w') as foo:
-                foo.write('Hello')
-
-            return_code = os.system("cat /foo/volume_mount_test.txt")
-            if return_code != 0:
-                raise ValueError(f"Error when checking volume mount. Return code {return_code}")
+            for i in range(5):
+                try:
+                    return_code = os.system("cat /foo/volume_mount_test.txt")
+                    if return_code != 0:
+                        raise ValueError(f"Error when checking volume mount. Return code {return_code}")
+                    else:
+                        with open('/foo/volume_mount_test.txt', 'w') as foo:
+                            foo.write('Hello')

Review comment:
       ```suggestion
                       with open('/foo/volume_mount_test.txt', 'w') as foo:
                               foo.write('Hello')
   
                       return_code = os.system("cat /foo/volume_mount_test.txt")
                       if return_code != 0:
                           raise ValueError(f"Error when checking volume mount. Return code {return_code}")    
   ```
   
   We still need to write the file first. Chicken-egg problem here as the cat always fails, until we write the file, which won't happen until the cat succeeds?




-- 
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] kaxil commented on a change in pull request #15671: Update example dag task to try more before failing

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #15671:
URL: https://github.com/apache/airflow/pull/15671#discussion_r626637577



##########
File path: airflow/example_dags/example_kubernetes_executor_config.py
##########
@@ -61,12 +61,17 @@ def test_volume_mount():
             """
             Tests whether the volume has been mounted.
             """
-            with open('/foo/volume_mount_test.txt', 'w') as foo:
-                foo.write('Hello')
-
-            return_code = os.system("cat /foo/volume_mount_test.txt")
-            if return_code != 0:
-                raise ValueError(f"Error when checking volume mount. Return code {return_code}")
+            for i in range(5):
+                try:

Review comment:
       We should not be running this DAG with any other executor as this is only an example to run it with kubernetes_executor and shows how to pass executor_config 




-- 
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] ephraimbuddy closed pull request #15671: Update example dag task to try more before failing

Posted by GitBox <gi...@apache.org>.
ephraimbuddy closed pull request #15671:
URL: https://github.com/apache/airflow/pull/15671


   


-- 
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] ephraimbuddy commented on a change in pull request #15671: Update example dag task to try more before failing

Posted by GitBox <gi...@apache.org>.
ephraimbuddy commented on a change in pull request #15671:
URL: https://github.com/apache/airflow/pull/15671#discussion_r626656553



##########
File path: airflow/example_dags/example_kubernetes_executor_config.py
##########
@@ -61,12 +61,17 @@ def test_volume_mount():
             """
             Tests whether the volume has been mounted.
             """
-            with open('/foo/volume_mount_test.txt', 'w') as foo:
-                foo.write('Hello')
-
-            return_code = os.system("cat /foo/volume_mount_test.txt")
-            if return_code != 0:
-                raise ValueError(f"Error when checking volume mount. Return code {return_code}")
+            for i in range(5):
+                try:

Review comment:
       Ok. I will be closing this then since it works well with kubernetesExecutor.
   
   




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