From 83c523364305d66f65081710dee8c629a48e3f98 Mon Sep 17 00:00:00 2001 From: hekaisheng Date: Wed, 11 Aug 2021 20:55:32 +0800 Subject: [PATCH] Use np.random.bytes instead of os.urandom to generate message id --- mars/oscar/backends/message.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mars/oscar/backends/message.py b/mars/oscar/backends/message.py index 4d4017d62c..d17af4f7e7 100644 --- a/mars/oscar/backends/message.py +++ b/mars/oscar/backends/message.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os from abc import ABC, abstractmethod from dataclasses import dataclass from enum import Enum @@ -20,6 +19,8 @@ from types import TracebackType from typing import Any, Type, Tuple, Dict, List +import numpy as np + from ...lib.tblib import pickling_support from ...serialization.core import Serializer, pickle, buffered from ...utils import classproperty, dataslots, implements @@ -358,4 +359,4 @@ def _get_slots(message_cls: Type[_MessageBase]): def new_message_id(): - return os.urandom(32) + return np.random.bytes(32)