Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Minor: disable process_components for some flags #271

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion griffon/commands/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ def get_product_contain_component(
and not search_upstreams
):
ctx.params["search_latest"] = True
ctx.params["search_provides"] = True

params = copy.deepcopy(ctx.params)
params.pop("verbose")
Expand Down
65 changes: 25 additions & 40 deletions griffon/services/core_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ def async_retrieve_upstreams(self, purl):

def process_component(session, c):
"""perform any neccessary sub retrievals."""
# we only need to resolve on REDHAT namespace components (for now)
if c.namespace == "REDHAT":
# only process provided components
if c.software_build is None:
JimFuller-RedHat marked this conversation as resolved.
Show resolved Hide resolved
c.sources = async_retrieve_sources(session, c.purl)
c.upstreams = async_retrieve_upstreams(session, c.purl)
return c
Expand Down Expand Up @@ -327,14 +327,10 @@ def execute(self, status=None) -> List[Dict[str, Any]]:
latest_components = self.corgi_session.components.retrieve_list_iterator_async(
**search_latest_params
)
with multiprocessing.Pool() as pool:
status.update(
f"found {latest_components_cnt} latest root component(s), retrieving sources & upstreams." # noqa
)
for processed_component in pool.map(
partial(process_component, self.corgi_session), latest_components
):
results.append(processed_component)
status.update(f"found {latest_components_cnt} latest root component(s).") # noqa
for c in latest_components:
results.append(c)

if not self.no_community:
status.update("searching latest community root component(s).")
community_component_cnt = self.community_session.components.count(
Expand All @@ -348,15 +344,11 @@ def execute(self, status=None) -> List[Dict[str, Any]]:
**search_latest_params
)
)
with multiprocessing.Pool() as pool:
status.update(
f"found {community_component_cnt} latest community root component(s), retrieving sources & upstreams." # noqa
)
for processed_component in pool.map(
partial(process_component, self.community_session),
latest_community_components,
):
results.append(processed_component)
status.update(
f"found {community_component_cnt} latest community root component(s), retrieving sources & upstreams." # noqa
)
for c in latest_community_components:
results.append(c)

if self.search_provides:
search_provides_params = copy.deepcopy(params)
Expand All @@ -368,22 +360,20 @@ def execute(self, status=None) -> List[Dict[str, Any]]:
search_provides_params["namespace"] = self.ns
if not (self.include_inactive_product_streams):
search_provides_params["active_streams"] = "True"
search_provides_params["root_components"] = "True"
search_provides_params["latest_components_by_streams"] = "True"
status.update("searching latest provided child component(s).")
latest_components_cnt = self.corgi_session.components.count(**search_provides_params)
status.update(f"found {latest_components_cnt} latest component(s).")
# latest_components_cnt = self.corgi_session.components.count(**search_provides_params)
latest_components_cnt = 0
status.update(f"found {latest_components_cnt} latest provides component(s).")
latest_components = self.corgi_session.components.retrieve_list_iterator_async(
**search_provides_params
)
with multiprocessing.Pool() as pool:
status.update(
f"found {latest_components_cnt} latest provides child component(s), retrieving sources & upstreams." # noqa
)
for processed_component in pool.map(
partial(process_component, self.corgi_session), latest_components
):
results.append(processed_component)
status.update(
f"found {latest_components_cnt} latest provides child component(s), retrieving sources & upstreams." # noqa
)
for c in latest_components:
results.append(c)

if not self.no_community:
status.update("searching latest community provided child component(s).")
community_component_cnt = self.community_session.components.count(
Expand All @@ -397,15 +387,11 @@ def execute(self, status=None) -> List[Dict[str, Any]]:
**search_provides_params
)
)
with multiprocessing.Pool() as pool:
status.update(
f"found {community_component_cnt} latest community provided child component(s), retrieving sources & upstreams." # noqa
)
for processed_component in pool.map(
partial(process_component, self.community_session),
latest_community_components,
):
results.append(processed_component)
status.update(
f"found {community_component_cnt} latest community provided child component(s), retrieving sources & upstreams." # noqa
)
for c in latest_community_components:
results.append(c)

if self.search_upstreams:
search_upstreams_params = copy.deepcopy(params)
Expand Down Expand Up @@ -602,7 +588,6 @@ def execute(self, status=None) -> List[Dict[str, Any]]:
search_all_upstreams_params["type"] = self.component_type
if not (self.include_inactive_product_streams):
search_all_upstreams_params["active_streams"] = "True"
search_all_upstreams_params["released_components"] = "True"
JimFuller-RedHat marked this conversation as resolved.
Show resolved Hide resolved
upstream_components_cnt = self.corgi_session.components.count(
**search_all_upstreams_params
)
Expand Down