Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 08:39:07

0001 import logging
0002 import sys
0003 
0004 from pandaserver.workflow.pcwl_utils import parse_workflow_file, resolve_nodes
0005 from pandaserver.workflow.workflow_utils import (
0006     convert_nodes_to_workflow,
0007     dump_nodes,
0008     get_node_id_map,
0009     set_workflow_outputs,
0010 )
0011 from ruamel import yaml
0012 
0013 logging.basicConfig(format="%(asctime)s - %(levelname)s - %(message)s", level=logging.DEBUG)
0014 with open(sys.argv[2]) as f:
0015     data = yaml.safe_load(f) or dict()
0016 nodes, root_in = parse_workflow_file(sys.argv[1], logging)
0017 s_id, t_nodes, nodes = resolve_nodes(nodes, root_in, data, 0, set(), sys.argv[3], logging)
0018 set_workflow_outputs(nodes)
0019 id_map = get_node_id_map(nodes)
0020 # task template
0021 template = {
0022     "buildSpec": {
0023         "jobParameters": "-i ${IN} -o ${OUT} --sourceURL ${SURL} " "-r ./ --useAthenaPackages --useCMake --cmtConfig x86_64-slc6-gcc49-opt ",
0024         "archiveName": "sources.5bca61db-3b0d-4e65-b102-7d56d82f4567.tar.gz",
0025         "prodSourceLabel": "panda",
0026     },
0027     "sourceURL": "https://aipanda047.cern.ch:25443",
0028     "cliParams": "prun --exec ls --useAthenaPackages --outDS user.tmaeno.4586bbc2-e891-441b-a9f4-4a9ceb9a9f8d",
0029     "site": None,
0030     "vo": "atlas",
0031     "respectSplitRule": True,
0032     "osInfo": "Linux-3.10.0-1160.36.2.el7.x86_64-x86_64-with-centos-7.9.2009-Core",
0033     "log": {
0034         "type": "template",
0035         "param_type": "log",
0036         "container": "user.tmaeno.4586bbc2-e891-441b-a9f4-4a9ceb9a9f8d.log/",
0037         "value": "user.tmaeno.4586bbc2-e891-441b-a9f4-4a9ceb9a9f8d.log.$JEDITASKID.${SN}.log.tgz",
0038         "dataset": "user.tmaeno.4586bbc2-e891-441b-a9f4-4a9ceb9a9f8d.log/",
0039     },
0040     "transUses": "Atlas-21.0.6",
0041     "excludedSite": [],
0042     "nMaxFilesPerJob": 200,
0043     "uniqueTaskName": True,
0044     "taskName": "user.tmaeno.4586bbc2-e891-441b-a9f4-4a9ceb9a9f8d/",
0045     "transHome": "AnalysisTransforms",
0046     "includedSite": None,
0047     "jobParameters": [
0048         {"type": "constant", "value": '-j "" --sourceURL ${SURL}'},
0049         {"type": "constant", "value": "-r ./"},
0050         {"padding": False, "type": "constant", "value": '-p "'},
0051         {"padding": False, "type": "constant", "value": "ls"},
0052         {"type": "constant", "value": '"'},
0053         {"type": "constant", "value": "-l ${LIB}"},
0054         {
0055             "type": "constant",
0056             "value": "--useAthenaPackages " "--useCMake --cmtConfig x86_64-slc6-gcc49-opt ",
0057         },
0058     ],
0059     "prodSourceLabel": "user",
0060     "processingType": "panda-client-1.4.81-jedi-run",
0061     "architecture": "x86_64-slc6-gcc49-opt@centos7",
0062 }
0063 
0064 
0065 c_template = {
0066     "sourceURL": "https://aipanda048.cern.ch:25443",
0067     "cliParams": "prun --cwl test.cwl --yaml a.yaml " "--relayHost aipanda059.cern.ch --outDS " "user.tmaeno.1f2860f0-30d6-4352-9f87-9b9dde82fd80",
0068     "site": None,
0069     "vo": "atlas",
0070     "respectSplitRule": True,
0071     "osInfo": "Linux-3.10.0-1160.36.2.el7.x86_64-x86_64-with-centos-7.9.2009-Core",
0072     "log": {
0073         "type": "template",
0074         "param_type": "log",
0075         "container": "user.tmaeno.1f2860f0-30d6-4352-9f87-9b9dde82fd80.log/",
0076         "value": "user.tmaeno.1f2860f0-30d6-4352-9f87-9b9dde82fd80.log.$JEDITASKID.${SN}.log.tgz",
0077         "dataset": "user.tmaeno.1f2860f0-30d6-4352-9f87-9b9dde82fd80.log/",
0078     },
0079     "transUses": "",
0080     "excludedSite": [],
0081     "nMaxFilesPerJob": 200,
0082     "uniqueTaskName": True,
0083     "taskName": "user.tmaeno.1f2860f0-30d6-4352-9f87-9b9dde82fd80/",
0084     "transHome": None,
0085     "includedSite": None,
0086     "container_name": "__dummy_container__",
0087     "multiStepExec": {
0088         "preprocess": {"args": "--preprocess ${TRF_ARGS}", "command": "${TRF}"},
0089         "containerOptions": {
0090             "containerImage": "__dummy_container__",
0091             "containerExec": 'echo "=== cat exec script ==="; ' "cat __run_main_exec.sh; echo; " 'echo "=== exec script ==="; ' "/bin/sh __run_main_exec.sh",
0092         },
0093         "postprocess": {"args": "--postprocess ${TRF_ARGS}", "command": "${TRF}"},
0094     },
0095     "jobParameters": [
0096         {"type": "constant", "value": '-j "" --sourceURL ${SURL}'},
0097         {"type": "constant", "value": "-r ."},
0098         {"padding": False, "type": "constant", "value": '-p "'},
0099         {"padding": False, "type": "constant", "value": "__dummy_exec_str__"},
0100         {"type": "constant", "value": '"'},
0101         {
0102             "type": "constant",
0103             "value": "-a jobO.b6bdf294-8a46-4b02-b399-46619db4088b.tar.gz",
0104         },
0105     ],
0106     "prodSourceLabel": "user",
0107     "processingType": "panda-client-1.4.81-jedi-run",
0108     "architecture": "",
0109 }
0110 
0111 task_template = {"athena": template, "container": c_template}
0112 
0113 [node.resolve_params(task_template, id_map) for node in nodes]
0114 print(dump_nodes(nodes))
0115 
0116 workflow, dump_str_list = convert_nodes_to_workflow(nodes)
0117 print("".join(dump_str_list))
0118 
0119 for node in nodes:
0120     s, o = node.verify()
0121     if not s:
0122         print(f"Verification error in ID:{node.id} {o}")