All Downloads are FREE. Search and download functionalities are using the official Maven repository.

marquez.service.models.RunMeta Maven / Gradle / Ivy

There is a newer version: 0.49.0
Show newest version
/*
 * Copyright 2018-2023 contributors to the Marquez project
 * SPDX-License-Identifier: Apache-2.0
 */

package marquez.service.models;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.google.common.collect.ImmutableMap;
import java.time.Instant;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import marquez.common.models.RunId;

@EqualsAndHashCode
@ToString
@Builder
public final class RunMeta {
  @Nullable private final RunId id;
  @Nullable private final Instant nominalStartTime;
  @Nullable private final Instant nominalEndTime;
  @Getter private final Map args;

  public RunMeta(
      @Nullable final Instant nominalStartTime,
      @Nullable final Instant nominalEndTime,
      @Nullable final Map args) {
    this(null, nominalStartTime, nominalEndTime, args);
  }

  @JsonCreator
  public RunMeta(
      @Nullable final RunId id,
      @Nullable final Instant nominalStartTime,
      @Nullable final Instant nominalEndTime,
      @Nullable final Map args) {
    this.id = id;
    this.nominalStartTime = nominalStartTime;
    this.nominalEndTime = nominalEndTime;
    this.args = (args == null) ? ImmutableMap.of() : args;
  }

  public Optional getNominalStartTime() {
    return Optional.ofNullable(nominalStartTime);
  }

  public Optional getNominalEndTime() {
    return Optional.ofNullable(nominalEndTime);
  }

  public Optional getId() {
    return Optional.ofNullable(id);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy