Comments (5)
Hi, thank you for your comment. I was considering implementing exacly this for a while since it seems to be required, but have not had the time. Since I have not, I would certanly accept a PR where we can collaborate on the basis of this idea.
I was thinking something along the lines of input arguments as,
- enable_jijna_in_string_body (bool), default TRUE. Notice the string in the name so it will not be confused with dict input.
- jinja_context (dict), extended by task default options (like airflow jinja).
And methods:
- parse_jinja_body (only runs if enable_jijna_in_string_body is True).
To be added @ line 94 something like,
body = body or self._read_body(
resolve_relative_path(body_filepath or DEFAULT_EXECUTION_OBJECT_PATHS[DEFAULT_EXECTION_OBJECT], 2)
)
assert body is not None and (isinstance(body, (dict, str))), ValueError(
"body must either be a yaml string or a dict"
)
if isinstance(body, str) and self.enable_jijna_in_string_body:
body = self.parse_body_jinja(body)
Requirements:
- Support jinja2 only.
- Support airflow core jinja arguments.
- Support jinja_context (overrides core airflow jinja arguments if they exist, i.e. dict.update)
What do you think?
from kubernetesjoboperator.
The best solution would be to use Go templates directly, but jinja2 should do the trick. I don't think there's a good implementation of Go templates in Python so far. I'll take a look tomorrow. :)
from kubernetesjoboperator.
Hum, I would actially like to stick with Jinja since other operators are integrated with it.
Added support see PR: #27
from kubernetesjoboperator.
Can this be closed?
from kubernetesjoboperator.
Yes! Closing it then giving it a try right away.
from kubernetesjoboperator.
Related Issues (20)
- Duplicate pod logs HOT 4
- BUG: Delete pods after job completion HOT 6
- Connection reset by peer on long job run HOT 14
- Get pod logs when multiple containers are used HOT 7
- Uses cases and testimonials HOT 3
- Executing each task without restarting pods for every task HOT 7
- Is KubernetesJobOperator compatible with Apache Airflow >= v2.0? HOT 10
- FEATURE: Delete all completed tasks, regardless the final result of the task (successful or failed). HOT 24
- Investigate warnings HOT 3
- Secrets not found HOT 1
- FEATURE: Refresh aws token HOT 13
- Error after upgrading to airflow 2.3.3 HOT 2
- Cannot create resource "jobs" HOT 1
- No logs from pod HOT 3
- Any specific setup on kubernetes? HOT 22
- ConnectionResetError: [Errno 104] Connection reset by peer HOT 5
- Running task logs is incomplete HOT 12
- FEATURE: need 'templates_dict' to ensure proper rendering of time macros. HOT 2
- FEATURE: TaskFlow / Decorated Task HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kubernetesjoboperator.