Back to home page

EIC code displayed by LXR

 
 

    


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

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 def show_relation_map(relation_map, level=0):
0013     # a workflow with a list of works.
0014     if level == 0:
0015         prefix = ""
0016     else:
0017         prefix = " " * level * 4
0018 
0019     for item in relation_map:
0020         if type(item) in [dict]:
0021             # it's a Work
0022             print("%s%s" % (prefix, item['work']['workload_id']))
0023             if 'next_works' in item:
0024                 # print("%s%s next_works:" % (prefix, item['work']['workload_id']))
0025                 next_works = item['next_works']
0026                 # it's a list.
0027                 show_relation_map(next_works, level=level + 1)
0028         elif type(item) in [list]:
0029             # it's a subworkflow with a list of works.
0030             print("%ssubworkflow:" % (prefix))
0031             show_relation_map(next_works, level=level + 1)