Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add status as persisted column for records table #5132

Conversation

jfcalvo
Copy link
Member

@jfcalvo jfcalvo commented Jun 28, 2024

Description

Add status as a persisted database column for records table.

@jfcalvo jfcalvo requested a review from frascuchon June 28, 2024 16:24
@jfcalvo jfcalvo marked this pull request as ready for review June 28, 2024 22:13
Copy link

codecov bot commented Jun 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.99%. Comparing base (d97bcf7) to head (312dc16).

Current head 312dc16 differs from pull request most recent head 8ef4f43

Please upload reports for the commit 8ef4f43 to get more accurate results.

Additional details and impacted files
@@                        Coverage Diff                         @@
##           feat/support-record-status-filter    #5132   +/-   ##
==================================================================
  Coverage                              91.99%   91.99%           
==================================================================
  Files                                    136      137    +1     
  Lines                                   5881     5896   +15     
==================================================================
+ Hits                                    5410     5424   +14     
- Misses                                   471      472    +1     
Flag Coverage Δ
argilla-server 91.99% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -821,7 +821,7 @@ async def test_list_current_user_dataset_records(
"items": [
{
"id": str(record_a.id),
"status": RecordStatus.completed,
"status": RecordStatus.pending,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why all these tests are changing the expected status?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As commented in a call, the status is not calculated on-the-fly anymore (now is persisted on database) so factories are not modifying the status (only our handlers are doing that) so the values are now pending by default.

@@ -67,6 +68,7 @@ async def create_records_bulk(self, dataset: Dataset, bulk_create: RecordsBulkCr

await self._upsert_records_relationships(records, bulk_create.items)
await _preload_records_relationships_before_index(self._db, records)
await distribution.update_records_status(self._db, records, autocommit=False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just remove the autocommit=False argument and handle this internally in the distribution context?

else:
record.status = RecordStatus.pending

return await record.save(db, autocommit)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not using autocommit=True anywhere. I suggest setting it to False by default and stopping exposing it to the outside.

Suggested change
return await record.save(db, autocommit)
return await record.save(db, autocommit=False)

@jfcalvo jfcalvo merged commit c1ff075 into feat/support-record-status-filter Jul 1, 2024
2 checks passed
@jfcalvo jfcalvo deleted the feat/add-status-as-persisted-column-to-records branch July 1, 2024 08:53
@jfcalvo jfcalvo linked an issue Jul 1, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TASK] Add status column to records table
2 participants