File indexing completed on 2026-04-09 07:58:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 """
0013 Test client.
0014 """
0015
0016
0017 from idds.client.clientmanager import ClientManager
0018 from idds.common.constants import RequestStatus
0019 from idds.common.utils import json_dumps
0020 from idds.rest.v1.utils import convert_old_req_2_workflow_req
0021 from idds.common.utils import setup_logging
0022
0023
0024 setup_logging("idds.log")
0025
0026
0027 def migrate():
0028
0029
0030
0031 dev_host = 'https://aipanda160.cern.ch:443/idds'
0032
0033 doma_host = 'https://aipanda015.cern.ch:443/idds'
0034
0035 atlas_host = 'https://aipanda181.cern.ch:443/idds'
0036
0037 doma_google_host = 'https://34.133.138.229:443/idds'
0038
0039 slac_k8s_dev_host = 'https://rubin-panda-idds-dev.slac.stanford.edu:8443/idds'
0040
0041 slac_k8s_prod_host = 'https://usdf-panda-idds.slac.stanford.edu:8443/idds'
0042
0043 cern_k8s_dev_host = 'https://panda-idds-dev.cern.ch/idds'
0044
0045
0046
0047
0048 cm1 = ClientManager(host=slac_k8s_dev_host)
0049
0050
0051
0052
0053 old_request_id = 359383
0054
0055 old_request_id = 2400
0056 old_request_id = 371204
0057 old_request_id = 372930
0058 old_request_id = 2603
0059 old_request_id = 2802
0060 old_request_id = 2816
0061
0062 old_request_id = 3578
0063 old_request_id = 3612
0064 old_request_id = 3628
0065
0066 old_request_ids = [3628]
0067
0068
0069
0070 old_request_ids = [551889]
0071
0072 old_request_ids = [i for i in range(551911, 556618)]
0073 old_request_ids = [i for i in range(556618, 556712)]
0074 old_request_ids = [i for i in range(556712, 556940)]
0075 old_request_ids = [i for i in range(556940, 557110)]
0076
0077
0078
0079
0080 old_request_ids = [8526]
0081 old_request_ids = [162704]
0082 for old_request_id in old_request_ids:
0083 reqs = cm1.get_requests(request_id=old_request_id, with_metadata=True)
0084
0085
0086
0087
0088 cm2 = ClientManager(host=slac_k8s_dev_host)
0089
0090
0091
0092
0093 print("num requests: %s" % len(reqs))
0094 for req in reqs[:1]:
0095
0096
0097
0098
0099
0100 print(req['status'])
0101 if req['status'] in [RequestStatus.Finished]:
0102 print('request stutus: %s, skip' % str(req['status']))
0103 continue
0104
0105 workflow = req['request_metadata']['workflow']
0106 workflow.clean_works()
0107
0108
0109 t_works = workflow.template.works
0110 if not t_works and hasattr(workflow, 'works_template'):
0111 workflow.template.works = workflow.works_template
0112
0113
0114
0115 req_id = cm2.submit(workflow)
0116 print("old request %s -> new request %s" % (old_request_id, req_id))
0117
0118
0119 if __name__ == '__main__':
0120 migrate()