def test_artifacts_read_yaml(self): values = [ V1Event( timestamp=dt_parser.parse("2018-12-11 10:24:57"), artifact=V1EventArtifact(kind="dataframe", path="path1"), step=12, ), V1Event( timestamp=dt_parser.parse("2018-12-11 10:25:57"), artifact=V1EventArtifact(kind="tsv", path="path2"), step=13, ), V1Event( timestamp=dt_parser.parse("2018-12-11 10:26:57"), artifact=V1EventArtifact(kind="csv", path="path3"), step=14, ), ] events = V1Events.read( name="foo", kind="artifact", data=os.path.abspath( "tests/fixtures/polyboard/artifact/artifact_events.plx"), ) assert events.name == "foo" assert len(events.df.values) == 3 for i in range(3): assert events.get_event_at(i).to_dict() == values[i].to_dict()
def test_artifact(self): events = LoggedEventListSpec( name="foo", kind="artifact", events=[ V1Event( timestamp=dt_parser.parse("2018-12-11 10:24:57"), artifact=V1EventArtifact(kind="dataframe", path="path"), step=12, ), V1Event( timestamp=dt_parser.parse("2018-12-11 11:24:57"), artifact=V1EventArtifact(kind="tsv", path="path"), step=13, ), V1Event( timestamp=dt_parser.parse("2018-12-11 12:24:57"), artifact=V1EventArtifact(kind="csv", path="path"), step=14, ), ], ) events_dict = events.to_dict() assert events_dict == events.from_dict(events_dict).to_dict()
def artifact_path(from_path: str, asset_path: str, kind: str, asset_rel_path: str = None) -> V1EventArtifact: copy_file_path(from_path, asset_path) return V1EventArtifact(kind=kind, path=asset_rel_path or asset_path)
def artifact_path(from_path: str, asset_path: str, kind: str) -> V1EventArtifact: check_or_create_path(asset_path, is_dir=False) shutil.copy(from_path, asset_path) return V1EventArtifact(kind=kind, path=asset_path)