artifacts.OnArtifact#

class union.artifacts.OnArtifact(trigger_on, inputs=None)#

Event used to link upstream and downstream workflows together.

Parameters:
  • trigger_on (Artifact | ArtifactQuery) – Artifact on which to trigger.

  • inputs (Dict[str, Any | Artifact | ArtifactQuery] | None) – Dict of inputs.

Example usage:

OnArtifact(
    trigger_on=dailyArtifact,
    inputs={
        # Use the matched Artifact
        "today_upstream": dailyArtifact,
        "yesterday_upstream": dailyArtifact.query(
            time_partition=dailyArtifact.
            time_partition - timedelta(days=1)),
        # Use the matched hourly Artifact
        "other_daily_upstream": hourlyArtifact.query(
            partitions={"region": "LAX"}),
        # Static value "SEA" that will be passed as input
        "region": "SEA",
        "other_artifact": UnrelatedArtifact.query(
            time_partition=dailyArtifact.
            time_partition - timedelta(days=1)),
        "other_artifact_2": UnrelatedArtifact.query(
            time_partition=hourlyArtifact.time_partition.truncate_to_day()),
        "other_artifact_3": UnrelatedArtifact.query(
            region=hourlyArtifact.time_partition.truncate_to_day()),
    },
)