github.com/pachyderm/pachyderm@v1.13.4/examples/spouts/spout101/src/processor/main.py (about) 1 #!/usr/local/bin/python3 2 import glob 3 import os 4 from datetime import datetime 5 6 file_paths = glob.glob(os.path.join("/pfs/spout", "*.txt")) 7 8 # logs the files in the input repo based on their size. 9 for file_path in file_paths: 10 size = os.stat(file_path).st_size 11 now = datetime.now().time() 12 if (size == 1024): 13 with open("/pfs/out/"+"1K"+".txt", 'w') as onek_files: 14 onek_files.write(str(now) + " " + file_path + "\n") 15 elif (size == 2048): 16 with open("/pfs/out/"+"2K"+".txt", 'w') as twok_files: 17 twok_files.write(str(now) + " " + file_path + "\n") 18 else: 19 print("Not matching size" + size + " " + file_path)