You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by ma...@apache.org on 2025/01/14 10:58:51 UTC
(cloudberry) 05/16: Remove unused Progress class from gpload
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit eecff11584675a0d56c4c6174e62cab60a99ec79
Author: Bradford D. Boyle <br...@vmware.com>
AuthorDate: Thu May 18 16:57:15 2023 -0700
Remove unused Progress class from gpload
Authored-by: Bradford D. Boyle <br...@vmware.com>
---
gpMgmt/bin/gpload.py | 87 +---------------------------------------------------
1 file changed, 1 insertion(+), 86 deletions(-)
diff --git a/gpMgmt/bin/gpload.py b/gpMgmt/bin/gpload.py
index c313ec93e4..9813f7d305 100755
--- a/gpMgmt/bin/gpload.py
+++ b/gpMgmt/bin/gpload.py
@@ -777,7 +777,7 @@ def bytestr(size, precision=1):
if size >= factor:
break
- float_string_split = "size/float(factor)".split('.')
+ float_string_split = repr(size/float(factor)).split('.')
integer_part = float_string_split[0]
decimal_part = float_string_split[1]
if int(decimal_part[0:precision]):
@@ -836,83 +836,6 @@ class CatThread(threading.Thread):
self.gpload.log(self.gpload.WARN, "gpfdist log halt because Log Thread '%s' got an exception: %s" % (self.getName(), str(e)))
raise
-class Progress(threading.Thread):
- """
- Determine our progress from the gpfdist daemon
- """
- def __init__(self,gpload,ports):
- threading.Thread.__init__(self)
- self.gpload = gpload
- self.ports = ports
- self.number = 0
- self.condition = threading.Condition()
-
- def get(self,port):
- """
- Connect to gpfdist and issue an HTTP query. No need to do this with
- httplib as the transaction is extremely simple
- """
- addrinfo = socket.getaddrinfo('localhost', port)
- s = socket.socket(addrinfo[0][0],socket.SOCK_STREAM)
- s.connect(('localhost',port))
- s.sendall('GET gpfdist/status HTTP/1.0\r\n\r\n')
- f = s.makefile()
- read_bytes = -1
- total_bytes = -1
- total_sessions = -1
- for line in f:
- self.gpload.log(self.gpload.DEBUG, "gpfdist stat: %s" % \
- line.strip('\n'))
- a = line.split(' ')
- if not a:
- continue
- if a[0]=='read_bytes':
- read_bytes = int(a[1])
- elif a[0]=='total_bytes':
- total_bytes = int(a[1])
- elif a[0]=='total_sessions':
- total_sessions = int(a[1])
- s.close()
- f.close()
- return read_bytes,total_bytes,total_sessions
-
- def get1(self):
- """
- Parse gpfdist output
- """
- read_bytes = 0
- total_bytes = 0
- for port in self.ports:
- a = self.get(port)
- if a[2]<1:
- return
- if a[0]!=-1:
- read_bytes += a[0]
- if a[1]!=-1:
- total_bytes += a[1]
- self.gpload.log(self.gpload.INFO,'transferred %s of %s' % \
- (bytestr(read_bytes),bytestr(total_bytes)))
-
- def run(self):
- """
- Thread worker
- """
- while 1:
- try:
- self.condition.acquire()
- n = self.number
- self.condition.release()
- self.get1()
- if n:
- self.gpload.log(self.gpload.DEBUG, "gpfdist status thread told to stop")
- self.condition.acquire()
- self.condition.notify()
- self.condition.release()
- break
- except socket.error as e:
- self.gpload.log(self.gpload.DEBUG, "got socket exception: %s" % e)
- break
- time.sleep(1)
def cli_help():
help_path = os.path.join(sys.path[0], '..', 'docs', 'cli_help', EXECNAME +
'_help');
@@ -2661,10 +2584,6 @@ WHERE relname = 'staging_gpload_reusable_%s';""" % (encoding_conditions)
sql += ' SELECT %s' % ','.join([a[2] for a in cols])
sql += ' FROM %s' % self.extSchemaTable
- # cktan: progress thread is not reliable. revisit later.
- #progress = Progress(self,self.ports)
- #progress.start()
- #self.threads.append(progress)
self.log(self.LOG, sql)
if not self.options.D:
try:
@@ -2676,10 +2595,6 @@ WHERE relname = 'staging_gpload_reusable_%s';""" % (encoding_conditions)
strE = e.__str__().encode().decode('unicode-escape')
strF = sql.encode().decode('unicode-escape')
self.log(self.ERROR, strE + ' encountered while running ' + strF)
- #progress.condition.acquire()
- #progress.number = 1
- #progress.condition.wait()
- #progress.condition.release()
self.report_errors()
def do_method_insert(self):
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org