Skip to content

Commit

Permalink
Merge pull request #97 from CCBR/quite2quiet
Browse files Browse the repository at this point in the history
chore: its quiet and not quite
  • Loading branch information
kopardev authored Mar 2, 2024
2 parents 92e1987 + 440b364 commit fdb0d0a
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 12 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@

### Bug fixes

## spacesavers2 v0.12.1

### New features

- adding uid, human_readable_bytes and percent columns to `pdq` output

### Bug fixes

- type fix "quite" to "quiet"

## spacesavers2 v0.12.0

### New features
Expand Down
6 changes: 3 additions & 3 deletions spacesavers2_catalog
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ def main():
)
parser.add_argument(
"-q",
"--quite",
dest="quite",
"--quiet",
dest="quiet",
required=False,
action=argparse.BooleanOptionalAction,
help="Do not show progress",
Expand Down Expand Up @@ -184,7 +184,7 @@ def main():
args = parser.parse_args()

tqdm_disable = False
if args.quite: tqdm_disable = True
if args.quiet: tqdm_disable = True

global sed
sed = dict()
Expand Down
5 changes: 3 additions & 2 deletions spacesavers2_e2e
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ spacesavers2_catalog \
--outfile ${outfile_catalog} \
--bottomhash \
--brokenlink \
--geezers --quite
--geezers \
--quiet
EOF
)
echo $cmd
Expand Down Expand Up @@ -138,4 +139,4 @@ fi
done


echo "Done!"
echo "Done!"
33 changes: 27 additions & 6 deletions spacesavers2_pdq
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ from multiprocessing import Pool
import argparse
from pathlib import Path
import json
import os
import pandas as pd


def task(f):
Expand Down Expand Up @@ -82,8 +82,8 @@ def main():
)
parser.add_argument(
"-q",
"--quite",
dest="quite",
"--quiet",
dest="quiet",
required=False,
action=argparse.BooleanOptionalAction,
help="Do not show progress",
Expand All @@ -98,7 +98,7 @@ def main():
dirs = [p]

tqdm_disable = False
if args.quite: tqdm_disable = True
if args.quiet: tqdm_disable = True
# files = [p]
# files2 = p.glob("**/*")
# files.extend(files2)
Expand Down Expand Up @@ -127,6 +127,8 @@ def main():

outdict=dict()
outdict[str(p)]=dict()
col_names = ['uid', 'username', 'ninodes', 'nbytes', 'human_readable']
df = pd.DataFrame(columns = col_names)

for uid in bigdict.keys():
username = get_username_groupname(uid)
Expand All @@ -138,8 +140,27 @@ def main():
outdict[str(p)][str(uid)]['username']=username
outdict[str(p)][str(uid)]['ninodes']=ninodes
outdict[str(p)][str(uid)]['nbytes']=nbytes
outfh.write(f"{username}\t{ninodes}\t{nbytes}\n")

my_dict = {'uid':uid,
'username':username,
'ninodes':ninodes,
'nbytes':nbytes,
'human_readable':get_human_readable_size(nbytes)}
df.loc[len(df)] = my_dict
# outfh.write(f"{username}\t{ninodes}\t{nbytes}\n")

total_ninodes = df['ninodes'].sum()
total_nbytes = df['nbytes'].sum()
total_humanreadable = get_human_readable_size(total_nbytes)
my_dict = { 'uid':0,
'username':'allusers',
'ninodes':total_ninodes ,
'nbytes':total_nbytes,
'human_readable':total_humanreadable}
df.loc[len(df)] = my_dict
df.sort_values(by=['nbytes'],ascending=False,inplace=True)
df['percent'] = df['nbytes'] * 100.0 / total_nbytes
df['percent'] = df['percent'].apply(lambda x: float("{:.2f}".format(x)))
df.to_csv(outfh,sep="\t",index=False)
if args.json:
json.dump(outdict,outjson,indent=1)
outjson.close()
Expand Down
2 changes: 1 addition & 1 deletion src/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.12.0
0.12.1

0 comments on commit fdb0d0a

Please sign in to comment.