我试图运行一个异步任务,并得到了一个意外的错误: run_command()接受一个位置参数,但是给出了318个位置参数。我有一个命令列表,我想从芹菜任务中运行。
run_command.chunks(iter(commands), 10).group().apply_async()
@task
def run_command(commands):
for command in commands:
print("RUNNING, ", command)
print("Pid: ", os.getpid())
os.system(command)如上所示,我正在尝试将我的命令分解为将并行执行的批处理。
谢谢你的帮助
发布于 2019-09-10 12:23:53
芹菜将其位置参数视为*args,因此命令中的每个可迭代命令都应该类似于('commandtext',)。
commands = ['hello', 'world', '!']
@task
def run_command(command):
'''run command'''
run_command.chunks(zip(commands), 2).group().apply_async()https://stackoverflow.com/questions/57869207
复制相似问题