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/16 15:26:53 UTC

[GitHub] [airflow] dimberman opened a new pull request #9332: fixup! Make Kubernetes tests pass

dimberman opened a new pull request #9332:
URL: https://github.com/apache/airflow/pull/9332


   ---
   Make sure to mark the boxes below before creating PR: [x]
   
   - [ ] Description above provides context of the change
   - [ ] Unit tests coverage for changes (not needed for documentation changes)
   - [ ] Target Github ISSUE in description if exists
   - [ ] Commits follow "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)"
   - [ ] Relevant documentation is updated including usage instructions.
   - [ ] I will engage committers as explained in [Contribution Workflow Example](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#contribution-workflow-example).
   
   ---
   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).
   Read the [Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines) for more information.
   


----------------------------------------------------------------
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 pull request #9332: Make Kubernetes tests pass

Posted by GitBox <gi...@apache.org>.
kaxil commented on pull request #9332:
URL: https://github.com/apache/airflow/pull/9332#issuecomment-645288052


   hmm.. for some reason the k8s test was skipped 🤔 


----------------------------------------------------------------
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] ashb commented on a change in pull request #9332: Make Kubernetes tests pass

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



##########
File path: scripts/ci/libraries/_kind.sh
##########
@@ -329,25 +329,25 @@ function prepare_kubernetes_resources() {
         sed -e "/{{INIT_GIT_SYNC}}/{r ${TEMPLATE_DIRNAME}/init_git_sync.template.yaml" -e 'd}' \
             "${TEMPLATE_DIRNAME}/airflow.template.yaml" >"${BUILD_DIRNAME}/airflow.yaml"
     fi
-    sed -i "s|{{AIRFLOW_KUBERNETES_IMAGE}}|${AIRFLOW_KUBERNETES_IMAGE}|g" "${BUILD_DIRNAME}/airflow.yaml"
+    sed -i ''  "s|{{AIRFLOW_KUBERNETES_IMAGE}}|${AIRFLOW_KUBERNETES_IMAGE}|g" "${BUILD_DIRNAME}/airflow.yaml"
 
-    sed -i "s|{{CONFIGMAP_GIT_REPO}}|${CONFIGMAP_GIT_REPO}|g" "${BUILD_DIRNAME}/airflow.yaml"
-    sed -i "s|{{CONFIGMAP_BRANCH}}|${CONFIGMAP_BRANCH}|g" "${BUILD_DIRNAME}/airflow.yaml"
-    sed -i "s|{{INIT_DAGS_VOLUME_NAME}}|${INIT_DAGS_VOLUME_NAME}|g" "${BUILD_DIRNAME}/airflow.yaml"
-    sed -i "s|{{POD_AIRFLOW_DAGS_VOLUME_NAME}}|${POD_AIRFLOW_DAGS_VOLUME_NAME}|g" \
+    sed -i ''  "s|{{CONFIGMAP_GIT_REPO}}|${CONFIGMAP_GIT_REPO}|g" "${BUILD_DIRNAME}/airflow.yaml"
+    sed -i ''  "s|{{CONFIGMAP_BRANCH}}|${CONFIGMAP_BRANCH}|g" "${BUILD_DIRNAME}/airflow.yaml"
+    sed -i ''  "s|{{INIT_DAGS_VOLUME_NAME}}|${INIT_DAGS_VOLUME_NAME}|g" "${BUILD_DIRNAME}/airflow.yaml"
+    sed -i ''  "s|{{POD_AIRFLOW_DAGS_VOLUME_NAME}}|${POD_AIRFLOW_DAGS_VOLUME_NAME}|g" \

Review comment:
       This should probably be a change on master first/as well. (gsed vs osx sed)




----------------------------------------------------------------
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] potiuk commented on pull request #9332: Make Kubernetes tests pass

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #9332:
URL: https://github.com/apache/airflow/pull/9332#issuecomment-645290400


   ```
       # For pull requests only run tests when python files changed
       if: needs.pyfiles.outputs.count != '0' || github.event_name != 'pull_request'
   ```


----------------------------------------------------------------
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] ashb commented on a change in pull request #9332: fixup! Make Kubernetes tests pass

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



