Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiedemaria committed Aug 6, 2024
1 parent cf950ab commit 2ea3aa6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,10 @@ def get_mega_runs(
cursor: Optional[str] = None,
limit: Optional[int] = None,
) -> Sequence["GrapheneMegaRun"]:
"""Returns a merged list of backfills and single runs (runs that are not part of a backfill).
Cursor format: run_id;backfill_id
"""
from ..schema.pipelines.pipeline import GrapheneMegaRun

check.opt_str_param(cursor, "cursor")
Expand All @@ -425,6 +429,7 @@ def get_mega_runs(
key=lambda x: x.create_timestamp.timestamp()
if isinstance(x, RunRecord)
else x.backfill_timestamp,
reverse=True,
)
if limit:
all_mega_runs = all_mega_runs[:limit]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,6 @@ def __init__(self, record: Union[RunRecord, PartitionBackfill]):
)

# TODO - return types
# TODO - need to call the resolve_X fn for anything that isn't set at init time
def resolve_runId(self, _graphene_info: ResolveInfo):
if self.runType == GrapheneRunType.RUN:
return self.singleRun.runId
Expand All @@ -674,34 +673,34 @@ def resolve_creationTime(self, graphene_info: ResolveInfo):
return self.singleRun.resolve_creationTime(graphene_info)
return self.backfill.timestamp

def resolve_startTime(self, _graphene_info: ResolveInfo):
def resolve_startTime(self, graphene_info: ResolveInfo):
if self.runType == GrapheneRunType.RUN:
return self.singleRun.startTime
return self.singleRun.resolve_startTime(graphene_info)
return self.backfill.timestamp

def resolve_endTime(self, _graphene_info: ResolveInfo):
def resolve_endTime(self, graphene_info: ResolveInfo):
if self.runType == GrapheneRunType.RUN:
return self.singleRun.endTime
return self.backfill.endTime
return self.singleRun.resolve_endTime(graphene_info)
return self.backfill.resolve_endTimestamp(graphene_info)

def resolve_tags(self, _graphene_info: ResolveInfo):
def resolve_tags(self, graphene_info: ResolveInfo):
if self.runType == GrapheneRunType.RUN:
return self.singleRun.tags
return self.backfill.tags
return self.singleRun.resolve_tags(graphene_info)
return self.backfill.resolve_tags(graphene_info)

def resolve_jobName(self, _graphene_info: ResolveInfo):
def resolve_jobName(self, graphene_info: ResolveInfo):
if self.runType == GrapheneRunType.RUN:
return self.singleRun.jobName
return self.backfill.tags
return self.singleRun.resolve_jobName(graphene_info)
return self.backfill.partitionSetName

def resolve_assetSelection(self, _graphene_info: ResolveInfo):
def resolve_assetSelection(self, graphene_info: ResolveInfo):
if self.runType == GrapheneRunType.RUN:
return self.singleRun.assetSelection
return self.singleRun.resolve_assetSelection(graphene_info)
return self.backfill.assetSelection

def resolve_assetCheckSelection(self, _graphene_info: ResolveInfo):
def resolve_assetCheckSelection(self, graphene_info: ResolveInfo):
if self.runType == GrapheneRunType.RUN:
return self.singleRun.assetCheckSelection
return self.singleRun.resolve_assetCheckSelection(graphene_info)
return []


Expand Down

0 comments on commit 2ea3aa6

Please sign in to comment.