未验证 提交 18f08a91 编写于 作者: C chenjian 提交者: GitHub

Set prefered multiprocessing startup method (#2152)

* set prefered multiprocessing startup method

* set prefered multiprocessing startup method
上级 14b53057
......@@ -12,9 +12,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import Any
from collections import defaultdict
from typing import Any
def _CommandDict():
......@@ -64,6 +63,13 @@ def execute():
status(int) : Result of the command execution. 0 for a success and 1 for a failure.
'''
import sys
import multiprocessing
try:
multiprocessing.set_start_method(
'fork'
) # In paddlehub, functions like gradio app need multiprocess supported, and 'fork' is our prefered start method.
except Exception:
pass # If can not set 'fork', maintain the default start method
com = _commands
for idx, _argv in enumerate(['hub'] + sys.argv[1:]):
if _argv not in com:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册