##########
File path: scripts/ci/libraries/_kind.sh
##########
@@ -392,9 +397,9 @@ function wait_for_airflow_pods_up_and_running() {
         echo "------- Running kubectl get pods: $i -------"
         PODS=$(kubectl get pods --cluster "${KUBECTL_CLUSTER_NAME}" | awk 'NR>1 {print $0}')
         echo "$PODS"
-        NUM_AIRFLOW_READY=$(echo "${PODS}" | grep airflow | awk '{print $2}' | grep -cE '([0-9])\/(\1)' \
+        NUM_AIRFLOW_READY=$(echo "${PODS}" | grep airflow | awk '{print $2}' | grep -cE '([2-9])\/(\1)' \
             | xargs)
-        NUM_POSTGRES_READY=$(echo "${PODS}" | grep postgres | awk '{print $2}' | grep -cE '([0-9])\/(\1)' \
+        NUM_POSTGRES_READY=$(echo "${PODS}" | grep postgres | awk '{print $2}' | grep -cE '([1-9])\/(\1)' \

Review comment:
       Can you explain?




----------------------------------------------------------------
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] dimberman commented on pull request #9332: Make Kubernetes tests pass

Posted by GitBox <gi...@apache.org>.
dimberman commented on pull request #9332:
URL: https://github.com/apache/airflow/pull/9332#issuecomment-645423362


   @potiuk but I did change k8s files. That's what is especially weird.


----------------------------------------------------------------
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] dimberman commented on pull request #9332: Make Kubernetes tests pass

Posted by GitBox <gi...@apache.org>.
dimberman commented on pull request #9332:
URL: https://github.com/apache/airflow/pull/9332#issuecomment-645424370


   Ah. I needed to add the dependency


----------------------------------------------------------------
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] dimberman merged pull request #9332: Make Kubernetes tests pass

Posted by GitBox <gi...@apache.org>.
dimberman merged pull request #9332:
URL: https://github.com/apache/airflow/pull/9332


   


----------------------------------------------------------------
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] dimberman commented on a change in pull request #9332: Make Kubernetes tests pass

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



##########
File path: kubernetes_tests/test_kubernetes_pod_operator.py
##########
@@ -74,10 +74,11 @@ def setUp(self):
                 'labels': {
                     'foo': 'bar', 'kubernetes_pod_operator': 'True',
                     'airflow_version': airflow_version.replace('+', '-'),
-                    'execution_date': '2016-01-01T0100000100-a2f50a31f',
-                    'dag_id': 'dag',
-                    'task_id': 'task',
-                    'try_number': '1'},
+                    # 'execution_date': '2016-01-01T0100000100-a2f50a31f',
+                    # 'dag_id': 'dag',
+                    # 'task_id': 'task',
+                    # 'try_number': '1'

Review comment:
       This was code that was merged in erroneously as it's actually the "monitor pods by label" PR I intend to merge later this week. I will delete the commented lines once I see how the next tests go.




----------------------------------------------------------------
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] ashb commented on a change in pull request #9332: fixup! Make Kubernetes tests pass

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



##########
File path: kubernetes_tests/test_kubernetes_pod_operator.py
##########
@@ -804,27 +730,27 @@ def test_pod_priority_class_name(
             priority_class_name=priority_class_name,
         )
 
-        monitor_mock.return_value = (State.SUCCESS, None)
+        run_mock.return_value = (State.SUCCESS, None)
         context = create_context(k)
         k.execute(context)
         actual_pod = self.api_client.sanitize_for_serialization(k.pod)
         self.expected_pod['spec']['priorityClassName'] = priority_class_name
         self.assertEqual(self.expected_pod, actual_pod)
 
-    def test_pod_name(self):
-        pod_name_too_long = "a" * 221
-        with self.assertRaises(AirflowException):
-            KubernetesPodOperator(
-                namespace='default',
-                image="ubuntu:16.04",
-                cmds=["bash", "-cx"],
-                arguments=["echo 10"],
-                labels={"foo": "bar"},
-                name=pod_name_too_long,
-                task_id="task",
-                in_cluster=False,
-                do_xcom_push=False,
-            )
+    # def test_pod_name(self):
+    #     pod_name_too_long = "a" * 221
+    #     with self.assertRaises(AirflowException):
+    #         KubernetesPodOperator(
+    #             namespace='default',
+    #             image="ubuntu:16.04",
+    #             cmds=["bash", "-cx"],
+    #             arguments=["echo 10"],
+    #             labels={"foo": "bar"},
+    #             name=pod_name_too_long,
+    #             task_id="task",
+    #             in_cluster=False,
+    #             do_xcom_push=False,
+    #         )

Review comment:
       Delete if not needed (rather than leave commented out)




----------------------------------------------------------------
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] dimberman commented on a change in pull request #9332: Make Kubernetes tests pass

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



