def test_log_image_from_path_with_step(self):
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.IMAGE)) is False)
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.IMAGE)) is False)
    image_file = (tempfile.mkdtemp() + '/file.png')
    self.touch(image_file)
    with patch('polyaxon.tracking.run.Run._log_has_events') as log_image:
        self.run.log_image(name='my_image', data=image_file, step=1)
    assert (log_image.call_count == 1)
    self.event_logger.flush()
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.IMAGE)) is True)
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.IMAGE)) is True)
    events_file = get_event_path(self.run_path, kind=V1ArtifactKind.IMAGE, name='my_image')
    assert (os.path.exists(events_file) is True)
    results = V1Events.read(kind='image', name='my_image', data=events_file)
    assert (len(results.df.values) == 1)
    asset_file = get_asset_path(self.run_path, kind=V1ArtifactKind.IMAGE, name='my_image', step=1, ext='png')
    assert (os.path.exists(asset_file) is True)
def test_log_image_from_path_with_step(self):
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.IMAGE)) is False)
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.IMAGE)) is False)
    image_file = (tempfile.mkdtemp() + '/file.png')
    self.touch(image_file)
    with patch('polyaxon.tracking.run.Run._log_has_events') as log_image:
        self.run.log_image(name='my_image', data=image_file, step=1)
    assert (log_image.call_count == 1)
    self.event_logger.flush()
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.IMAGE)) is True)
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.IMAGE)) is True)
    events_file = get_event_path(self.run_path, kind=V1ArtifactKind.IMAGE, name='my_image')
    assert (os.path.exists(events_file) is True)
    results = V1Events.read(kind='image', name='my_image', data=events_file)
    assert (len(results.df.values) == 1)
    asset_file = get_asset_path(self.run_path, kind=V1ArtifactKind.IMAGE, name='my_image', step=1, ext='png')
    assert (os.path.exists(asset_file) is True)