Changeset 2c96a32 in trunk
- Timestamp:
- 2008-03-27T23:46:08Z (17 years ago)
- Branches:
- master
- Children:
- 6b416fc2
- Parents:
- 36f5c02
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/allmydata/offloaded.py ¶
r36f5c02 r2c96a32 206 206 os.unlink(self._encoding_file) 207 207 self._finished_observers.fire(r) 208 self._helper.upload_finished(self._storage_index )208 self._helper.upload_finished(self._storage_index, size) 209 209 del self._reader 210 210 211 211 def _failed(self, f): 212 212 self._finished_observers.fire(f) 213 self._helper.upload_finished(self._storage_index )213 self._helper.upload_finished(self._storage_index, 0) 214 214 del self._reader 215 215 … … 378 378 self._have += len(data) 379 379 self._ciphertext_fetched += len(data) 380 self._upload_helper._helper._stats["CHK_fetched_bytes"] += len(data) 380 381 return False # not done 381 382 d.addCallback(_got_data) … … 477 478 "CHK_upload_already_present": 0, 478 479 "CHK_upload_need_upload": 0, 480 "CHK_fetched_bytes": 0, 481 "CHK_encoded_bytes": 0, 479 482 } 480 483 service.MultiService.__init__(self) … … 492 495 size = os.stat(os.path.join(self._chk_incoming, fn))[stat.ST_SIZE] 493 496 chk_incoming_files += 1 494 chk_incoming_size += 1497 chk_incoming_size += size 495 498 for fn in os.listdir(self._chk_encoding): 496 499 size = os.stat(os.path.join(self._chk_encoding, fn))[stat.ST_SIZE] 497 500 chk_encoding_files += 1 498 chk_encoding_size += 1501 chk_encoding_size += size 499 502 stats = {"CHK_active_uploads": len(self._active_uploads), 500 503 "CHK_incoming_files": chk_incoming_files, … … 584 587 return d 585 588 586 def upload_finished(self, storage_index): 589 def upload_finished(self, storage_index, size): 590 self._stats["CHK_encoded_bytes"] += size 587 591 del self._active_uploads[storage_index] -
TabularUnified src/allmydata/web/status.py ¶
r36f5c02 r2c96a32 1 1 2 2 import time 3 import simplejson 3 4 from twisted.internet import defer 4 from nevow import rend, tags as T5 from nevow import rend, inevow, tags as T 5 6 from allmydata.util import base32, idlib 6 7 from allmydata.web.common import IClient, getxmlfile, abbreviate_time, \ 7 abbreviate_rate 8 abbreviate_rate, get_arg 8 9 from allmydata.interfaces import IUploadStatus, IDownloadStatus, \ 9 10 IPublishStatus, IRetrieveStatus … … 761 762 762 763 764 class HelperStatus(rend.Page): 765 docFactory = getxmlfile("helper.xhtml") 766 767 def renderHTTP(self, ctx): 768 t = get_arg(inevow.IRequest(ctx), "t") 769 if t == "json": 770 return self.render_JSON(ctx) 771 # is there a better way to provide 'data' to all rendering methods? 772 helper = IClient(ctx).getServiceNamed("helper") 773 self.original = helper.get_stats()["helper"] 774 return rend.Page.renderHTTP(self, ctx) 775 776 def render_JSON(self, ctx): 777 try: 778 h = IClient(ctx).getServiceNamed("helper") 779 except KeyError: 780 return simplejson.dumps({}) 781 782 stats = h.get_stats()["helper"] 783 return simplejson.dumps(stats, indent=1) 784 785 def render_active_uploads(self, ctx, data): 786 return data["CHK_active_uploads"] 787 788 def render_incoming(self, ctx, data): 789 return "%d bytes in %d files" % (data["CHK_incoming_size"], 790 data["CHK_incoming_files"]) 791 792 def render_encoding(self, ctx, data): 793 return "%d bytes in %d files" % (data["CHK_encoding_size"], 794 data["CHK_encoding_files"]) 795 796 def render_upload_requests(self, ctx, data): 797 return str(data["CHK_upload_requests"]) 798 799 def render_upload_already_present(self, ctx, data): 800 return str(data["CHK_upload_already_present"]) 801 802 def render_upload_need_upload(self, ctx, data): 803 return str(data["CHK_upload_need_upload"]) 804 805 def render_upload_bytes_fetched(self, ctx, data): 806 return str(data["CHK_fetched_bytes"]) 807 808 def render_upload_bytes_encoded(self, ctx, data): 809 return str(data["CHK_encoded_bytes"]) 810 -
TabularUnified src/allmydata/webish.py ¶
r36f5c02 r2c96a32 1446 1446 child_provisioning = provisioning.ProvisioningTool() 1447 1447 child_status = status.Status() 1448 child_helper_status = status.HelperStatus() 1448 1449 1449 1450 def data_version(self, ctx, data):
Note: See TracChangeset
for help on using the changeset viewer.