Skip to content

Commit

Permalink
Fix edit endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
blythed committed Jan 2, 2025
1 parent a18c1aa commit 071ba59
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
7 changes: 1 addition & 6 deletions superduper/components/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def _find_refs(r):

def get_children(self, deep: bool = False) -> t.List["Component"]:
"""Get all the children of the component."""
r = self.dict().encode(leaves_to_keep=Component)
r = self.dict().encode(leaves_to_keep=(Component,))
out = [v for v in r['_builds'].values() if isinstance(v, Component)]
lookup = {}
for v in out:
Expand Down Expand Up @@ -890,11 +890,6 @@ def decode(cls, r, db: t.Optional[t.Any] = None, reference: bool = False):
assert r['version'] is not None
return db.load(r['type_id'], r['identifier'], r['version'])

def __setattr__(self, k, v):
if k in dc.fields(self):
self.changed.add(k)
return super().__setattr__(k, v)

def info(self, verbosity: int = 1):
"""Method to display the component information.
Expand Down
2 changes: 1 addition & 1 deletion superduper/components/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def form_template(self):
'types': self.types,
'schema': self.schema,
**{k: v for k, v in self.template.items() if k != 'identifier'},
'_template_name': self.identifier,
'build_template': self.identifier,
}


Expand Down
9 changes: 9 additions & 0 deletions superduper/rest/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,16 @@ def db_upload(raw: bytes = File(...), db: 'Datalayer' = DatalayerDependency()):
def _process_db_apply(db, component, id: str | None = None):
def _apply():
nonlocal component
variables = None
build_template = component['build_template']
if '_variables' in component:
variables = component['_variables']

component = Document.decode(component, db=db).unpack()
if variables:
component.build_template = build_template
component.build_variables = variables

db.apply(component, force=True)

if id:
Expand Down

0 comments on commit 071ba59

Please sign in to comment.