def test_empty_tf_config(self): os.environ['POLYAXON_RUN_OUTPUTS_PATH'] = 'path' assert Experiment.get_tf_config() == { 'cluster': None, 'task': None, 'model_dir': 'path', 'environment': 'cloud' }
def test_non_dict_tf_config(self): os.environ['POLYAXON_RUN_OUTPUTS_PATH'] = 'path' os.environ['POLYAXON_CLUSTER'] = 'value' os.environ['POLYAXON_TASK_INFO'] = 'value' assert Experiment.get_tf_config() == { 'cluster': None, 'task': None, 'model_dir': 'path', 'environment': 'cloud' }
def test_dict_tf_config(self): cluster_def = { "master": ["plxjob-master0-8eefb7a1146f476ca66e3bee9b88c1de:2000"], "worker": ["plxjob-worker1-8eefb7a1146f476ca66e3bee9b88c1de:2000", "plxjob-worker2-8eefb7a1146f476ca66e3bee9b88c1de:2000"], "ps": ["plxjob-ps3-8eefb7a1146f476ca66e3bee9b88c1de:2000"], } task_info = {"type": 'master', "index": 0} os.environ['POLYAXON_CLUSTER'] = json.dumps(cluster_def) os.environ['POLYAXON_TASK_INFO'] = json.dumps(task_info) os.environ['POLYAXON_RUN_OUTPUTS_PATH'] = 'path' assert Experiment.get_tf_config() == { 'cluster': cluster_def, 'task': {"type": 'master', "index": 0}, 'model_dir': 'path', 'environment': 'cloud' }
def test_task_info_checks_is_managed(self): settings.IS_MANAGED = False with self.assertRaises(PolyaxonClientException): Experiment.get_task_info()
def test_task_info_checks_in_cluster(self): settings.IN_CLUSTER = False with self.assertRaises(PolyaxonClientException): Experiment.get_task_info()