forked from yakneens/flickr_to_google_photos_migration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_migration_status.py
30 lines (24 loc) · 1003 Bytes
/
check_migration_status.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import json
from pathlib import Path
import pandas as pd
import pickle
results = []
p = Path.cwd() / "celery" / "results"
file_list = list(p.rglob("celery-task-meta-*"))
for cur_file in file_list:
with open(cur_file) as fp:
cur_res = json.load(fp)
results.append(cur_res)
results_df = pd.DataFrame(results)
print(f"{results_df['status'].value_counts()}")
#Print failed task ids and error messages
# failed_results_df = results_df[results_df.status == 'FAILURE']
# print("Failed tasks")
# for x in map(lambda x: (x[1], x[0]['exc_message'][1]), failed_results_df[['result','task_id']].values):
# print(x)
#Get photos that succeeded uploads
# with open((Path.cwd() / "photos_to_move.pickle").resolve(), "rb") as photo_tasks_file:
# my_photos = pickle.load(photo_tasks_file)
#
# successes = [x['result']['newMediaItemResults'][0]['mediaItem']['filename'] for x in results if x['status'] == 'SUCCESS']
# in_successes = [x for x in my_photos if x['photoTitle'] in successes]