Skip to content

Commit 669d8ca

Browse files
committed
Updating rest_grouping.py ..
1 parent 3f685dc commit 669d8ca

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Sample/UserApps/ServicesGrouping/rest_grouping.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# -*- coding: utf-8 -*-
22
"""rest_grouping.py
33
4-
This module implements ``RestTaskLoader`` class, which is used to load a group of RESTful services (call tasks) from a JSON payload into ``TaskContainer``.
4+
This module implements:
5+
6+
* ``RestTaskLoader`` class, which is used to load a group of RESTful services (call tasks) from a JSON payload into ``TaskContainer``.
7+
8+
* ``call_rest_group`` function, which is the main entry for the client to call a group of RESTful services.
59
610
This module was originally shipped as an example code from https://github.com/DataBooster/PyWebApi, licensed under the MIT license.
711
Anyone who obtains a copy of this code is welcome to modify it for any purpose, and holds all rights to the modified part only.
@@ -74,3 +78,12 @@ def extract_serial_group(self, task_node:Dict[str, Any]) -> List[Dict[str, Any]]
7478

7579
def extract_parallel_group(self, task_node:Dict[str, Any]) -> List[Dict[str, Any]]:
7680
return task_node.get(_reserved_key_parallel_group)
81+
82+
83+
84+
def call_rest_group(payload:Dict[str, Any]):
85+
"""the main entry for the client to call a group of RESTful services."""
86+
with ThreadPoolExecutor(max_workers=32) as thread_pool:
87+
loader = RestTaskLoader(thread_pool)
88+
container = loader.load(payload)
89+
return container.run()

0 commit comments

Comments
 (0)