Skip to content

Commit

Permalink
Merge pull request #3753 from FederatedAI/develop-1.7.2
Browse files Browse the repository at this point in the history
Develop 1.7.2
  • Loading branch information
mgqa34 authored Mar 1, 2022
2 parents b961e07 + 0b99f30 commit 018d051
Showing 1 changed file with 8 additions and 36 deletions.
44 changes: 8 additions & 36 deletions python/fate_arch/common/address.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from fate_arch.abc import AddressABC
from fate_arch.metastore.db_utils import StorageConnector
from fate_arch.storage import StorageEngine


class AddressBase(AddressABC):
def __init__(self, connector_name=None):
self.connector_name = connector_name
if connector_name:
connector = StorageConnector(connector_name=connector_name, engine=self.storage_engine)
connector = StorageConnector(connector_name=connector_name)
if connector.get_info():
for k, v in connector.get_info().items():
if hasattr(self, k) and v:
Expand Down Expand Up @@ -43,10 +42,6 @@ def __repr__(self):
def connector(self):
return {"home": self.home}

@property
def storage_engine(self):
return StorageEngine.STANDALONE


class EggRollAddress(AddressBase):
def __init__(self, home=None, name=None, namespace=None, connector_name=None):
Expand All @@ -68,10 +63,6 @@ def __repr__(self):
def connector(self):
return {"home": self.home}

@property
def storage_engine(self):
return StorageEngine.EGGROLL


class HDFSAddress(AddressBase):
def __init__(self, name_node=None, path=None, connector_name=None):
Expand All @@ -92,10 +83,6 @@ def __repr__(self):
def connector(self):
return {"name_node": self.name_node}

@property
def storage_engine(self):
return StorageEngine.HDFS


class PathAddress(AddressBase):
def __init__(self, path=None, connector_name=None):
Expand All @@ -111,10 +98,6 @@ def __str__(self):
def __repr__(self):
return self.__str__()

@property
def storage_engine(self):
return StorageEngine.PATH


class MysqlAddress(AddressBase):
def __init__(self, user=None, passwd=None, host=None, port=None, db=None, name=None, connector_name=None):
Expand All @@ -140,10 +123,6 @@ def __repr__(self):
def connector(self):
return {"user": self.user, "passwd": self.passwd, "host": self.host, "port": self.port, "db": self.db}

@property
def storage_engine(self):
return StorageEngine.MYSQL


class HiveAddress(AddressBase):
def __init__(self, host=None, name=None, port=10000, username=None, database='default', auth_mechanism='PLAIN',
Expand All @@ -168,12 +147,13 @@ def __repr__(self):

@property
def connector(self):
return {"host": self.host, "port": self.port, "username": self.username, "password": self.password, "auth_mechanism": self.auth_mechanism, "database": self.database}

@property
def storage_engine(self):
return StorageEngine.HIVE

return {
"host": self.host,
"port": self.port,
"username": self.username,
"password": self.password,
"auth_mechanism": self.auth_mechanism,
"database": self.database}

class LinkisHiveAddress(AddressBase):
def __init__(self, host="127.0.0.1", port=9001, username='', database='', name='', run_type='hql',
Expand All @@ -198,10 +178,6 @@ def __str__(self):
def __repr__(self):
return self.__str__()

@property
def storage_engine(self):
return StorageEngine.LINKIS_HIVE


class LocalFSAddress(AddressBase):
def __init__(self, path=None, connector_name=None):
Expand All @@ -216,7 +192,3 @@ def __str__(self):

def __repr__(self):
return self.__str__()

@property
def storage_engine(self):
return StorageEngine.LOCALFS

0 comments on commit 018d051

Please sign in to comment.