Skip to content

Commit 4dc0f72

Browse files
Container versioning (#165)
* added directives to -L argument * updated changelog * Update flowcraft/generator/process_details.py Co-Authored-By: tiagofilipe12 <tiagofilipe12@gmail.com> * fixed proc_dict_info checks, and pr required changes
1 parent c53f02c commit 4dc0f72

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

changelog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ resolution
3232
- Added seed parameter to `downsample_fastq` component.
3333
- Added bacmet database to `abricate` component.
3434
- Added default docker option to avoid docker permission errors.
35-
- Changed the default URL generated by inspect and report commands.
35+
- Changed the default URL generated by inspect and report commands.
36+
- Added directives to `-L` parameter of build module.
3637

3738
### Bug fixes
3839

flowcraft/generator/process_details.py

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,19 @@ def colored_print(msg, color_label="white_bold"):
4545
def procs_dict_parser(procs_dict):
4646
"""
4747
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.
4950
5051
Parameters
5152
----------
5253
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'}}}
5761
"""
5862

5963
logger.info(colored_print(
@@ -67,10 +71,26 @@ def procs_dict_parser(procs_dict):
6771
info_str = "{}:".format(info)
6872

6973
if isinstance(dict_proc_info[info], list):
70-
if len(dict_proc_info[info]) == 0:
74+
if not dict_proc_info[info]:
7175
arg_msg = "None"
7276
else:
7377
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)
7494
else:
7595
arg_msg = dict_proc_info[info]
7696

@@ -108,7 +128,8 @@ def proc_collector(process_map, args, pipeline_string):
108128
"output_type",
109129
"description",
110130
"dependencies",
111-
"conflicts"
131+
"conflicts",
132+
"directives"
112133
]
113134

114135
# prints a short list with each process and the corresponding description

0 commit comments

Comments
 (0)