Repository navigation
Implement deferrable mode for KubernetesJobOperator - #38251
Merged
Merged
Conversation
moiseenkov
requested review from
hussein-awala and
jedcunningham
as code owners
March 18, 2024 09:12
moiseenkov
force-pushed
the
k8s-start-job-deferrable
branch
4 times, most recently
from
March 18, 2024 12:37
ccfe02b to
e925ce8
Compare
potiuk
force-pushed
the
k8s-start-job-deferrable
branch
from
March 18, 2024 13:11
e925ce8 to
6f10815
Compare
moiseenkov
force-pushed
the
k8s-start-job-deferrable
branch
17 times, most recently
from
March 21, 2024 13:43
456fb4e to
801a8a0
Compare
moiseenkov
force-pushed
the
k8s-start-job-deferrable
branch
from
March 22, 2024 08:18
801a8a0 to
64d7e2d
Compare
Contributor
Author
|
@potiuk , @jedcunningham, @hussein-awala, hi |
potiuk
approved these changes
Mar 22, 2024
marekhanus
reviewed
Nov 1, 2024
| kwargs = { | ||
| "name": job.metadata.name, | ||
| "namespace": job.metadata.namespace, | ||
| "job": self.hook.batch_v1_client.api_client.sanitize_for_serialization(self.job), |
Contributor
There was a problem hiding this comment.
Hi @moiseenkov, what is the purpose of the job argument? I see that it is not valid argument for delete_namespaced_job method.
I'm running on Airflow v2.9.1 and this bad argument causes following error when using KubernetesJobOperator:
Traceback (most recent call last):
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/models/taskinstance.py", line 465, in _execute_task
result = _execute_callable(context=context, **execute_callable_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/models/taskinstance.py", line 432, in _execute_callable
return execute_callable(context=context, **execute_callable_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/models/baseoperator.py", line 400, in wrapper
return func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/cncf/kubernetes/operators/job.py", line 167, in execute
self.job = self.hook.wait_until_job_complete(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/cncf/kubernetes/hooks/kubernetes.py", line 561, in wait_until_job_complete
sleep(job_poll_interval)
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/models/taskinstance.py", line 2612, in signal_handler
self.task.on_kill()
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/cncf/kubernetes/operators/job.py", line 232, in on_kill
self.client.delete_namespaced_job(**kwargs)
File "/home/airflow/.local/lib/python3.12/site-packages/kubernetes/client/api/batch_v1_api.py", line 876, in delete_namespaced_job
return self.delete_namespaced_job_with_http_info(name, namespace, **kwargs) # noqa: E501
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/airflow/.local/lib/python3.12/site-packages/kubernetes/client/api/batch_v1_api.py", line 933, in delete_namespaced_job_with_http_info
raise ApiTypeError(
kubernetes.client.exceptions.ApiTypeError: Got an unexpected keyword argument 'job' to method delete_namespaced_job
Contributor
Author
There was a problem hiding this comment.
Hi @marekhanus ,
This seems to be a bug, and I'm sorry for introducing it. I'd be able to fix it in a couple of weeks. But if you feel you can do it sooner, please feel free to submit your own PR and let me know about it.
Thank you for paying attention to it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement deferrable mode for
KubernetesJobOperator.