Skip to content

Commit

Permalink
flow: code decoupling
Browse files Browse the repository at this point in the history
Signed-off-by: zhihuiwan <15779896112@163.com>
  • Loading branch information
zhihuiwan committed Dec 14, 2022
1 parent 4e90623 commit 09bf4ff
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.
5 changes: 0 additions & 5 deletions python/fate/arch/common/base_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
from enum import Enum, IntEnum

from ._types import BaseType
from .conf_utils import get_base_config

use_deserialize_safe_module = get_base_config("use_deserialize_safe_module", False)


class CustomJSONEncoder(json.JSONEncoder):
Expand Down Expand Up @@ -111,8 +108,6 @@ def serialize_b64(src, to_str=False):

def deserialize_b64(src):
src = base64.b64decode(string_to_bytes(src) if isinstance(src, str) else src)
if use_deserialize_safe_module:
return restricted_loads(src)
return pickle.loads(src)


Expand Down
10 changes: 1 addition & 9 deletions python/fate/arch/metastore/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
IntegerField,
Metadata,
Model,
TextField,
TextField, DateTimeField,
)

from ..common import EngineType, conf_utils
Expand All @@ -40,14 +40,6 @@
)
from ..federation import FederationEngine

is_standalone = (
conf_utils.get_base_config("default_engines", {}).get(EngineType.FEDERATION).upper()
== FederationEngine.STANDALONE
)
if is_standalone:
from playhouse.apsw_ext import DateTimeField
else:
from peewee import DateTimeField

CONTINUOUS_FIELD_TYPE = {IntegerField, FloatField, DateTimeField}
AUTO_DATE_TIMESTAMP_FIELD_PREFIX = {
Expand Down
8 changes: 2 additions & 6 deletions python/fate/arch/metastore/db_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,13 @@
)

from ..common import EngineType, conf_utils, file_utils, log
from ..common.conf_utils import decrypt_database_config
from ..federation import FederationEngine
from ..metastore.base_model import BaseModel, DateTimeField, JSONField, SerializedField

LOGGER = log.getLogger()

DATABASE = decrypt_database_config()
is_standalone = (
conf_utils.get_base_config("default_engines", {}).get(EngineType.FEDERATION).upper()
== FederationEngine.STANDALONE
)
DATABASE = {"name": "xxx"}
is_standalone = True


def singleton(cls, *args, **kw):
Expand Down

0 comments on commit 09bf4ff

Please sign in to comment.