Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:58:22

0001 #!/usr/bin/env python
0002 #
0003 # Licensed under the Apache License, Version 2.0 (the "License");
0004 # You may not use this file except in compliance with the License.
0005 # You may obtain a copy of the License at
0006 # http://www.apache.org/licenses/LICENSE-2.0OA
0007 #
0008 # Authors:
0009 # - Wen Guan, <wen.guan@cern.ch>, 2021
0010 
0011 
0012 """
0013 Test client.
0014 """
0015 
0016 import copy
0017 
0018 from idds.client.clientmanager import ClientManager
0019 from idds.common.utils import json_dumps  # noqa F401
0020 from idds.rest.v1.utils import convert_old_req_2_workflow_req
0021 
0022 
0023 def migrate():
0024     # dev
0025     dev_host = 'https://aipanda160.cern.ch:443/idds'   # noqa F841
0026     # doma
0027     doma_host = 'https://aipanda015.cern.ch:443/idds'  # noqa F841
0028 
0029     cm1 = ClientManager(host=dev_host)
0030     # reqs = cm1.get_requests(request_id=290)
0031 
0032     # 230K jobs
0033     reqs = cm1.get_requests(request_id=38, with_metadata=True)
0034 
0035     # reqs = cm1.get_requests(request_id=37, with_metadata=True)
0036 
0037     cm2 = ClientManager(host=dev_host)
0038     for req in reqs:
0039         req = convert_old_req_2_workflow_req(req)
0040         workflow = req['request_metadata']['workflow']
0041         workflow.clean_works()
0042         # print(json_dumps(workflow))
0043         # print(json_dumps(workflow, sort_keys=True, indent=4))
0044         for i in range(1):
0045             wf = copy.deepcopy(workflow)
0046             req_id = cm2.submit(wf)
0047             print(req_id)
0048 
0049 
0050 if __name__ == '__main__':
0051     migrate()