Replies: 6 comments 7 replies
-
Thanks for opening your first issue here! Be sure to follow the issue template! |
Beta Was this translation helpful? Give feedback.
-
Why don't you make a POC for that. I don't quite get what you really want to do, but you seem to be well versed in Python and discussion about actual code is much better than clarifying the issue in discussion. That could also give you a chance to understanda how it works and see if what you propose is doable at all @shane-lab |
Beta Was this translation helpful? Give feedback.
-
Draft PR would be great. You can even start with draft PR for the templated_fields in constructor and see if you can make it works first. |
Beta Was this translation helpful? Give feedback.
-
I beleive some parts of the scheduler and task runner code uses |
Beta Was this translation helpful? Give feedback.
-
I converted that into discussion. I think having some POC and addressing the class-level variable issue would be needed to see if this is a viable "feature" |
Beta Was this translation helpful? Give feedback.
-
Sure, I can submit a PR. I think it's actually not too difficult of a task. However, so far I see setting up the local development on a Windows machine is a pain though😅 I try to see if having the enumerated template_fields accessing runtime variables of the operator task actually is an issue. Seems a bit likely though, but a lot of references do show up with a quick file search. |
Beta Was this translation helpful? Give feedback.
-
Description
At the moment the Jinja templates are resolved at the
AbstractOperator
class during render_template. It is best practice to use the provided Kubernetes client package for defining custom resources when using the derivedKubernetesPodOperator
. This gives issues when passing through class instances/objects because the assertions in the method that interpolates the templates currently only supports native types and instances ofDagParam
orXComArg
.Use case/motivation
To give a better example: say I would like to invoke an init container with templated values for my KubernetesPodOperator task using the corresponding classes from the provided k8s client package. The currently present assertions will ignore the class instances and require me to convert these types of objects over to native dictionaries.
Fortunately, the KubernetesPodOperator is able to map from dict to the corresponding classes of the kubernetes client package already, which solves my "issue", but maybe a two-way conversion could be a solution to the mentioned inconvenience above.
Related issues
It would also be great if it was possible to overload/extend the
template_fields
through the constructor. At the moment one has to extend this object after creating an instance of the operator (or create a custom derived class).e.g.
Are you willing to submit a PR?
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions