def test_log_curves(self):
    x = [1, 2, 3, 4, 5]
    y = [6, 7, 2, 4, 5]
    with patch('polyaxon.tracking.run.Run._log_has_events') as log_curves:
        self.run.log_roc_auc_curve(name='roc_test', fpr=x, tpr=y, auc=0.6, step=1)
        self.run.log_pr_curve(name='pr_test', precision=x, recall=y, average_precision=0.6, step=1)
        self.run.log_curve(name='curve_test', x=x, y=y, annotation=0.6, step=1)
    assert (log_curves.call_count == 3)
    self.event_logger.flush()
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.CURVE)) is False)
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.CURVE)) is True)
    events_file = get_event_path(self.run_path, kind=V1ArtifactKind.CURVE, name='roc_test')
    assert (os.path.exists(events_file) is True)
    results = V1Events.read(kind=V1ArtifactKind.CURVE, name='roc_test', data=events_file)
    assert (len(results.df.values) == 1)
    events_file = get_event_path(self.run_path, kind=V1ArtifactKind.CURVE, name='pr_test')
    assert (os.path.exists(events_file) is True)
    results = V1Events.read(kind=V1ArtifactKind.CHART, name='pr_test', data=events_file)
    assert (len(results.df.values) == 1)
    events_file = get_event_path(self.run_path, kind=V1ArtifactKind.CURVE, name='curve_test')
    assert (os.path.exists(events_file) is True)
    results = V1Events.read(kind=V1ArtifactKind.CHART, name='curve_test', data=events_file)
    assert (len(results.df.values) == 1)
def test_log_curves(self):
    x = [1, 2, 3, 4, 5]
    y = [6, 7, 2, 4, 5]
    with patch('polyaxon.tracking.run.Run._log_has_events') as log_curves:
        self.run.log_roc_auc_curve(name='roc_test', fpr=x, tpr=y, auc=0.6, step=1)
        self.run.log_pr_curve(name='pr_test', precision=x, recall=y, average_precision=0.6, step=1)
        self.run.log_curve(name='curve_test', x=x, y=y, annotation=0.6, step=1)
    assert (log_curves.call_count == 3)
    self.event_logger.flush()
    assert (os.path.exists(get_asset_path(self.run_path, kind=V1ArtifactKind.CURVE)) is False)
    assert (os.path.exists(get_event_path(self.run_path, kind=V1ArtifactKind.CURVE)) is True)
    events_file = get_event_path(self.run_path, kind=V1ArtifactKind.CURVE, name='roc_test')
    assert (os.path.exists(events_file) is True)
    results = V1Events.read(kind=V1ArtifactKind.CURVE, name='roc_test', data=events_file)
    assert (len(results.df.values) == 1)
    events_file = get_event_path(self.run_path, kind=V1ArtifactKind.CURVE, name='pr_test')
    assert (os.path.exists(events_file) is True)
    results = V1Events.read(kind=V1ArtifactKind.CHART, name='pr_test', data=events_file)
    assert (len(results.df.values) == 1)
    events_file = get_event_path(self.run_path, kind=V1ArtifactKind.CURVE, name='curve_test')
    assert (os.path.exists(events_file) is True)
    results = V1Events.read(kind=V1ArtifactKind.CHART, name='curve_test', data=events_file)
    assert (len(results.df.values) == 1)