Beispiel #1
0
    def test_from_config(self):
        settings.SECRET_USER_TOKEN = 'token'  # noqa
        settings.API_HOST = 'localhost'
        client = PolyaxonClient(api_config=ApiConfig())
        assert client.is_managed is False
        assert client.host == 'localhost'
        assert client.http_port == 80
        assert client.ws_port == 80
        assert client.use_https is False
        assert client.token == 'token'
        assert client.api_config.http_host == 'http://localhost:80'
        assert client.api_config.ws_host == 'ws://localhost:80'

        settings.IS_MANAGED = True
        settings.API_HTTP_HOST = 'api_host'
        settings.API_WS_HOST = 'ws_host'
        settings.API_HOST = None
        client = PolyaxonClient(api_config=ApiConfig())
        assert client.is_managed is True
        assert client.host is None
        assert client.http_port == 80
        assert client.ws_port == 80
        assert client.use_https is False
        assert client.token == 'token'
        assert client.api_config.http_host == 'api_host'
        assert client.api_config.ws_host == 'ws_host'
 def test_is_managed(self):
     settings.API_HTTP_HOST = 'api_host'
     settings.API_WS_HOST = 'ws_host'
     api_config = ApiConfig(host=None, http_port=None, ws_port=None, is_managed=True)
     assert api_config.version == 'v1'
     assert api_config.http_host == 'api_host'
     assert api_config.ws_host == 'ws_host'
     assert api_config.base_url == 'api_host/api/v1'
     assert api_config.base_ws_url == 'ws_host/ws/v1'
 def setUp(self):
     self.host = 'localhost'
     self.http_port = 8000
     self.ws_port = 1337
     self.api_config = ApiConfig(host=self.host,
                                 http_port=self.http_port,
                                 ws_port=self.ws_port,
                                 version='v1',
                                 token='token',
                                 reraise=True,
                                 use_https=False)
Beispiel #4
0
    def __init__(self,
                 api_config=None,
                 host=None,
                 token=None,
                 port=None,
                 http_port=None,
                 ws_port=None,
                 use_https=None,
                 verify_ssl=None,
                 is_managed=None,
                 authentication_type=None,
                 api_version=None,
                 reraise=False,
                 schema_response=None,
                 timeout=None):

        self._api_config = api_config or ApiConfig(
            host=host,
            port=port,
            http_port=http_port,
            ws_port=ws_port,
            token=token,
            authentication_type=authentication_type,
            version=api_version,
            use_https=use_https,
            verify_ssl=verify_ssl,
            is_managed=is_managed,
            schema_response=schema_response,
            reraise=reraise,
            timeout=timeout)

        self._transport = None
        self._auth_api = None
        self._cluster_api = None
        self._version_api = None
        self._project_api = None
        self._experiment_group_api = None
        self._experiment_api = None
        self._experiment_job_api = None
        self._job_api = None
        self._build_job_api = None
        self._user_api = None
        self._bookmark_api = None
Beispiel #5
0
 def setUp(self):
     self.host = 'localhost'
     self.http_port = 8000
     self.ws_port = 1337
     self.api_config = ApiConfig(host=self.host,
                                 http_port=self.http_port,
                                 ws_port=self.ws_port,
                                 version='v1',
                                 token='token',
                                 reraise=True,
                                 use_https=False,
                                 is_managed=False,
                                 interval=0,
                                 timeout=0.01,
                                 schema_response=True)
     self.transport = Transport(config=self.api_config)
     settings.TMP_AUTH_TOKEN_PATH = '{}/{}'.format(tempfile.mkdtemp(),
                                                   '.plx')
     settings.USER_CLIENT_CONFIG_PATH = '{}/{}'.format(
         tempfile.mkdtemp(), '.plx')
Beispiel #6
0
 def __init__(self, delay=0):
     self.delay = delay
     self.config = ApiConfig(is_managed=True, timeout=0.01, interval=0)
     self._periodic_http_exceptions = 0
     self._periodic_http_done = 0
 def __init__(self, delay=0):
     self.queue = []
     self.delay = delay
     self.config = ApiConfig(in_cluster=True, timeout=0.01, interval=0)
     self._periodic_http_exceptions = 0
     self._periodic_http_done = 0
 def __init__(self, delay=0):
     self.delay = delay
     self.config = ApiConfig(is_managed=True, timeout=0.01)
     self._threaded_exceptions = 0
     self._threaded_done = 0
 def __init__(self, delay=0):
     self.queue = []
     self.delay = delay
     self.config = ApiConfig(in_cluster=True, timeout=0.01)
     self._threaded_exceptions = 0
     self._threaded_done = 0