def test_log_artifact_without_name(self):
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.TSV)) is False)
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.TSV)) is False)
    tsv_file = (tempfile.mkdtemp() + '/file.tsv')
    self.touch(tsv_file)
    with patch('polyaxon.tracking.run.Run._log_has_events') as log_artifact:
        self.run.log_artifact(path=tsv_file, kind=V1ArtifactKind.TSV, step=1)
    assert (log_artifact.call_count == 1)
    self.event_logger.flush()
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.TSV)) is True)
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.TSV)) is True)
    events_file = get_event_path(self.run_path, kind=V1ArtifactKind.TSV, name='file')
    assert (os.path.exists(events_file) is True)
    results = V1Events.read(kind=V1ArtifactKind.TSV, name='file', data=events_file)
    assert (len(results.df.values) == 1)
    asset_file = get_asset_path(self.run_path, kind=V1ArtifactKind.TSV, name='file_1', ext='tsv')
    assert (os.path.exists(asset_file) is True)
def test_log_artifact_without_name(self):
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.TSV)) is False)
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.TSV)) is False)
    tsv_file = (tempfile.mkdtemp() + '/file.tsv')
    self.touch(tsv_file)
    with patch('polyaxon.tracking.run.Run._log_has_events') as log_artifact:
        self.run.log_artifact(path=tsv_file, kind=V1ArtifactKind.TSV, step=1)
    assert (log_artifact.call_count == 1)
    self.event_logger.flush()
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.TSV)) is True)
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.TSV)) is True)
    events_file = get_event_path(self.run_path, kind=V1ArtifactKind.TSV, name='file')
    assert (os.path.exists(events_file) is True)
    results = V1Events.read(kind=V1ArtifactKind.TSV, name='file', data=events_file)
    assert (len(results.df.values) == 1)
    asset_file = get_asset_path(self.run_path, kind=V1ArtifactKind.TSV, name='file_1', ext='tsv')
    assert (os.path.exists(asset_file) is True)