@@ -45,15 +45,19 @@ def colored_print(msg, color_label="white_bold"):
45
45
def procs_dict_parser (procs_dict ):
46
46
"""
47
47
This function handles the dictionary of attributes of each Process class
48
- to print to stdout.
48
+ to print to stdout lists of all the components or the components which the
49
+ user specifies in the -t flag.
49
50
50
51
Parameters
51
52
----------
52
53
procs_dict: dict
53
- A dictionary with the class attributes used by the argument that prints
54
- the lists of processes, both for short_list and for detailed_list.
55
-
56
-
54
+ A dictionary with the class attributes for all the components (or
55
+ components that are used by the -t flag), that allow to create
56
+ both the short_list and detailed_list. Dictionary example:
57
+ {"abyss": {'input_type': 'fastq', 'output_type': 'fasta',
58
+ 'dependencies': [], 'directives': {'abyss': {'cpus': 4,
59
+ 'memory': '{ 5.GB * task.attempt }', 'container': 'flowcraft/abyss',
60
+ 'version': '2.1.1', 'scratch': 'true'}}}
57
61
"""
58
62
59
63
logger .info (colored_print (
@@ -67,10 +71,26 @@ def procs_dict_parser(procs_dict):
67
71
info_str = "{}:" .format (info )
68
72
69
73
if isinstance (dict_proc_info [info ], list ):
70
- if len ( dict_proc_info [info ]) == 0 :
74
+ if not dict_proc_info [info ]:
71
75
arg_msg = "None"
72
76
else :
73
77
arg_msg = ", " .join (dict_proc_info [info ])
78
+ elif info == "directives" :
79
+ # this is used for the "directives", which is a dict
80
+ if not dict_proc_info [info ]:
81
+ # if dict is empty then add None to the message
82
+ arg_msg = "None"
83
+ else :
84
+ # otherwise fetch all template names within a component
85
+ # and all the directives for each template to a list
86
+ list_msg = ["\n {}: {}" .format (
87
+ templt ,
88
+ " , " .join (["{}: {}" .format (dr , val )
89
+ for dr , val in drs .items ()]))
90
+ for templt , drs in dict_proc_info [info ].items ()
91
+ ]
92
+ # write list to a str
93
+ arg_msg = "" .join (list_msg )
74
94
else :
75
95
arg_msg = dict_proc_info [info ]
76
96
@@ -108,7 +128,8 @@ def proc_collector(process_map, args, pipeline_string):
108
128
"output_type" ,
109
129
"description" ,
110
130
"dependencies" ,
111
- "conflicts"
131
+ "conflicts" ,
132
+ "directives"
112
133
]
113
134
114
135
# prints a short list with each process and the corresponding description
0 commit comments