Skip to content

Commit

Permalink
actually pass the correct cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiedemaria committed Aug 15, 2024
1 parent feb6247 commit ecb72d4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,9 @@ def get_runs_feed_entries(
backfills = [
GraphenePartitionBackfill(backfill)
for backfill in instance.get_backfills(
cursor=cursor, limit=limit, created_before=created_before_cursor
cursor=runs_feed_cursor.backfill_cursor,
limit=limit,
created_before=created_before_cursor,
)
]
runs = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,11 @@ def test_get_runs_feed(self, gql_context_with_runs_and_backfills):
},
)
prev_run_time = None
id_to_timestamp_mapping = {}
for res in result.data["runsFeedOrError"]["results"]:
id_to_timestamp_mapping[res["id"]] = res["creationTime"]
if prev_run_time:
assert res["creationTime"] <= prev_run_time
prev_run_time = res["creationTime"]

print(id_to_timestamp_mapping)

result = execute_dagster_graphql(
gql_context_with_runs_and_backfills.create_request_context(),
GET_RUNS_FEED_QUERY,
Expand All @@ -131,15 +127,11 @@ def test_get_runs_feed(self, gql_context_with_runs_and_backfills):

assert len(result.data["runsFeedOrError"]["results"]) == 10
prev_run_time = None
id_to_timestamp_mapping = {}
for res in result.data["runsFeedOrError"]["results"]:
id_to_timestamp_mapping[res["id"]] = res["creationTime"]
if prev_run_time:
assert res["creationTime"] <= prev_run_time
prev_run_time = res["creationTime"]

print(id_to_timestamp_mapping)

assert result.data["runsFeedOrError"]["hasMore"]
old_cursor = result.data["runsFeedOrError"]["cursor"]
assert old_cursor is not None
Expand All @@ -153,21 +145,12 @@ def test_get_runs_feed(self, gql_context_with_runs_and_backfills):
},
)

id_to_timestamp_mapping = {}
for res in result.data["runsFeedOrError"]["results"]:
id_to_timestamp_mapping[res["id"]] = res["creationTime"]

assert len(result.data["runsFeedOrError"]["results"]) == 10
for res in result.data["runsFeedOrError"]["results"]:
if prev_run_time:
assert res["creationTime"] <= prev_run_time
prev_run_time = res["creationTime"]

print(id_to_timestamp_mapping)

assert len(result.data["runsFeedOrError"]["results"]) == 10

# assert False

assert not result.data["runsFeedOrError"]["hasMore"]

def test_get_runs_feed_inexact_limit(self, gql_context_with_runs_and_backfills):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ def get_backfills(
created_after: Optional[datetime] = None,
) -> Sequence[PartitionBackfill]:
check.opt_inst_param(status, "status", BulkActionStatus)
query = db_select([BulkActionsTable.c.body])
query = db_select([BulkActionsTable.c.body, BulkActionsTable.c.timestamp])
if status:
query = query.where(BulkActionsTable.c.status == status.value)
if cursor:
Expand All @@ -852,7 +852,7 @@ def get_backfills(
if created_after:
query = query.where(BulkActionsTable.c.timestamp > created_after)
if created_before:
query = query.where(BulkActionsTable.c.timestamp < created_before)
query = query.where(BulkActionsTable.c.timestamp < created_before.replace(tzinfo=None))
if limit:
query = query.limit(limit)
query = query.order_by(BulkActionsTable.c.id.desc())
Expand Down

0 comments on commit ecb72d4

Please sign in to comment.