Back to home page

EIC code displayed by LXR

 
 

    


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

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>, 2019 - 2021
0010 
0011 
0012 """
0013 Test client.
0014 """
0015 
0016 
0017 from idds.client.clientmanager import ClientManager
0018 from idds.common.utils import get_rest_host
0019 
0020 
0021 def get_workflow():
0022     from idds.workflowv2.workflow import Workflow, Condition
0023     from idds.atlas.workflowv2.atlaspandawork import ATLASPandaWork
0024 
0025     task_parameters1 = {"architecture": "",
0026                         "cliParams": "prun --exec 'echo %RNDM:10 > seed.txt' --outputs seed.txt --nJobs 2 --outDS user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_000_top",
0027                         "excludedSite": [],
0028                         "includedSite": None,
0029                         "jobParameters": [
0030                             {
0031                                 "type": "constant",
0032                                 "value": "-j \"\" --sourceURL ${SURL}"
0033                             },
0034                             {
0035                                 "type": "constant",
0036                                 "value": "-r ."
0037                             },
0038                             {
0039                                 "padding": False,
0040                                 "type": "constant",
0041                                 "value": "-p \""
0042                             },
0043                             {
0044                                 "padding": False,
0045                                 "type": "constant",
0046                                 "value": "echo%20%25RNDM%3A10%20%3E%20seed.txt"
0047                             },
0048                             {
0049                                 "type": "constant",
0050                                 "value": "\""
0051                             },
0052                             {
0053                                 "type": "constant",
0054                                 "value": "-a jobO.185663cd-6df9-4ac8-adf9-0d9bf9d5892e.tar.gz"
0055                             },
0056                             {
0057                                 "container": "user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_000_top_seed.txt/",
0058                                 "dataset": "user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_000_top_seed.txt/",
0059                                 "hidden": True,
0060                                 "param_type": "output",
0061                                 "type": "template",
0062                                 "value": "user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_000_top.$JEDITASKID._${SN/P}.seed.txt"
0063                             },
0064                             {
0065                                 "type": "constant",
0066                                 "value": "-o \"{'seed.txt': 'user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_000_top.$JEDITASKID._${SN/P}.seed.txt'}\""
0067                             }
0068                         ],
0069                         "log": {
0070                             "container": "user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_000_top/",
0071                             "dataset": "user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_000_top/",
0072                             "param_type": "log",
0073                             "type": "template",
0074                             "value": "user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_000_top.log.$JEDITASKID.${SN}.log.tgz"
0075                         },
0076                         "nEvents": 2,
0077                         "nEventsPerJob": 1,
0078                         "nMaxFilesPerJob": 200,
0079                         "noInput": True,
0080                         "osInfo": "Linux-3.10.0-1160.36.2.el7.x86_64-x86_64-with-centos-7.9.2009-Core",
0081                         "processingType": "panda-client-1.4.80-jedi-run",
0082                         "prodSourceLabel": "user",
0083                         "respectSplitRule": True,
0084                         "site": None,
0085                         "sourceURL": "https://aipanda048.cern.ch:25443",
0086                         "taskName": "user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_000_top",
0087                         "transHome": None,
0088                         "transUses": "",
0089                         "uniqueTaskName": True,
0090                         "userName": "Tadashi Maeno",
0091                         "vo": "atlas"}
0092 
0093     task_parameters2 = {"architecture": "",
0094                         "cliParams": "prun --exec 'echo %IN > results.root' --outputs results.root --forceStaged --inDS user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_000_top_seed.txt/ --outDS user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_001_bottom",
0095                         "excludedSite": [],
0096                         "includedSite": None,
0097                         "jobParameters": [
0098                             {
0099                                 "type": "constant",
0100                                 "value": "-j \"\" --sourceURL ${SURL}"
0101                             },
0102                             {
0103                                 "type": "constant",
0104                                 "value": "-r ."
0105                             },
0106                             {
0107                                 "padding": False,
0108                                 "type": "constant",
0109                                 "value": "-p \""
0110                             },
0111                             {
0112                                 "padding": False,
0113                                 "type": "constant",
0114                                 "value": "echo%20%25IN%20%3E%20results.root"
0115                             },
0116                             {
0117                                 "type": "constant",
0118                                 "value": "\""
0119                             },
0120                             {
0121                                 "type": "constant",
0122                                 "value": "-a jobO.185663cd-6df9-4ac8-adf9-0d9bf9d5892e.tar.gz"
0123                             },
0124                             {
0125                                 "dataset": "user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_000_top_seed.txt/",
0126                                 "exclude": "\\.log\\.tgz(\\.\\d+)*$",
0127                                 "expand": True,
0128                                 "param_type": "input",
0129                                 "type": "template",
0130                                 "value": "-i \"${IN/T}\""
0131                             },
0132                             {
0133                                 "container": "user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_001_bottom_results.root/",
0134                                 "dataset": "user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_001_bottom_results.root/",
0135                                 "hidden": True,
0136                                 "param_type": "output",
0137                                 "type": "template",
0138                                 "value": "user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_001_bottom.$JEDITASKID._${SN/P}.results.root"
0139                             },
0140                             {
0141                                 "type": "constant",
0142                                 "value": "-o \"{'results.root': 'user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_001_bottom.$JEDITASKID._${SN/P}.results.root'}\""
0143                             }
0144                         ],
0145                         "log": {
0146                             "container": "user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_001_bottom/",
0147                             "dataset": "user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_001_bottom/",
0148                             "param_type": "log",
0149                             "type": "template",
0150                             "value": "user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_001_bottom.log.$JEDITASKID.${SN}.log.tgz"
0151                         },
0152                         "nMaxFilesPerJob": 200,
0153                         "noWaitParent": True,
0154                         "osInfo": "Linux-3.10.0-1160.36.2.el7.x86_64-x86_64-with-centos-7.9.2009-Core",
0155                         "parentTaskName": "user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_000_top",
0156                         "processingType": "panda-client-1.4.80-jedi-run",
0157                         "prodSourceLabel": "user",
0158                         "respectSplitRule": True,
0159                         "site": None,
0160                         "sourceURL": "https://aipanda048.cern.ch:25443",
0161                         "taskName": "user.tmaeno.389eb4c5-5db6-4b80-82aa-9edfae6dfb38_001_bottom",
0162                         "transHome": None,
0163                         "transUses": "",
0164                         "uniqueTaskName": True,
0165                         "userName": "Tadashi Maeno",
0166                         "vo": "atlas"}
0167 
0168     work1 = ATLASPandaWork(task_parameters=task_parameters1)
0169     work2 = ATLASPandaWork(task_parameters=task_parameters2)
0170     wf = Workflow()
0171     wf.set_workload_id(234567)
0172     wf.add_work(work1)
0173     wf.add_work(work2)
0174 
0175     # cond = Condition(cond=work1.is_finished, true_work=work2)
0176     cond = Condition(cond=work1.is_started, true_work=work2)
0177     wf.add_condition(cond)
0178     return wf
0179 
0180 
0181 if __name__ == '__main__':
0182     host = get_rest_host()
0183     # props = get_req_properties()
0184     # props = get_example_real_tape_stagein_request()
0185     # props = get_example_prodsys2_tape_stagein_request()
0186     # props = get_example_active_learning_request()
0187     workflow = get_workflow()
0188 
0189     # props = pre_check(props)
0190     # print(props)
0191 
0192     wm = ClientManager(host=host)
0193     request_id = wm.submit(workflow)
0194     print(request_id)