Delete shebangs, follow PEP 8 import style, and use __init__.py.
Please run test script at project ROOT dir
(e.g., bash ./test/unit_test.sh)
Issue-id: AIMLFW-9
Signed-off-by: Youhwan Seol <yh.seol@samsung.com>
Change-Id: I95a32b24cab38870c1fb793b14af57c5b8658975
--- /dev/null
+# ==================================================================================
+#
+# Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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.
+#
+# ==================================================================================
-#!/usr/bin/python3
# ==================================================================================
#
# Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
# limitations under the License.
#
# ==================================================================================
-
"""kfadapter_conf.py
This module is for retrieving configuration for KfAdapter App
"""
+
from os import getenv
from threading import Lock
-from tmgr_logger import TMLogger
+
+from .tmgr_logger import TMLogger
TRAINING_DICT = {}
LOCK = Lock()
# limitations under the License.
#
# ==================================================================================
-
"""kfadapter_kfconnect.py.
This module is for interfacing and interworking with KubeFlow SDK
"""
import kfp
-from kfadapter_util import random_suffix
-from kfadapter_conf import KfConfiguration
+
+from .kfadapter_util import random_suffix
+from .kfadapter_conf import KfConfiguration
class KfConnect:
"""
-#!/usr/bin/python3
# ==================================================================================
#
# Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
import traceback
import json
from threading import Thread
+
from flask import Flask, request, jsonify
from flask_api import status
import kfp_server_api
-from kfadapter_kfconnect import KfConnect
-import kfadapter_conf
-from kfadapter_util import BadRequest, wait_status_thread, keys_match, check_map
+
+from .kfadapter_kfconnect import KfConnect
+from .kfadapter_util import BadRequest, wait_status_thread, keys_match, check_map
#Handles to Config and Kubeflow
KFCONNECT_CONFIG_OBJ = None
-"""kfadapter_util.py.
-
-This module is for all the utility functions to be used
-by the main and other modules
-
-"""
# ==================================================================================
#
# Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
# limitations under the License.
#
# ==================================================================================
-from random import choices
+"""kfadapter_util.py.
+
+This module is for all the utility functions to be used
+by the main and other modules
+
+"""
+
import traceback
import string
import time
import json
import requests
+from random import choices
+
from flask_api import status
-import kfadapter_conf
class BadRequest(Exception):
"""
-#!/usr/bin/python3
# ==================================================================================
#
# Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
#
# ==================================================================================
"""tmgr_logger.py
+
This module is for Initializing Logger Framework
-"""
+"""
+import os
import logging
import logging.config
import yaml
-
class TMLogger(object):# pylint: disable=too-few-public-methods
"""
This is a class for initiliazing logger configuration for TMLogger
--- /dev/null
+# ==================================================================================
+#
+# Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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.
+#
+# ==================================================================================
import kfp_server_api
from kfp_server_api.models.api_run import ApiRun
from kfp_server_api.models.api_list_runs_response import ApiListRunsResponse
-
from kfp_server_api.models.api_experiment import ApiExperiment
from kfp_server_api.models.api_list_pipelines_response import ApiListPipelinesResponse
from kfp_server_api.models.api_pipeline import ApiPipeline
from kfp_server_api.models.api_experiment import ApiExperiment
from kfp_server_api.models.api_run_detail import ApiRunDetail
from kfp_server_api.models.api_run import ApiRun
-
-
-
import kfp_server_api
class FakeKfp:
#
# ==================================================================================
-import sys
import os
-sys.path.append("../kfadapter")
-import kfadapter_conf
-import pytest
+
+from kfadapter import kfadapter_conf
class Test_kfadapter_conf:
KUBEFLOW_HOST_NAME = '127.0.0.1'
#
# ==================================================================================
-import sys
-sys.path.append("kfadapter")
-# import kfadapter_conf
-from kfadapter_kfconnect import KfConnect
-from fake_kfconnect import FakeKfConnect
-from fake_kfp import FakeKfp
-from fake_kfp import FakeNegativeKfp
import kfp_server_api
+from kfadapter.kfadapter_kfconnect import KfConnect
+
+from .fake_kfp import FakeKfp
+from .fake_kfp import FakeNegativeKfp
+
class Test_KfConnect:
def setup_method(self):
self.__KFCONNECT = KfConnect()
# limitations under the License.
#
# ==================================================================================
-
-import sys
-sys.path.append("kfadapter")
-import kfadapter_main
-from tmgr_logger import TMLogger
+import json
from flask_api import status
-import json
-from fake_kfconnect import FakeKfConnect, NegativeFakeAdditionalKfConnect, NegativeFakeKfConnect, NegativeFakeNoneKfConnect
-from fake_kfconf import FakeKfConf
+
+from kfadapter import kfadapter_main
+from kfadapter.tmgr_logger import TMLogger
+from .fake_kfconnect import FakeKfConnect, NegativeFakeAdditionalKfConnect, NegativeFakeKfConnect, NegativeFakeNoneKfConnect
+from .fake_kfconf import FakeKfConf
class Test_pipeline_id_operations:
#
# ==================================================================================
-import pytest
-import sys
-import string
-from mock import patch
-sys.path.append("../kfadapter")
-import kfadapter_util
+from kfadapter import kfadapter_util
class Test_kfadapter_util:
def setup_method(self):
#
# ==================================================================================
-import sys
-sys.path.append("../kfadapter")
-from tmgr_logger import TMLogger
+from kfadapter.tmgr_logger import TMLogger
class Test_tmgr_logger:
def setup_method(self):
- self.TMGR_LOGGER_OBJ = TMLogger("../config/log_config.yaml")
+ self.TMGR_LOGGER_OBJ = TMLogger("config/log_config.yaml")
def test_get_loglevel(self):
ret = self.TMGR_LOGGER_OBJ.get_logLevel
-// test/unit_test.sh
-
# ==================================================================================
#
# Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.