Skip to content

Commit

Permalink
Display ongoing bridge connections
Browse files Browse the repository at this point in the history
  • Loading branch information
lakewik authored Jul 23, 2017
1 parent d4c5f9b commit 2f5ad05
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions UI/file_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ def __init__(self, parent=None, bucketid=None, filepath=None, start=False, dashb
self.connect(self, QtCore.SIGNAL('paintPUSHToken'), self.paint_push_token)
self.connect(self, QtCore.SIGNAL('setOverallProgress'), self.paint_overall_progress)
self.connect(self, QtCore.SIGNAL('disableButtonsForUpload'), self.disable_buttons_for_upload)
self.connect(self, QtCore.SIGNAL('updateOngoingBridgeRequests'), self.update_ongoing_bridge_requests)

# self.connect(self, QtCore.SIGNAL('handleCancelAction'), self.ha)

# resolve buckets and put to buckets combobox
Expand Down Expand Up @@ -191,7 +193,7 @@ def __init__(self, parent=None, bucketid=None, filepath=None, start=False, dashb
self.ui_single_file_upload.max_shard_size.setValue(int(self.configuration.max_shard_size_united()))
self.ui_single_file_upload.shard_size_unit.setCurrentIndex(int(self.configuration.max_shard_size_unit()))


self.ongoing_bridge_requests = 0

self.ui_single_file_upload.connections_onetime.setMaximum(MAX_ALLOWED_UPLOAD_CONCURRENCY)

Expand All @@ -206,7 +208,8 @@ def __init__(self, parent=None, bucketid=None, filepath=None, start=False, dashb
self.current_selected_bucket_id = dashboard_instance.current_selected_bucket_id



def update_ongoing_bridge_requests(self):
self.ui_single_file_upload.ongoing_bridge_requests.setText(str(self.ongoing_bridge_requests))

def disable_buttons_for_upload(self):
self.ui_single_file_upload.connections_onetime.setEnabled(False)
Expand Down Expand Up @@ -744,9 +747,11 @@ def _add_shard_to_table(self, frame_content, shard, chapters):
with: "' +
str(frame_content["farmer"]["address"]) + ":" +
str(frame_content["farmer"]["port"]))
self.ongoing_bridge_requests -= 1

# add row to table
self.emit(QtCore.SIGNAL('addRowToUploadQueueTable'), tablerowdata)
self.emit(QtCore.SIGNAL('updateOngoingBridgeRequests'))

rowcount = self.ui_single_file_upload.shard_queue_table_widget.rowCount()
return rowcount
Expand Down Expand Up @@ -799,10 +804,14 @@ def upload_shard(self, shard, chapters, frame, file_name_ready_to_shard_upload):
QtCore.SIGNAL('setCurrentUploadState'),
'Trying to negotiate storage contract for shard at index %s... Retry %s... ' % (
str(chapters), contract_negotiation_tries))
self.ongoing_bridge_requests += 1
self.emit(QtCore.SIGNAL('updateOngoingBridgeRequests'))
else:
self.emit(
QtCore.SIGNAL('setCurrentUploadState'),
'Trying to negotiate storage contract for shard at index %s...' % str(chapters))
self.ongoing_bridge_requests += 1
self.emit(QtCore.SIGNAL('updateOngoingBridgeRequests'))

try:
if FARMER_NODES_EXCLUSION_FOR_UPLOAD_ENABLED:
Expand Down Expand Up @@ -992,6 +1001,8 @@ def upload_shard(self, shard, chapters, frame, file_name_ready_to_shard_upload):
self.__logger.error('Bridge exception')
self.__logger.error('Exception raised while trying \
to negotiate storage contract for shard at index %s' % chapters)
self.ongoing_bridge_requests -= 1
self.emit(QtCore.SIGNAL('updateOngoingBridgeRequests'))
continue

except Exception as e:
Expand All @@ -1015,6 +1026,8 @@ def upload_shard(self, shard, chapters, frame, file_name_ready_to_shard_upload):
QtCore.SIGNAL('setCurrentUploadState'),
'Sending Exchange Report for shard %s' % str(chapters + 1))
# self.storj_engine.storj_client.send_exchange_report(exchange_report) # send exchange report
self.ongoing_bridge_requests -= 1
self.emit(QtCore.SIGNAL('updateOngoingBridgeRequests'))
continue

# uploaded with success
Expand Down

0 comments on commit 2f5ad05

Please sign in to comment.