Skip to content

Commit a052f6a

Browse files
committed
added default container and added check for printed components
1 parent 235a529 commit a052f6a

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

flowcraft/generator/engine.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -1533,6 +1533,10 @@ def fetch_docker_tags(self):
15331533
the -t flag.
15341534
"""
15351535

1536+
# list to store the already parsed components (useful when forks are
1537+
# given to the pipeline string via -t flag
1538+
list_of_parsed = []
1539+
15361540
# fetches terminal width and subtracts 3 because we always add a
15371541
# new line character and we want a space at the beggining and at the end
15381542
# of each line
@@ -1562,12 +1566,20 @@ def fetch_docker_tags(self):
15621566
# Skip first init process and iterate through the others
15631567
for p in self.processes[1:]:
15641568
template = p.template
1569+
# if component has already been printed then skip and don't print
1570+
# again
1571+
if template in list_of_parsed:
1572+
continue
1573+
1574+
list_of_parsed.append(template)
1575+
15651576
# fetch repo name from directives of the template. Since some
15661577
# components like integrity_coverage doesn't have a directives with
15671578
# container, thus if no directive there the script will skip this
15681579
# template
15691580
try:
15701581
repo = p.directives[template]["container"]
1582+
default_version = p.directives[template]["version"]
15711583
except KeyError:
15721584
continue
15731585
# make the request to docker hub
@@ -1581,7 +1593,10 @@ def fetch_docker_tags(self):
15811593
# parse response content to dict and fetch results key
15821594
r_content = json.loads(r.content)["results"]
15831595
for version in r_content:
1584-
tags_list.append([template, repo, version["name"]])
1596+
printed_version = (version["name"] + "*") \
1597+
if version["name"] == default_version \
1598+
else version["name"]
1599+
tags_list.append([template, repo, printed_version])
15851600
else:
15861601
tags_list.append([template, repo, "No DockerHub tags"])
15871602

@@ -1607,7 +1622,7 @@ def fetch_docker_tags(self):
16071622
*entry, *final_width), color)
16081623
)
16091624
# assures that the entire line gets the same color
1610-
sys.stdout.write("\n")
1625+
sys.stdout.write("\n{0: >{1}}\n".format("(* = default)", terminal_width + 3))
16111626

16121627
def build(self):
16131628
"""Main pipeline builder

flowcraft/templates/mashdist2json.py

+1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ def main(mash_output, hash_cutoff, sample_id, assembly_file):
165165
# assures that file is closed in last iteration of the loop
166166
send_to_output(master_dict, mash_output, sample_id, assembly_file)
167167

168+
168169
if __name__ == "__main__":
169170

170171
main(MASH_TXT, HASH_CUTOFF, SAMPLE_ID, ASSEMBLY_IN)

0 commit comments

Comments
 (0)