python安装进度条不动_使用tqdm的python进度条不停留在单个lin上

我试图运行一个脚本,试图通过puppet管理在centos7系统上安装模块。

我想为运行脚本时发生的安装实现一个进度条。

我正在使用TQM模块来执行此操作。

这是我如何实现模块的快照:from tqdm import tqdm

for i in tqdm(commands):

res = run_apply(i)

这里run_apply()是实际处理运行和应用puppet配置的函数。

到目前为止,我得到了一个进度条,但是当执行消息被写入控制台时,它会一直向下移动。

但是,我需要进度条在控制台底部保持不变,并在运行消息不干扰进度条的情况下动态更新进度条。

我希望控制台上与执行相关的消息按他们所希望的方式继续,但是进度条应该始终保持在执行开始到结束的底部。

下面是我看到的:File line: 0.00

Package: 0.05

Service: 0.19

File: 0.23

Exec: 0.23

Last run: 1470308227

Config retrieval: 3.90

Total: 4.60

Version:

Config: 1470308220

Puppet: 3.7.3

now here x

result: 2

38%|█████████████████████████████████████▋ | 5/13 [00:29<00:51, 6.44s/it]about to: profiles::install::download_packages

about to run puppet apply --summarize --detailed-exitcodes --certname puppet -e "include profiles::install::download_packages"

Error: Could not find class profiles::install::download_packages for puppet on node puppet

Error: Could not find class profiles::install::download_packages for puppet on node puppet

now here x

result: 1

46%|█████████████████████████████████████████████▏ | 6/13 [00:32<00:36, 5.27s/it]about to: profiles::install::install

about to run puppet apply --summarize --detailed-exitcodes --certname puppet -e "include profiles::install::install"

Error: Could not find class profiles::install::install for puppet on node puppet

Error: Could not find class profiles::install::install for puppet on node puppet

now here x

result: 1

54%|████████████████████████████████████████████████████▊ | 7/13 [00:34<00:26, 4.45s/it]about to: stx_network

about to run puppet apply --summarize --detailed-exitcodes --certname puppet -e "include stx_network"

Notice: Compiled catalog for puppet in environment production in 0.84 seconds

Notice: /Stage[main]/Stx_network/Tidy[purge unused nics]: Tidying File[/etc/sysconfig/network-scripts/ifcfg-lo]

...

请告诉我怎样才能达到我想要的。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值