Skip to content

Commit 4cf4c83

Browse files
committed
Updated task_grouping.py
1 parent 669d8ca commit 4cf4c83

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Sample/UserApps/ServicesGrouping/rest_grouping.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
* ``RestTaskLoader`` class, which is used to load a group of RESTful services (call tasks) from a JSON payload into ``TaskContainer``.
77
8-
* ``call_rest_group`` function, which is the main entry for the client to call a group of RESTful services.
8+
* ``start`` function, which is the main entry for the client to call a group of RESTful services.
99
1010
This module was originally shipped as an example code from https://github.com/DataBooster/PyWebApi, licensed under the MIT license.
1111
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.
@@ -81,9 +81,9 @@ def extract_parallel_group(self, task_node:Dict[str, Any]) -> List[Dict[str, Any
8181

8282

8383

84-
def call_rest_group(payload:Dict[str, Any]):
84+
def start(rest:Dict[str, Any]):
8585
"""the main entry for the client to call a group of RESTful services."""
8686
with ThreadPoolExecutor(max_workers=32) as thread_pool:
8787
loader = RestTaskLoader(thread_pool)
88-
container = loader.load(payload)
88+
container = loader.load(rest)
8989
return container.run()

Utilities.PyPI/task_grouping.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
| License: MIT
2222
"""
2323

24+
from collections import Iterable
2425
from abc import ABCMeta, abstractmethod
2526
from typing import Union, List, Dict, Tuple, Callable, Any
2627
from concurrent.futures import ThreadPoolExecutor, as_completed
@@ -91,7 +92,10 @@ def _pipe_in(self, pipeargs:Union[Dict, List[Dict]]={}) -> Dict:
9192
if isinstance(pipeargs, dict):
9293
return pipeargs
9394

94-
if isinstance(pipeargs, iterable):
95+
if isinstance(pipeargs, str):
96+
return {}
97+
98+
if isinstance(pipeargs, Iterable):
9599
pipe_args = {}
96100

97101
for p in pipeargs:
@@ -286,4 +290,4 @@ def load(self, task_tree:Dict[str, Any]) -> TaskContainer:
286290

287291

288292

289-
__version__ = "0.1a0.dev1"
293+
__version__ = "0.1a1"

0 commit comments

Comments
 (0)