def test_log_model_dir(self):
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.MODEL)) is False)
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.MODEL)) is False)
    assert (os.path.exists(self.run.get_outputs_path(V1ArtifactKind.MODEL)) is False)
    model_dir = (tempfile.mkdtemp() + '/model')
    create_path(model_dir)
    model_file = (model_dir + '/model.pkl')
    self.touch(model_file)
    weights_file = (model_dir + '/weights')
    self.touch(weights_file)
    configs_file = (model_dir + '/configs')
    self.touch(configs_file)
    with patch('polyaxon.tracking.run.Run.log_model_ref') as log_model:
        self.run.log_model(name='my_model', path=model_dir, framework='tensorflow', versioned=False)
    assert (log_model.call_count == 1)
    self.event_logger.flush()
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.MODEL)) is False)
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.MODEL)) is False)
    assert (os.path.exists(self.run.get_outputs_path(V1ArtifactKind.MODEL)) is True)
    model_file = self.run.get_outputs_path('{}/{}'.format(V1ArtifactKind.MODEL, 'model.pkl'))
    assert (os.path.exists(model_file) is True)
def test_log_model_dir(self):
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.MODEL)) is False)
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.MODEL)) is False)
    assert (os.path.exists(self.run.get_outputs_path(V1ArtifactKind.MODEL)) is False)
    model_dir = (tempfile.mkdtemp() + '/model')
    create_path(model_dir)
    model_file = (model_dir + '/model.pkl')
    self.touch(model_file)
    weights_file = (model_dir + '/weights')
    self.touch(weights_file)
    configs_file = (model_dir + '/configs')
    self.touch(configs_file)
    with patch('polyaxon.tracking.run.Run.log_model_ref') as log_model:
        self.run.log_model(name='my_model', path=model_dir, framework='tensorflow', versioned=False)
    assert (log_model.call_count == 1)
    self.event_logger.flush()
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.MODEL)) is False)
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.MODEL)) is False)
    assert (os.path.exists(self.run.get_outputs_path(V1ArtifactKind.MODEL)) is True)
    model_file = self.run.get_outputs_path('{}/{}'.format(V1ArtifactKind.MODEL, 'model.pkl'))
    assert (os.path.exists(model_file) is True)