MCPcopy
hub / github.com/WebODM/WebODM / update_size

Method update_size

app/models/task.py:1635–1648  ·  view source on GitHub ↗
(self, commit=False)

Source from the content-addressed store, hash-verified

1633 return uploaded
1634
1635 def update_size(self, commit=False):
1636 try:
1637 total_bytes = 0
1638 for dirpath, _, filenames in os.walk(self.task_path()):
1639 for f in filenames:
1640 fp = os.path.join(dirpath, f)
1641 if not os.path.islink(fp):
1642 total_bytes += os.path.getsize(fp)
1643 self.size = (total_bytes / 1024 / 1024)
1644 if commit: self.save()
1645
1646 self.project.owner.profile.clear_used_quota_cache()
1647 except Exception as e:
1648 logger.warn("Cannot update size for task {}: {}".format(self, str(e)))
1649
1650
1651 def get_task_assets_cache(self):

Callers 6

compactMethod · 0.95
postMethod · 0.80
deleteMethod · 0.80
commitMethod · 0.80
handleMethod · 0.80

Calls 4

task_pathMethod · 0.95
saveMethod · 0.95
formatMethod · 0.45

Tested by

no test coverage detected