-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf51bfe
commit 1f0654b
Showing
2 changed files
with
42 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include dcp_client/*.cfg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,62 @@ | ||
import argparse | ||
import sys | ||
import warnings | ||
from os import path | ||
from PyQt5.QtWidgets import QApplication | ||
|
||
from dcp_client.app import Application | ||
from dcp_client.gui.welcome_window import WelcomeWindow | ||
from dcp_client.utils import settings | ||
from dcp_client.utils.fsimagestorage import FilesystemImageStorage | ||
from dcp_client.utils.bentoml_model import BentomlModel | ||
from dcp_client.utils.fsimagestorage import FilesystemImageStorage | ||
from dcp_client.utils.sync_src_dst import DataRSync | ||
from dcp_client.utils.utils import read_config | ||
from dcp_client.app import Application | ||
from dcp_client.gui.welcome_window import WelcomeWindow | ||
from PyQt5.QtWidgets import QApplication | ||
|
||
import warnings | ||
warnings.simplefilter('ignore') | ||
warnings.simplefilter("ignore") | ||
|
||
|
||
def main(): | ||
|
||
settings.init() | ||
dir_name = path.dirname(path.abspath(sys.argv[0])) | ||
server_config = read_config('server', config_path = path.join(dir_name, 'config.cfg')) | ||
dir_name = path.dirname(path.abspath(__file__)) | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument( | ||
"-m", | ||
"--mode", | ||
choices=["local", "remote"], | ||
required=True, | ||
help="Choose mode: local or remote", | ||
) | ||
args = parser.parse_args() | ||
|
||
if args.mode == "local": | ||
server_config = read_config( | ||
"server", config_path=path.join(dir_name, "config.cfg") | ||
) | ||
elif args.mode == "remote": | ||
server_config = read_config( | ||
"server", config_path=path.join(dir_name, "config_remote.cfg") | ||
) | ||
|
||
image_storage = FilesystemImageStorage() | ||
ml_model = BentomlModel() | ||
data_sync = DataRSync(user_name=server_config["user"], | ||
host_name=server_config["host"], | ||
server_repo_path=server_config["data-path"]) | ||
welcome_app = Application(ml_model=ml_model, | ||
syncer=data_sync, | ||
image_storage=image_storage, | ||
server_ip=server_config["ip"], | ||
server_port=server_config["port"]) | ||
data_sync = DataRSync( | ||
user_name=server_config["user"], | ||
host_name=server_config["host"], | ||
server_repo_path=server_config["data-path"], | ||
) | ||
welcome_app = Application( | ||
ml_model=ml_model, | ||
syncer=data_sync, | ||
image_storage=image_storage, | ||
server_ip=server_config["ip"], | ||
server_port=server_config["port"], | ||
) | ||
app = QApplication(sys.argv) | ||
window = WelcomeWindow(welcome_app) | ||
sys.exit(app.exec()) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |