@@ -559,7 +559,7 @@ async def all(
559559 fragment : bool = ...,
560560 prefetch_relationships : bool = ...,
561561 property : bool = ...,
562- batch : bool = ...,
562+ parallel : bool = ...,
563563 ) -> list [SchemaType ]: ...
564564
565565 @overload
@@ -577,7 +577,7 @@ async def all(
577577 fragment : bool = ...,
578578 prefetch_relationships : bool = ...,
579579 property : bool = ...,
580- batch : bool = ...,
580+ parallel : bool = ...,
581581 ) -> list [InfrahubNode ]: ...
582582
583583 async def all (
@@ -594,7 +594,7 @@ async def all(
594594 fragment : bool = False ,
595595 prefetch_relationships : bool = False ,
596596 property : bool = False ,
597- batch : bool = False ,
597+ parallel : bool = False ,
598598 ) -> list [InfrahubNode ] | list [SchemaType ]:
599599 """Retrieve all nodes of a given kind
600600
@@ -610,7 +610,7 @@ async def all(
610610 exclude (list[str], optional): List of attributes or relationships to exclude from the query.
611611 fragment (bool, optional): Flag to use GraphQL fragments for generic schemas.
612612 prefetch_relationships (bool, optional): Flag to indicate whether to prefetch related node data.
613- batch (bool, optional): Whether to use batch processing for the query.
613+ parallel (bool, optional): Whether to use parallel processing for the query.
614614
615615 Returns:
616616 list[InfrahubNode]: List of Nodes
@@ -628,7 +628,7 @@ async def all(
628628 fragment = fragment ,
629629 prefetch_relationships = prefetch_relationships ,
630630 property = property ,
631- batch = batch ,
631+ parallel = parallel ,
632632 )
633633
634634 @overload
@@ -647,7 +647,7 @@ async def filters(
647647 prefetch_relationships : bool = ...,
648648 partial_match : bool = ...,
649649 property : bool = ...,
650- batch : bool = ...,
650+ parallel : bool = ...,
651651 ** kwargs : Any ,
652652 ) -> list [SchemaType ]: ...
653653
@@ -667,7 +667,7 @@ async def filters(
667667 prefetch_relationships : bool = ...,
668668 partial_match : bool = ...,
669669 property : bool = ...,
670- batch : bool = ...,
670+ parallel : bool = ...,
671671 ** kwargs : Any ,
672672 ) -> list [InfrahubNode ]: ...
673673
@@ -686,7 +686,7 @@ async def filters(
686686 prefetch_relationships : bool = False ,
687687 partial_match : bool = False ,
688688 property : bool = False ,
689- batch : bool = False ,
689+ parallel : bool = False ,
690690 ** kwargs : Any ,
691691 ) -> list [InfrahubNode ] | list [SchemaType ]:
692692 """Retrieve nodes of a given kind based on provided filters.
@@ -704,7 +704,7 @@ async def filters(
704704 fragment (bool, optional): Flag to use GraphQL fragments for generic schemas.
705705 prefetch_relationships (bool, optional): Flag to indicate whether to prefetch related node data.
706706 partial_match (bool, optional): Allow partial match of filter criteria for the query.
707- batch (bool, optional): Whether to use batch processing for the query.
707+ parallel (bool, optional): Whether to use parallel processing for the query.
708708 **kwargs (Any): Additional filter criteria for the query.
709709
710710 Returns:
@@ -750,13 +750,12 @@ async def process_page(page_offset: int, page_number: int) -> tuple[dict, Proces
750750 )
751751 return response , process_result
752752
753- async def process_batch (schema_kind : str ) -> tuple [list [InfrahubNode ], list [InfrahubNode ]]:
754- """Process queries in batch mode."""
753+ async def process_batch () -> tuple [list [InfrahubNode ], list [InfrahubNode ]]:
754+ """Process queries in parallel mode."""
755755 nodes = []
756756 related_nodes = []
757757 batch_process = await self .create_batch ()
758- resp = await self .execute_graphql (query = f"query {{ { schema_kind } {{ count }} }}" )
759- count = resp [schema_kind ].get ("count" , 0 )
758+ count = await self .count (kind = schema .kind )
760759 total_pages = (count + pagination_size - 1 ) // pagination_size
761760
762761 for page_number in range (1 , total_pages + 1 ):
@@ -770,7 +769,7 @@ async def process_batch(schema_kind: str) -> tuple[list[InfrahubNode], list[Infr
770769 return nodes , related_nodes
771770
772771 async def process_non_batch () -> tuple [list [InfrahubNode ], list [InfrahubNode ]]:
773- """Process queries without batch mode."""
772+ """Process queries without parallel mode."""
774773 nodes = []
775774 related_nodes = []
776775 has_remaining_items = True
@@ -789,8 +788,8 @@ async def process_non_batch() -> tuple[list[InfrahubNode], list[InfrahubNode]]:
789788
790789 return nodes , related_nodes
791790
792- # Select batch or non-batch processing
793- nodes , related_nodes = await (process_batch (schema . kind ) if batch else process_non_batch ())
791+ # Select parallel or non-parallel processing
792+ nodes , related_nodes = await (process_batch () if parallel else process_non_batch ())
794793
795794 if populate_store :
796795 for node in nodes :
@@ -1638,7 +1637,7 @@ def all(
16381637 fragment : bool = ...,
16391638 prefetch_relationships : bool = ...,
16401639 property : bool = ...,
1641- batch : bool = ...,
1640+ parallel : bool = ...,
16421641 ) -> list [SchemaTypeSync ]: ...
16431642
16441643 @overload
@@ -1656,7 +1655,7 @@ def all(
16561655 fragment : bool = ...,
16571656 prefetch_relationships : bool = ...,
16581657 property : bool = ...,
1659- batch : bool = ...,
1658+ parallel : bool = ...,
16601659 ) -> list [InfrahubNodeSync ]: ...
16611660
16621661 def all (
@@ -1673,7 +1672,7 @@ def all(
16731672 fragment : bool = False ,
16741673 prefetch_relationships : bool = False ,
16751674 property : bool = False ,
1676- batch : bool = False ,
1675+ parallel : bool = False ,
16771676 ) -> list [InfrahubNodeSync ] | list [SchemaTypeSync ]:
16781677 """Retrieve all nodes of a given kind
16791678
@@ -1689,6 +1688,7 @@ def all(
16891688 exclude (list[str], optional): List of attributes or relationships to exclude from the query.
16901689 fragment (bool, optional): Flag to use GraphQL fragments for generic schemas.
16911690 prefetch_relationships (bool, optional): Flag to indicate whether to prefetch related node data.
1691+ parallel (bool, optional): Whether to use parallel processing for the query.
16921692
16931693 Returns:
16941694 list[InfrahubNodeSync]: List of Nodes
@@ -1706,7 +1706,7 @@ def all(
17061706 fragment = fragment ,
17071707 prefetch_relationships = prefetch_relationships ,
17081708 property = property ,
1709- batch = batch ,
1709+ parallel = parallel ,
17101710 )
17111711
17121712 def _process_nodes_and_relationships (
@@ -1760,7 +1760,7 @@ def filters(
17601760 prefetch_relationships : bool = ...,
17611761 partial_match : bool = ...,
17621762 property : bool = ...,
1763- batch : bool = ...,
1763+ parallel : bool = ...,
17641764 ** kwargs : Any ,
17651765 ) -> list [SchemaTypeSync ]: ...
17661766
@@ -1780,7 +1780,7 @@ def filters(
17801780 prefetch_relationships : bool = ...,
17811781 partial_match : bool = ...,
17821782 property : bool = ...,
1783- batch : bool = ...,
1783+ parallel : bool = ...,
17841784 ** kwargs : Any ,
17851785 ) -> list [InfrahubNodeSync ]: ...
17861786
@@ -1799,7 +1799,7 @@ def filters(
17991799 prefetch_relationships : bool = False ,
18001800 partial_match : bool = False ,
18011801 property : bool = False ,
1802- batch : bool = False ,
1802+ parallel : bool = False ,
18031803 ** kwargs : Any ,
18041804 ) -> list [InfrahubNodeSync ] | list [SchemaTypeSync ]:
18051805 """Retrieve nodes of a given kind based on provided filters.
@@ -1817,7 +1817,7 @@ def filters(
18171817 fragment (bool, optional): Flag to use GraphQL fragments for generic schemas.
18181818 prefetch_relationships (bool, optional): Flag to indicate whether to prefetch related node data.
18191819 partial_match (bool, optional): Allow partial match of filter criteria for the query.
1820- batch (bool, optional): Whether to use batch processing for the query.
1820+ parallel (bool, optional): Whether to use parallel processing for the query.
18211821 **kwargs (Any): Additional filter criteria for the query.
18221822
18231823 Returns:
@@ -1863,13 +1863,12 @@ def process_page(page_offset: int, page_number: int) -> tuple[dict, ProcessRelat
18631863 return response , process_result
18641864
18651865 def process_batch () -> tuple [list [InfrahubNodeSync ], list [InfrahubNodeSync ]]:
1866- """Process queries in batch mode."""
1866+ """Process queries in parallel mode."""
18671867 nodes = []
18681868 related_nodes = []
18691869 batch_process = self .create_batch ()
18701870
1871- resp = self .execute_graphql (query = f"query {{ { schema .kind } {{ count }} }}" )
1872- count = resp [schema .kind ].get ("count" , 0 )
1871+ count = self .count (kind = schema .kind )
18731872 total_pages = (count + pagination_size - 1 ) // pagination_size
18741873
18751874 for page_number in range (1 , total_pages + 1 ):
@@ -1883,7 +1882,7 @@ def process_batch() -> tuple[list[InfrahubNodeSync], list[InfrahubNodeSync]]:
18831882 return nodes , related_nodes
18841883
18851884 def process_non_batch () -> tuple [list [InfrahubNodeSync ], list [InfrahubNodeSync ]]:
1886- """Process queries without batch mode."""
1885+ """Process queries without parallel mode."""
18871886 nodes = []
18881887 related_nodes = []
18891888 has_remaining_items = True
@@ -1903,8 +1902,8 @@ def process_non_batch() -> tuple[list[InfrahubNodeSync], list[InfrahubNodeSync]]
19031902
19041903 return nodes , related_nodes
19051904
1906- # Select batch or non-batch processing
1907- nodes , related_nodes = process_batch () if batch else process_non_batch ()
1905+ # Select parallel or non-parallel processing
1906+ nodes , related_nodes = process_batch () if parallel else process_non_batch ()
19081907
19091908 if populate_store :
19101909 for node in nodes :
0 commit comments