airflow.providers.cncf.kubernetes.python_kubernetes_script

Utilities for using the kubernetes decorator.

Module Contents

Functions

remove_task_decorator(python_source, task_decorator_name)

Remove @task.kubernetes or similar as well as @setup and @teardown.

write_python_script(jinja_context, filename[, ...])

Render the python script to a file to execute in the virtual environment.

airflow.providers.cncf.kubernetes.python_kubernetes_script.remove_task_decorator(python_source, task_decorator_name)[source]

Remove @task.kubernetes or similar as well as @setup and @teardown.

Parameters
  • python_source (str) – python source code

  • task_decorator_name (str) – the task decorator name

airflow.providers.cncf.kubernetes.python_kubernetes_script.write_python_script(jinja_context, filename, render_template_as_native_obj=False)[source]

Render the python script to a file to execute in the virtual environment.

Parameters
  • jinja_context (dict) – The jinja context variables to unpack and replace with its placeholders in the template file.

  • filename (str) – The name of the file to dump the rendered script to.

  • render_template_as_native_obj (bool) – If True, rendered Jinja template would be converted to a native Python object

Was this entry helpful?