Skip to content

Commit

Permalink
CTX-4396: Made it so that in case of "interval" x type of a metric, t…
Browse files Browse the repository at this point in the history
…he timestamp will equel x
  • Loading branch information
Vuk Manojlovic committed Sep 18, 2023
1 parent f72afdd commit df57b55
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions coretex/coretex/experiment/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

from .artifact import Artifact
from .status import ExperimentStatus
from .metrics import Metric
from .metrics import Metric, MetricType
from .parameter import validateParameters, parameter_factory
from .execution_type import ExecutionType
from ..dataset import Dataset, LocalDataset, NetworkDataset
Expand Down Expand Up @@ -306,12 +306,21 @@ def submitMetrics(self, metricValues: Dict[str, Tuple[float, float]]) -> bool:
True
"""

metrics = [{
"timestamp": time.time(),
"metric": key,
"x": value[0],
"y": value[1]
} for key, value in metricValues.items()]
metrics : List[Dict[str, Any]] = []

timestamp = time.time()

for key, value in metricValues.items():
for metric in self.metrics:
if metric.name == key and metric.xType == MetricType.interval.name:
timestamp = value[0]

metrics.append({
"timestamp": timestamp,
"metric": key,
"x": value[0],
"y": value[1]
})

parameters: Dict[str, Any] = {
"experiment_id": self.id,
Expand Down

0 comments on commit df57b55

Please sign in to comment.