Closed blythed closed 1 month ago
In my experiments I tried something like this:
import dataclasses as dc
@dc.dataclass(kw_only=True)
class Template(Component):
_artifacts = [('template', pickle_serializer)]
template: t.Union[Component, t.Dict]
def __post_init__(self):
if isininstance(self.template, Component):
self.template = self.template.encode()
def on_create(self):
# save all of the artifacts in self.template in the artifact store also
def __call__(self, **kwargs):
# set the variables of the template and return the component
...
Example:
Key part of tech. is to "save" the component
m
which has variables, without polluting thedb.show
system. One idea is to save them.encode()
output as an artifact. This would also need to have the artifacts mentioned in the template saved also. When reloadingt
, should make sure that all artifacts are loaded.