##########
File path: scripts/ci/libraries/_kind.sh
##########
@@ -392,9 +397,9 @@ function wait_for_airflow_pods_up_and_running() {
         echo "------- Running kubectl get pods: $i -------"
         PODS=$(kubectl get pods --cluster "${KUBECTL_CLUSTER_NAME}" | awk 'NR>1 {print $0}')
         echo "$PODS"
-        NUM_AIRFLOW_READY=$(echo "${PODS}" | grep airflow | awk '{print $2}' | grep -cE '([0-9])\/(\1)' \
+        NUM_AIRFLOW_READY=$(echo "${PODS}" | grep airflow | awk '{print $2}' | grep -cE '([2-9])\/(\1)' \
             | xargs)
-        NUM_POSTGRES_READY=$(echo "${PODS}" | grep postgres | awk '{print $2}' | grep -cE '([0-9])\/(\1)' \
+        NUM_POSTGRES_READY=$(echo "${PODS}" | grep postgres | awk '{print $2}' | grep -cE '([1-9])\/(\1)' \

Review comment:
       Before we would move on before the pods were actually ready. So if the scheduler starts up with 0/2, it would say "ok that's good enough". this makes the function hang until "2/2" are ready for the airflow pod and "1/1" is ready for postgres.




----------------------------------------------------------------
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] dimberman commented on pull request #9332: Make Kubernetes tests pass

Posted by GitBox <gi...@apache.org>.
dimberman commented on pull request #9332:
URL: https://github.com/apache/airflow/pull/9332#issuecomment-645446701


   ```
    ------- Running kubectl get pods: 6 -------
   airflow-7ffb5758-n8lf7              0/2     Init:Error   1          21s
   postgres-airflow-5d47468859-llhrq   1/1     Running      0          21s
   PODS are ready.
   ------- Wait until webserver is up: 1 -------
   airflow-7ffb5758-n8lf7              0/2     Init:Error   1          21s
   postgres-airflow-5d47468859-llhrq   1/1     Running      0          21s
   curl: (56) Recv failure: Connection reset by peer
   ```
   
   @ashb FYI with the current setup for the checks it progresses forward when the airflow pod isn't ready.


----------------------------------------------------------------
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] ashb commented on a change in pull request #9332: fixup! Make Kubernetes tests pass

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



##########
File path: kubernetes_tests/test_kubernetes_pod_operator.py
##########
@@ -74,10 +74,11 @@ def setUp(self):
                 'labels': {
                     'foo': 'bar', 'kubernetes_pod_operator': 'True',
                     'airflow_version': airflow_version.replace('+', '-'),
-                    'execution_date': '2016-01-01T0100000100-a2f50a31f',
-                    'dag_id': 'dag',
-                    'task_id': 'task',
-                    'try_number': '1'},
+                    # 'execution_date': '2016-01-01T0100000100-a2f50a31f',
+                    # 'dag_id': 'dag',
+                    # 'task_id': 'task',
+                    # 'try_number': '1'

Review comment:
       What's going on here?




----------------------------------------------------------------
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] potiuk commented on pull request #9332: Make Kubernetes tests pass

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #9332:
URL: https://github.com/apache/airflow/pull/9332#issuecomment-645289431


   Historically they were only run when some of kubernetes code changed. It's likely this.
   


----------------------------------------------------------------
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] potiuk commented on pull request #9332: Make Kubernetes tests pass

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #9332:
URL: https://github.com/apache/airflow/pull/9332#issuecomment-645289837


   One of the optimisations for slow Travis builds


----------------------------------------------------------------
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] ashb commented on a change in pull request #9332: Make Kubernetes tests pass

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



##########
File path: scripts/ci/libraries/_kind.sh
##########
@@ -392,9 +397,9 @@ function wait_for_airflow_pods_up_and_running() {
         echo "------- Running kubectl get pods: $i -------"
         PODS=$(kubectl get pods --cluster "${KUBECTL_CLUSTER_NAME}" | awk 'NR>1 {print $0}')
         echo "$PODS"
-        NUM_AIRFLOW_READY=$(echo "${PODS}" | grep airflow | awk '{print $2}' | grep -cE '([0-9])\/(\1)' \
+        NUM_AIRFLOW_READY=$(echo "${PODS}" | grep airflow | awk '{print $2}' | grep -cE '([2-9])\/(\1)' \
             | xargs)
-        NUM_POSTGRES_READY=$(echo "${PODS}" | grep postgres | awk '{print $2}' | grep -cE '([0-9])\/(\1)' \
+        NUM_POSTGRES_READY=$(echo "${PODS}" | grep postgres | awk '{print $2}' | grep -cE '([1-9])\/(\1)' \

Review comment:
       I don't think `0/2` would match this:
   
   ```bash console
   $ echo 'airflow-r7x5g   1/1     Running     0          27d' | grep airflow | awk  '{print $2}' | grep -cE '([0-9])\/(\1)' | xargs
   1
   $ echo 'airflow-r7x5g   1/2     Running     0          27d' | grep airflow | awk  '{print $2}' | grep -cE '([0-9])\/(\1)' | xargs
   0
   $ echo 'airflow-r7x5g   0/2     Running     0          27d' | grep airflow | awk  '{print $2}' | grep -cE '([0-9])\/(\1)' | xargs
   0
   $ echo 'airflow-r7x5g   2/2     Running     0          27d' | grep airflow | awk  '{print $2}' | grep -cE '([0-9])\/(\1)' | xargs
   1
   ```
   
   So it returns `1` iff all pods are in the running state.  (We test the values captured are `== 1` on L404)




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