[ 
https://issues.apache.org/jira/browse/AIRFLOW-6843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17043613#comment-17043613
 ] 

ASF GitHub Bot commented on AIRFLOW-6843:
-----------------------------------------

petedejoy commented on pull request #7523: [AIRFLOW-6843] Add 
delete_option_kwargs to `V1DeleteOptions`  of kube client 
`delete_namespaced_pod` request
URL: https://github.com/apache/airflow/pull/7523
 
 
   ---
   Issue link: WILL BE INSERTED BY 
[boring-cyborg](https://github.com/kaxil/boring-cyborg)
   
   If you're using the Kubernetes executor, Amazon EKS deletes pods very 
quickly after tasks complete. This can be an issue if you're scraping Airflow 
logs from a service like FluentD, as it means that the task pod gets deleted 
before FluentD can pick up logs for fast-running (or fast-failing) tasks.
   
   The `kube_client_request_args` environment variable is passed to the 
`delete_namespaced_pod` client request, but we need a way to pass the 
`grace_period_seconds` param (and potentially others) to the `V1DeleteOptions` 
included in the body of the request. Towards that objective, I've created a 
`delete_option_kwargs` object that can be set via an Airflow environment 
variable. This is object is then passed to the `V1DeleteOptions` of the 
`delete_namespaced_pods` request.
   
   This can be set via an `AIRFLOW__KUBERNETES__DELETE_OPTION_KWARGS` env var. 
The value should be JSON and can contain any of the options available in the 
[Kube client `V1DeleteOptions` 
class.](https://github.com/kubernetes-client/python/blob/41f11a09995efcd0142e25946adc7591431bfb2f/kubernetes/client/models/v1_delete_options.py#L19)
   Make sure to mark the boxes below before creating PR: [x]
   
   - [x] Description above provides context of the change
   - [x] Commit message/PR title starts with `[AIRFLOW-NNNN]`. AIRFLOW-NNNN = 
JIRA ID<sup>*</sup>
   - [ ] Unit tests coverage for changes (not needed for documentation changes)
   - [x] Commits follow "[How to write a good git commit 
message](http://chris.beams.io/posts/git-commit/)"
   - [ ] Relevant documentation is updated including usage instructions.
   - [x] I will engage committers as explained in [Contribution Workflow 
Example](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#contribution-workflow-example).
   
   <sup>*</sup> For document-only changes commit message can start with 
`[AIRFLOW-XXXX]`.
   
   ---
   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:
us...@infra.apache.org


> Add grace_period_seconds config option for delete_namespaced_pod kube client 
> request
> ------------------------------------------------------------------------------------
>
>                 Key: AIRFLOW-6843
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-6843
>             Project: Apache Airflow
>          Issue Type: Improvement
>          Components: executor-kubernetes
>    Affects Versions: 1.10.9
>            Reporter: Pete DeJoy
>            Assignee: Pete DeJoy
>            Priority: Major
>
> If you're using the Kubernetes executor, Amazon EKS deletes pods very quickly 
> after the tasks complete. This can be an issue if you're scraping Airflow 
> logs from a service like FluentD, as it means that the task pod gets deleted 
> before FluentD can pick up logs for fast-running (or fast-failing) tasks.
> The [`kube_client_request_args`|#kube-client-request-args]] environment 
> variable is passed to the [`delete_namespaced_pod`|#L443]] client request, 
> but passing the necessary [`grace_period_seconds`|#delete_namespaced_pod]] as 
> a [`post_param`|#L108]] on that object causes other client requests to fail, 
> as that `kube_client_request_args` is passed as a kwarg to all client 
> requests, even those that don't have a `post_params` option for 
> `grace_period_seconds`.
> In order to provide a config option that fixes this issue, there needs to be 
> a new configurable environment variable 
> `AIRFLOW__KUBERNETES____DELETE_POD_GRACE_PERIOD_SECONDS` option that we pass 
> to the [`delete_namespaced_pod`|#L443]] client request as its own argument. 
> This will be defaulted to 0.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to