Back to home page

EIC code displayed by LXR

 
 

    


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

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>, 2024
0010 
0011 # from idds.common.utils import encode_base64
0012 
0013 
0014 def show_relation_map(relation_map, level=0):
0015     # a workflow with a list of works.
0016     if level == 0:
0017         prefix = ""
0018     else:
0019         prefix = " " * level * 4
0020 
0021     for item in relation_map:
0022         if type(item) in [dict]:
0023             # it's a Work
0024             print("%s%s" % (prefix, item['work']['workload_id']))
0025             if 'next_works' in item:
0026                 # print("%s%s next_works:" % (prefix, item['work']['workload_id']))
0027                 next_works = item['next_works']
0028                 # it's a list.
0029                 show_relation_map(next_works, level=level + 1)
0030         elif type(item) in [list]:
0031             # it's a subworkflow with a list of works.
0032             print("%ssubworkflow:" % (prefix))
0033             show_relation_map(next_works, level=level + 1)
0034 
0035 
0036 def perform_workflow(workflow):
0037     workflow.load()
0038     workflow.run()