File indexing completed on 2026-04-09 07:58:21
0001
0002
0003 from tabulate import tabulate
0004
0005 from idds.common.utils import json_dumps
0006 from idds.common.constants import ContentStatus
0007 from idds.core.requests import get_requests
0008 from idds.core.messages import retrieve_messages
0009 from idds.core.transforms import get_transforms
0010 from idds.core.workprogress import get_workprogresses
0011 from idds.core.processings import get_processings
0012 from idds.core import transforms as core_transforms
0013
0014
0015 def show_req_transforms(request_id):
0016 reqs = get_requests(request_id=request_id, with_detail=False)
0017 trfs = get_transforms(request_id=request_id)
0018 prs = get_processings(request_id=request_id)
0019 reqs_times = {}
0020 trfs_times = {}
0021 prs_times = {}
0022 for req in reqs:
0023 reqs_times[req['request_id']] = {'created_at': req['created_at']}
0024 for trf in trfs:
0025 trfs_times[trf['transform_id']] = {'request_id': trf['request_id'], 'created_at': trf['created_at']}
0026 for pr in prs:
0027 prs_times[pr['processing_id']] = {'request_id': pr['request_id'], 'transform_id': pr['transform_id'], 'created_at': pr['created_at']}
0028
0029 table = []
0030 title = ['request_id', 'req_created_at', 'transform_id', 'tf_created_at', 'processing_id', 'pr_created_at', 'request-processing']
0031 table.append(title)
0032 pr_ids = sorted(list(prs_times.keys()))
0033 for pr_id in pr_ids:
0034 req_id = prs_times[pr_id]['request_id']
0035 tf_id = prs_times[pr_id]['transform_id']
0036 row = [req_id, reqs_times[req_id]['created_at'], tf_id, trfs_times[tf_id]['created_at'], pr_id, prs_times[pr_id]['created_at'], (prs_times[pr_id]['created_at'] - reqs_times[req_id]['created_at']).seconds / 60]
0037 table.append(row)
0038 print(tabulate(table))
0039
0040
0041 if __name__ == '__main__':
0042 req_ids = [i for i in range(100, 110)]
0043
0044 for req_id in req_ids:
0045 show_req_transforms(req_id)