Skip to content

Commit e02d062

Browse files
authored
sdk/python: update warmup param list (#6466)
1 parent 1f8af00 commit e02d062

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

sdk/python/juicefs/juicefs/juicefs.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,14 +419,25 @@ def parseSummary(entry, removefields):
419419
self.lib.free(buf)
420420
return res
421421

422-
def warmup(self, paths, numthreads=10, background=False, isEvict=False, isCheck=False):
422+
def warmup(self, paths, threads=10, evict=False, check=False, background=False, **kwargs):
423+
# numthreads=10, background=False, isEvict=False, isCheck=False,
424+
for k in kwargs:
425+
if k == 'numthreads':
426+
threads = kwargs[k]
427+
elif k == 'isEvict':
428+
evict = kwargs[k]
429+
elif k == 'isCheck':
430+
check = kwargs[k]
431+
else:
432+
raise TypeError(f"warmup() got an unexpected keyword argument '{k}'")
433+
423434
"""Warm up a file or a directory."""
424435
if type(paths) is not list:
425436
paths = [paths]
426437

427438
buf = c_void_p()
428439

429-
n = self.lib.jfs_warmup(c_int64(_tid()), c_int64(self.h), json.dumps(paths).encode(), c_int32(numthreads), c_bool(background), c_bool(isEvict), c_bool(isCheck), byref(buf))
440+
n = self.lib.jfs_warmup(c_int64(_tid()), c_int64(self.h), json.dumps(paths).encode(), c_int32(threads), c_bool(background), c_bool(evict), c_bool(check), byref(buf))
430441
res = json.loads(str(string_at(buf, n), encoding='utf-8'))
431442
self.lib.free(buf)
432443
return res

0 commit comments

Comments
 (0)