本文整理汇总了Python中acdcli.utils.threading.QueuedLoader.add_jobs方法的典型用法代码示例。如果您正苦于以下问题:Python QueuedLoader.add_jobs方法的具体用法?Python QueuedLoader.add_jobs怎么用?Python QueuedLoader.add_jobs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类acdcli.utils.threading.QueuedLoader
的用法示例。
在下文中一共展示了QueuedLoader.add_jobs方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: download_action
# 需要导入模块: from acdcli.utils.threading import QueuedLoader [as 别名]
# 或者: from acdcli.utils.threading.QueuedLoader import add_jobs [as 别名]
def download_action(args: argparse.Namespace) -> int:
excl_re = regex_helper(args)
jobs = []
ret_val = 0
ret_val |= create_dl_jobs(args.node, args.path, excl_re, jobs)
ql = QueuedLoader(args.max_connections, max_retries=args.max_retries)
ql.add_jobs(jobs)
return ret_val | ql.start()
示例2: overwrite_action
# 需要导入模块: from acdcli.utils.threading import QueuedLoader [as 别名]
# 或者: from acdcli.utils.threading.QueuedLoader import add_jobs [as 别名]
def overwrite_action(args: argparse.Namespace) -> int:
if not os.path.isfile(args.file):
logger.error('Invalid file.')
return INVALID_ARG_RETVAL
prog = progress.FileProgress(os.path.getsize(args.file))
ql = QueuedLoader(max_retries=args.max_retries)
job = partial(overwrite, args.node, args.file, pg_handler=prog)
ql.add_jobs([job])
return ql.start()
示例3: upload_stream_action
# 需要导入模块: from acdcli.utils.threading import QueuedLoader [as 别名]
# 或者: from acdcli.utils.threading.QueuedLoader import add_jobs [as 别名]
def upload_stream_action(args: argparse.Namespace) -> int:
if not cache.get_node(args.parent):
logger.critical('Invalid upload folder')
return INVALID_ARG_RETVAL
prog = progress.FileProgress(0)
ql = QueuedLoader(max_retries=0)
job = partial(upload_stream,
sys.stdin.buffer, args.name, args.parent, args.deduplicate, pg_handler=prog)
ql.add_jobs([job])
return ql.start()
示例4: upload_action
# 需要导入模块: from acdcli.utils.threading import QueuedLoader [as 别名]
# 或者: from acdcli.utils.threading.QueuedLoader import add_jobs [as 别名]
def upload_action(args: argparse.Namespace) -> int:
excl_re = regex_helper(args)
jobs = []
ret_val = 0
for path in args.path:
if not os.path.exists(path):
logger.error('Path "%s" does not exist.' % path)
ret_val |= INVALID_ARG_RETVAL
continue
ret_val |= create_upload_jobs(path, args.parent, args.overwrite, args.force, args.deduplicate, excl_re, jobs)
ql = QueuedLoader(args.max_connections, max_retries=args.max_retries)
ql.add_jobs(jobs)
return ret_val | ql.start()
示例5: upload_action
# 需要导入模块: from acdcli.utils.threading import QueuedLoader [as 别名]
# 或者: from acdcli.utils.threading.QueuedLoader import add_jobs [as 别名]
def upload_action(args: argparse.Namespace) -> int:
if not cache.get_node(args.parent):
logger.critical('Invalid upload folder.')
return INVALID_ARG_RETVAL
excl_re = regex_helper(args)
jobs = []
ret_val = 0
for path in args.path:
if not os.path.exists(path):
logger.error('Path "%s" does not exist.' % path)
ret_val |= INVALID_ARG_RETVAL
continue
ret_val |= create_upload_jobs([], path, args.parent, args.overwrite, args.force,
args.deduplicate, args.remove_source_files,
excl_re, args.exclude_path, jobs)
ql = QueuedLoader(args.max_connections, max_retries=args.max_retries)
ql.add_jobs(jobs)
return ret_val | ql.start()