Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix eks.py SyntaxWarning: invalid esape sequence '\s' #38734

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

dabla
Copy link
Contributor

@dabla dabla commented Apr 4, 2024

When running breeze I always get the following warning:

breeze ci-image build --use-uv --uv-request-timeout 900
Good version of Docker: 24.0.7.
Good version of docker-compose: 2.23.3
Executable permissions on entrypoints are OK
Found 89 providers with 1240 Python files.
eks.py:79: SyntaxWarning: invalid escape sequence '\s'

This pull request fixes this by making the COMMAND string in eks.py a raw string.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@dabla dabla requested review from eladkal and o-nikolas as code owners April 4, 2024 06:51
@boring-cyborg boring-cyborg bot added area:providers provider:amazon AWS/Amazon - related issues labels Apr 4, 2024
@vincbeck vincbeck merged commit bfaa4f2 into apache:main Apr 8, 2024
40 checks passed
@vincbeck
Copy link
Contributor

vincbeck commented Apr 8, 2024

Hi @dabla, it seems this PR introduced a bug. All our system tests related to AWS EKS started to fail for the same reason. See error below:

ERROR [root] exec: failed to decode process output: Expecting value: line 1 column 41 (char 40)
INFO  [airflow.models.taskinstance] ::group::Post task execution logs
ERROR [airflow.task] Task failed with exception
Traceback (most recent call last):
  File "/opt/airflow/airflow/models/taskinstance.py", line 478, in _execute_task
    result = _execute_callable(context=context, **execute_callable_kwargs)
  File "/opt/airflow/airflow/models/taskinstance.py", line 441, in _execute_callable
    return ExecutionCallableRunner(
  File "/opt/airflow/airflow/utils/operator_helpers.py", line 250, in run
    return self.func(*args, **kwargs)
  File "/opt/airflow/airflow/models/baseoperator.py", line 405, in wrapper
    return func(self, *args, **kwargs)
  File "/opt/airflow/airflow/providers/amazon/aws/operators/eks.py", line 1103, in execute
    return super().execute(context)
  File "/opt/airflow/airflow/models/baseoperator.py", line 405, in wrapper
    return func(self, *args, **kwargs)
  File "/opt/airflow/airflow/providers/cncf/kubernetes/operators/pod.py", line 578, in execute
    return self.execute_sync(context)
  File "/opt/airflow/airflow/providers/cncf/kubernetes/operators/pod.py", line 586, in execute_sync
    self.pod = self.get_or_create_pod(  # must set `self.pod` for `on_kill`
  File "/opt/airflow/airflow/providers/cncf/kubernetes/operators/pod.py", line 542, in get_or_create_pod
    pod = self.find_pod(self.namespace or pod_request_obj.metadata.namespace, context=context)
  File "/opt/airflow/airflow/providers/cncf/kubernetes/operators/pod.py", line 524, in find_pod
    pod_list = self.client.list_namespaced_pod(
  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/api/core_v1_api.py", line 15823, in list_namespaced_pod
    return self.list_namespaced_pod_with_http_info(namespace, **kwargs)  # noqa: E501
  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/api/core_v1_api.py", line 15942, in list_namespaced_pod_with_http_info
    return self.api_client.call_api(
  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 348, in call_api
    return self.__call_api(resource_path, method,
  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 180, in __call_api
    response_data = self.request(
  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 373, in request
    return self.rest_client.GET(url,
  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/rest.py", line 244, in GET
    return self.request("GET", url,
  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/rest.py", line 238, in request
    raise ApiException(http_resp=r)
kubernetes.client.exceptions.ApiException: (403)
Reason: Forbidden
HTTP response headers: HTTPHeaderDict({'Audit-Id': 'dede46b8-8f1d-496f-b005-5d49cf69f3a8', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Content-Type-Options': 'nosniff', 'X-Kubernetes-Pf-Flowschema-Uid': '70b99781-63dc-4f6a-8e55-475c91222bbc', 'X-Kubernetes-Pf-Prioritylevel-Uid': '64a41238-df95-49a3-b050-f3a551eb9d19', 'Date': 'Mon, 08 Apr 2024 18:12:50 GMT', 'Content-Length': '261'})
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"pods is forbidden: User \"system:anonymous\" cannot list resource \"pods\" in API group \"\" in the namespace \"default\"","reason":"Forbidden","details":{"kind":"pods"},"code":403}

I am afraid the bug impacts not only AWS system tests but also users. I will create a PR to revert this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers provider:amazon AWS/Amazon - related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants