-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace jinja templates with class generation for parameterized jobs #378
Comments
Yes this is entirely derived from the proof-of-concept and the whole thing needs to be rewritten, basically. I think one solution is to have all the common logic in I think this issue is too vague and not describing an actual issue or proposing an actual solution, so could you please rework it or maybe create specific ones that can be resolved with concrete changes? |
This is exactly what i am working on now, and exactly my thoughts @yurinnick . As i'm working now on improving kbuild i propose following (it is very early draft proposal): When we generate job template, for any runtime, instead of going complex jinja2 magic we rather just execute "kci job generate --input-node-json nodefile.json jobname", which will generate compiling steps for next container (cross-compiler specific). So for kubernetes it will looks like:
For Docker runtime it is a bit more complicated, but flow is about the same, first container will prepare everything, then spin "compiler" DinD, wait until it is completed, and do "finalize" job. Such job templates will be much easier to troubleshoot manually as well. |
So maybe we can use something like this: import sys
class BaseJob:
def __init__(self, name):
self.name = name
def test(self):
print("Base param: "+self.name)
class Kbuild(BaseJob):
def __init__(self, name):
super().__init__(name)
def test(self):
print("Kbuild param: "+self.name)
class Kunit(BaseJob):
def __init__(self, name):
super().__init__(name)
def test(self):
print("Kunit param: "+self.name)
def main():
JobClass = getattr(sys.modules[__name__], "Kbuild")("param1")
JobClass.test()
JobClass = getattr(sys.modules[__name__], "Kunit")("param2")
JobClass.test()
if __name__ == "__main__":
main() |
What's the |
I did short PoC of defining classes over variable and verified if it works, it is specific to this PoC. |
Right, but how is that meant to work in terms of separating the job definition and the Runtime implementations? |
Similar as before, just we don't generate new class over jinja2 template, we write for example KbuildJob, KunitJob, KverJob classes. |
Currently
kbuild
,kunit
,fstests
etc. jobs are based on python-heavy jinja2 templates. It makes it a whole lot difficult to understand and make changes. Let's discuss ways to move from templates to parameterized classes or class generators, or any other solution here.The text was updated successfully, but these errors were encountered: