diff -Naur koji.old/cli/koji koji/cli/koji --- koji.old/cli/koji 2016-03-04 13:23:36.000000000 +0800 +++ koji/cli/koji 2016-03-07 14:43:32.000000000 +0800 @@ -156,6 +156,7 @@ parser.add_option("--weburl", help=_("url of the Koji web interface")) parser.add_option("--topurl", help=_("url for Koji file access")) parser.add_option("--pkgurl", help=optparse.SUPPRESS_HELP) + parser.add_option("--upload-blocksize", help=_("upload the koji hup how many bytes per request")) parser.add_option("--help-commands", action="store_true", default=False, help=_("list commands")) (options, args) = parser.parse_args()
@@ -208,6 +209,7 @@ 'keepalive' : True, 'timeout' : None, 'use_fast_upload': False, + 'upload_blocksize': 1048576, 'poll_interval': 5, 'krbservice': 'host', 'cert': '~/.koji/client.crt', @@ -252,7 +254,8 @@ if name in ('anon_retry', 'offline_retry', 'keepalive', 'use_fast_upload'): defaults[name] = config.getboolean(options.profile, name) elif name in ('max_retries', 'retry_interval', - 'offline_retry_interval', 'poll_interval', 'timeout'): + 'offline_retry_interval', 'poll_interval', 'timeout', + 'upload_blocksize'): try: defaults[name] = int(value) except ValueError: @@ -6900,8 +6903,9 @@
session_opts = {} for k in ('user', 'password', 'krbservice', 'debug_xmlrpc', 'debug', 'max_retries', - 'retry_interval', 'offline_retry', 'offline_retry_interval', - 'anon_retry', 'keepalive', 'timeout', 'use_fast_upload'): + 'retry_interval', 'offline_retry', 'offline_retry_interval', + 'anon_retry', 'keepalive', 'timeout', 'use_fast_upload', + 'upload_blocksize'): value = getattr(options,k) if value is not None: session_opts[k] = value diff -Naur koji.old/koji/__init__.py koji/koji/__init__.py --- koji.old/koji/__init__.py 2016-03-04 13:23:36.000000000 +0800 +++ koji/koji/__init__.py 2016-03-07 10:14:32.000000000 +0800 @@ -2016,7 +2016,10 @@ # raise AttributeError, "no attribute %r" % name return VirtualMethod(self._callMethod,name)
- def fastUpload(self, localfile, path, name=None, callback=None, blocksize=1048576, overwrite=False): + def fastUpload(self, localfile, path, name=None, callback=None, blocksize=None, overwrite=False): + if blocksize is None: + blocksize = self.opts.get('upload_blocksize') + if not self.logged_in: raise ActionNotAllowed, 'You must be logged in to upload files' if name is None: @@ -2090,8 +2093,11 @@ request = chunk return handler, headers, request
- def uploadWrapper(self, localfile, path, name=None, callback=None, blocksize=1048576, overwrite=True): + def uploadWrapper(self, localfile, path, name=None, callback=None, blocksize=None, overwrite=True): """upload a file in chunks using the uploadFile call""" + if blocksize is None: + blocksize = self.opts.get('upload_blocksize') + if self.opts.get('use_fast_upload'): self.fastUpload(localfile, path, name, callback, blocksize, overwrite) return
Hi Xibo,
Please submit your patch as a pull request on https://pagure.io/koji
Thanks
Dennis
On Monday, March 07, 2016 02:54:17 AM Xibo Ning wrote:
diff -Naur koji.old/cli/koji koji/cli/koji --- koji.old/cli/koji 2016-03-04 13:23:36.000000000 +0800 +++ koji/cli/koji 2016-03-07 14:43:32.000000000 +0800 @@ -156,6 +156,7 @@ parser.add_option("--weburl", help=_("url of the Koji web interface")) parser.add_option("--topurl", help=_("url for Koji file access")) parser.add_option("--pkgurl", help=optparse.SUPPRESS_HELP)
- parser.add_option("--upload-blocksize", help=_("upload the koji hup how
many bytes per request")) parser.add_option("--help-commands", action="store_true", default=False, help=_("list commands")) (options, args) = parser.parse_args()
@@ -208,6 +209,7 @@ 'keepalive' : True, 'timeout' : None, 'use_fast_upload': False,
'upload_blocksize': 1048576, 'poll_interval': 5, 'krbservice': 'host', 'cert': '~/.koji/client.crt',
@@ -252,7 +254,8 @@ if name in ('anon_retry', 'offline_retry', 'keepalive', 'use_fast_upload'): defaults[name] = config.getboolean(options.profile, name) elif name in ('max_retries', 'retry_interval', - 'offline_retry_interval', 'poll_interval', 'timeout'): + 'offline_retry_interval', 'poll_interval', 'timeout', + 'upload_blocksize'): try: defaults[name] = int(value) except ValueError: @@ -6900,8 +6903,9 @@
session_opts = {} for k in ('user', 'password', 'krbservice', 'debug_xmlrpc', 'debug',
'max_retries', - 'retry_interval', 'offline_retry', 'offline_retry_interval', - 'anon_retry', 'keepalive', 'timeout', 'use_fast_upload'): + 'retry_interval', 'offline_retry', 'offline_retry_interval', + 'anon_retry', 'keepalive', 'timeout', 'use_fast_upload', + 'upload_blocksize'): value = getattr(options,k) if value is not None: session_opts[k] = value diff -Naur koji.old/koji/__init__.py koji/koji/__init__.py --- koji.old/koji/__init__.py 2016-03-04 13:23:36.000000000 +0800 +++ koji/koji/__init__.py 2016-03-07 10:14:32.000000000 +0800 @@ -2016,7 +2016,10 @@ # raise AttributeError, "no attribute %r" % name return VirtualMethod(self._callMethod,name)
- def fastUpload(self, localfile, path, name=None, callback=None,
blocksize=1048576, overwrite=False): + def fastUpload(self, localfile, path, name=None, callback=None, blocksize=None, overwrite=False): + if blocksize is None:
blocksize = self.opts.get('upload_blocksize')
if not self.logged_in: raise ActionNotAllowed, 'You must be logged in to upload files'
if name is None: @@ -2090,8 +2093,11 @@ request = chunk return handler, headers, request
- def uploadWrapper(self, localfile, path, name=None, callback=None,
blocksize=1048576, overwrite=True): + def uploadWrapper(self, localfile, path, name=None, callback=None, blocksize=None, overwrite=True): """upload a file in chunks using the uploadFile call"""
if blocksize is None:
blocksize = self.opts.get('upload_blocksize')
if self.opts.get('use_fast_upload'): self.fastUpload(localfile, path, name, callback, blocksize,
overwrite) return
While Pagure is preferred, patches here are also acceptable. They are, however, more easily forgotten. In this case, I was expecting the patch, so I won't lose it. Thanks Xibo!
On Mon, Mar 7, 2016 at 8:43 AM, Dennis Gilmore dennis@ausil.us wrote:
Hi Xibo,
Please submit your patch as a pull request on https://pagure.io/koji
Thanks
Dennis
On Monday, March 07, 2016 02:54:17 AM Xibo Ning wrote:
diff -Naur koji.old/cli/koji koji/cli/koji --- koji.old/cli/koji 2016-03-04 13:23:36.000000000 +0800 +++ koji/cli/koji 2016-03-07 14:43:32.000000000 +0800 @@ -156,6 +156,7 @@ parser.add_option("--weburl", help=_("url of the Koji web
interface"))
parser.add_option("--topurl", help=_("url for Koji file access")) parser.add_option("--pkgurl", help=optparse.SUPPRESS_HELP)
- parser.add_option("--upload-blocksize", help=_("upload the koji hup
how
many bytes per request")) parser.add_option("--help-commands", action="store_true", default=False, help=_("list commands")) (options, args) = parser.parse_args()
@@ -208,6 +209,7 @@ 'keepalive' : True, 'timeout' : None, 'use_fast_upload': False,
'upload_blocksize': 1048576, 'poll_interval': 5, 'krbservice': 'host', 'cert': '~/.koji/client.crt',
@@ -252,7 +254,8 @@ if name in ('anon_retry', 'offline_retry',
'keepalive',
'use_fast_upload'): defaults[name] = config.getboolean(options.profile, name) elif name in ('max_retries', 'retry_interval', - 'offline_retry_interval', 'poll_interval', 'timeout'): + 'offline_retry_interval', 'poll_interval', 'timeout', + 'upload_blocksize'): try: defaults[name] = int(value) except ValueError: @@ -6900,8 +6903,9 @@
session_opts = {} for k in ('user', 'password', 'krbservice', 'debug_xmlrpc', 'debug',
'max_retries', - 'retry_interval', 'offline_retry', 'offline_retry_interval', - 'anon_retry', 'keepalive', 'timeout', 'use_fast_upload'): + 'retry_interval', 'offline_retry', 'offline_retry_interval', + 'anon_retry', 'keepalive', 'timeout', 'use_fast_upload', + 'upload_blocksize'): value = getattr(options,k) if value is not None: session_opts[k] = value diff -Naur koji.old/koji/__init__.py koji/koji/__init__.py --- koji.old/koji/__init__.py 2016-03-04 13:23:36.000000000 +0800 +++ koji/koji/__init__.py 2016-03-07 10:14:32.000000000 +0800 @@ -2016,7 +2016,10 @@ # raise AttributeError, "no attribute %r" % name return VirtualMethod(self._callMethod,name)
- def fastUpload(self, localfile, path, name=None, callback=None,
blocksize=1048576, overwrite=False): + def fastUpload(self, localfile, path, name=None, callback=None, blocksize=None, overwrite=False): + if blocksize is None:
blocksize = self.opts.get('upload_blocksize')
if not self.logged_in: raise ActionNotAllowed, 'You must be logged in to upload
files'
if name is None: @@ -2090,8 +2093,11 @@ request = chunk return handler, headers, request
- def uploadWrapper(self, localfile, path, name=None, callback=None,
blocksize=1048576, overwrite=True): + def uploadWrapper(self,
localfile,
path, name=None, callback=None, blocksize=None, overwrite=True):
"""upload
a file in chunks using the uploadFile call"""
if blocksize is None:
blocksize = self.opts.get('upload_blocksize')
if self.opts.get('use_fast_upload'): self.fastUpload(localfile, path, name, callback, blocksize,
overwrite) return
koji-devel mailing list koji-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/koji-devel@lists.fedorahosted.org
On Mon, Mar 7, 2016 at 12:54 AM, Xibo Ning xning@redhat.com wrote:
diff -Naur koji.old/cli/koji koji/cli/koji --- koji.old/cli/koji 2016-03-04 13:23:36.000000000 +0800 +++ koji/cli/koji 2016-03-07 14:43:32.000000000 +0800 @@ -156,6 +156,7 @@ parser.add_option("--weburl", help=_("url of the Koji web interface")) parser.add_option("--topurl", help=_("url for Koji file access")) parser.add_option("--pkgurl", help=optparse.SUPPRESS_HELP)
- parser.add_option("--upload-blocksize", help=_("upload the koji hup how many bytes per request")) parser.add_option("--help-commands", action="store_true", default=False, help=_("list commands")) (options, args) = parser.parse_args()
hup -> hub :)
- Ken
Thanks a lot, Ken. Sorry, Michael. The new patch fix the wrong word.
----- 原始邮件 ----- 发件人: "Ken Dreyer" ktdreyer@ktdreyer.com 收件人: "Koji development" koji-devel@lists.fedorahosted.org 抄送: dgregor@redhat.com, mikem@redhat.com 发送时间: 星期一, 2016年 3 月 14日 上午 10:15:49 主题: Re: [PATCH] make the upload block size configurable
On Mon, Mar 7, 2016 at 12:54 AM, Xibo Ning xning@redhat.com wrote:
diff -Naur koji.old/cli/koji koji/cli/koji --- koji.old/cli/koji 2016-03-04 13:23:36.000000000 +0800 +++ koji/cli/koji 2016-03-07 14:43:32.000000000 +0800 @@ -156,6 +156,7 @@ parser.add_option("--weburl", help=_("url of the Koji web interface")) parser.add_option("--topurl", help=_("url for Koji file access")) parser.add_option("--pkgurl", help=optparse.SUPPRESS_HELP)
- parser.add_option("--upload-blocksize", help=_("upload the koji hup how many bytes per request")) parser.add_option("--help-commands", action="store_true", default=False, help=_("list commands")) (options, args) = parser.parse_args()
hup -> hub :)
- Ken _______________________________________________ koji-devel mailing list koji-devel@lists.fedorahosted.org https://lists.fedorahosted.org/admin/lists/koji-devel@lists.fedorahosted.org
On 03/07/2016 02:54 AM, Xibo Ning wrote:
diff -Naur koji.old/cli/koji koji/cli/koji --- koji.old/cli/koji 2016-03-04 13:23:36.000000000 +0800 +++ koji/cli/koji 2016-03-07 14:43:32.000000000 +0800 @@ -156,6 +156,7 @@ parser.add_option("--weburl", help=_("url of the Koji web interface")) parser.add_option("--topurl", help=_("url for Koji file access")) parser.add_option("--pkgurl", help=optparse.SUPPRESS_HELP)
- parser.add_option("--upload-blocksize", help=_("upload the koji hup how many bytes per request")) parser.add_option("--help-commands", action="store_true", default=False, help=_("list commands")) (options, args) = parser.parse_args()
Thanks, working here. There were a couple small issues that I fixed when I merged the change. - upload-blocksize doesn't really need to be a cli opt (config file is enough), so I dropped it. Also, it would need to be type='int' if we kept it. - we still have to preserve the default blocksize in the api, for apps that are not the cli
@@ -208,6 +209,7 @@ 'keepalive' : True, 'timeout' : None, 'use_fast_upload': False,
'upload_blocksize': 1048576, 'poll_interval': 5, 'krbservice': 'host', 'cert': '~/.koji/client.crt',
@@ -252,7 +254,8 @@ if name in ('anon_retry', 'offline_retry', 'keepalive', 'use_fast_upload'): defaults[name] = config.getboolean(options.profile, name) elif name in ('max_retries', 'retry_interval',
'offline_retry_interval', 'poll_interval', 'timeout'):
'offline_retry_interval', 'poll_interval', 'timeout',
'upload_blocksize'): try: defaults[name] = int(value) except ValueError:
@@ -6900,8 +6903,9 @@
session_opts = {} for k in ('user', 'password', 'krbservice', 'debug_xmlrpc', 'debug', 'max_retries',
'retry_interval', 'offline_retry', 'offline_retry_interval',
'anon_retry', 'keepalive', 'timeout', 'use_fast_upload'):
'retry_interval', 'offline_retry', 'offline_retry_interval',
'anon_retry', 'keepalive', 'timeout', 'use_fast_upload',
'upload_blocksize'): value = getattr(options,k) if value is not None: session_opts[k] = value
diff -Naur koji.old/koji/__init__.py koji/koji/__init__.py --- koji.old/koji/__init__.py 2016-03-04 13:23:36.000000000 +0800 +++ koji/koji/__init__.py 2016-03-07 10:14:32.000000000 +0800 @@ -2016,7 +2016,10 @@ # raise AttributeError, "no attribute %r" % name return VirtualMethod(self._callMethod,name)
- def fastUpload(self, localfile, path, name=None, callback=None, blocksize=1048576, overwrite=False):
- def fastUpload(self, localfile, path, name=None, callback=None, blocksize=None, overwrite=False):
if blocksize is None:
blocksize = self.opts.get('upload_blocksize')
if not self.logged_in: raise ActionNotAllowed, 'You must be logged in to upload files' if name is None:
@@ -2090,8 +2093,11 @@ request = chunk return handler, headers, request
- def uploadWrapper(self, localfile, path, name=None, callback=None, blocksize=1048576, overwrite=True):
- def uploadWrapper(self, localfile, path, name=None, callback=None, blocksize=None, overwrite=True): """upload a file in chunks using the uploadFile call"""
if blocksize is None:
blocksize = self.opts.get('upload_blocksize')
if self.opts.get('use_fast_upload'): self.fastUpload(localfile, path, name, callback, blocksize, overwrite) return
Thanks, Michael.
----- 原始邮件 ----- 发件人: "Mike McLean" mikem@redhat.com 收件人: "Xibo Ning" xning@redhat.com, koji-devel@lists.fedorahosted.org 抄送: dgregor@redhat.com 发送时间: 星期五, 2016年 3 月 25日 上午 4:16:22 主题: Re: [PATCH] make the upload block size configurable
On 03/07/2016 02:54 AM, Xibo Ning wrote:
diff -Naur koji.old/cli/koji koji/cli/koji --- koji.old/cli/koji 2016-03-04 13:23:36.000000000 +0800 +++ koji/cli/koji 2016-03-07 14:43:32.000000000 +0800 @@ -156,6 +156,7 @@ parser.add_option("--weburl", help=_("url of the Koji web interface")) parser.add_option("--topurl", help=_("url for Koji file access")) parser.add_option("--pkgurl", help=optparse.SUPPRESS_HELP)
- parser.add_option("--upload-blocksize", help=_("upload the koji hup how many bytes per request")) parser.add_option("--help-commands", action="store_true", default=False, help=_("list commands")) (options, args) = parser.parse_args()
Thanks, working here. There were a couple small issues that I fixed when I merged the change. - upload-blocksize doesn't really need to be a cli opt (config file is enough), so I dropped it. Also, it would need to be type='int' if we kept it. - we still have to preserve the default blocksize in the api, for apps that are not the cli
@@ -208,6 +209,7 @@ 'keepalive' : True, 'timeout' : None, 'use_fast_upload': False,
'upload_blocksize': 1048576, 'poll_interval': 5, 'krbservice': 'host', 'cert': '~/.koji/client.crt',
@@ -252,7 +254,8 @@ if name in ('anon_retry', 'offline_retry', 'keepalive', 'use_fast_upload'): defaults[name] = config.getboolean(options.profile, name) elif name in ('max_retries', 'retry_interval',
'offline_retry_interval', 'poll_interval', 'timeout'):
'offline_retry_interval', 'poll_interval', 'timeout',
'upload_blocksize'): try: defaults[name] = int(value) except ValueError:
@@ -6900,8 +6903,9 @@
session_opts = {} for k in ('user', 'password', 'krbservice', 'debug_xmlrpc', 'debug', 'max_retries',
'retry_interval', 'offline_retry', 'offline_retry_interval',
'anon_retry', 'keepalive', 'timeout', 'use_fast_upload'):
'retry_interval', 'offline_retry', 'offline_retry_interval',
'anon_retry', 'keepalive', 'timeout', 'use_fast_upload',
'upload_blocksize'): value = getattr(options,k) if value is not None: session_opts[k] = value
diff -Naur koji.old/koji/__init__.py koji/koji/__init__.py --- koji.old/koji/__init__.py 2016-03-04 13:23:36.000000000 +0800 +++ koji/koji/__init__.py 2016-03-07 10:14:32.000000000 +0800 @@ -2016,7 +2016,10 @@ # raise AttributeError, "no attribute %r" % name return VirtualMethod(self._callMethod,name)
- def fastUpload(self, localfile, path, name=None, callback=None, blocksize=1048576, overwrite=False):
- def fastUpload(self, localfile, path, name=None, callback=None, blocksize=None, overwrite=False):
if blocksize is None:
blocksize = self.opts.get('upload_blocksize')
if not self.logged_in: raise ActionNotAllowed, 'You must be logged in to upload files' if name is None:
@@ -2090,8 +2093,11 @@ request = chunk return handler, headers, request
- def uploadWrapper(self, localfile, path, name=None, callback=None, blocksize=1048576, overwrite=True):
- def uploadWrapper(self, localfile, path, name=None, callback=None, blocksize=None, overwrite=True): """upload a file in chunks using the uploadFile call"""
if blocksize is None:
blocksize = self.opts.get('upload_blocksize')
if self.opts.get('use_fast_upload'): self.fastUpload(localfile, path, name, callback, blocksize, overwrite) return
_______________________________________________ koji-devel mailing list koji-devel@lists.fedorahosted.org https://lists.fedorahosted.org/admin/lists/koji-devel@lists.fedorahosted.org
koji-devel@lists.fedorahosted.org