def test_log_video_from_path(self):
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.VIDEO)) is False)
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.VIDEO)) is False)
    video_file = (tempfile.mkdtemp() + '/video.gif')
    self.touch(video_file)
    with patch('polyaxon.tracking.run.Run._log_has_events') as log_video:
        self.run.log_video(name='my_video', data=video_file)
    assert (log_video.call_count == 1)
    self.event_logger.flush()
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.VIDEO)) is True)
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.VIDEO)) is True)
    events_file = get_event_path(self.run_path, kind=V1ArtifactKind.VIDEO, name='my_video')
    assert (os.path.exists(events_file) is True)
    results = V1Events.read(kind='video', name='my_video', data=events_file)
    assert (len(results.df.values) == 1)
    asset_file = get_asset_path(self.run_path, kind=V1ArtifactKind.VIDEO, name='my_video', ext='gif')
    assert (os.path.exists(asset_file) is True)
def test_log_video_from_path(self):
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.VIDEO)) is False)
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.VIDEO)) is False)
    video_file = (tempfile.mkdtemp() + '/video.gif')
    self.touch(video_file)
    with patch('polyaxon.tracking.run.Run._log_has_events') as log_video:
        self.run.log_video(name='my_video', data=video_file)
    assert (log_video.call_count == 1)
    self.event_logger.flush()
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.VIDEO)) is True)
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.VIDEO)) is True)
    events_file = get_event_path(self.run_path, kind=V1ArtifactKind.VIDEO, name='my_video')
    assert (os.path.exists(events_file) is True)
    results = V1Events.read(kind='video', name='my_video', data=events_file)
    assert (len(results.df.values) == 1)
    asset_file = get_asset_path(self.run_path, kind=V1ArtifactKind.VIDEO, name='my_video', ext='gif')
    assert (os.path.exists(asset_file) is True)