Commit c9eb439
[NA] [SDK] fix: address review comments on dataset insert deduplication (#8115)
* [NA] [SDK] fix: address review comments on dataset insert deduplication
Follow-up to #8113.
- `_parallel_insert_supported` cached a probe that failed to reach the backend
as `False`, which pinned the dataset to sequential uploads for the rest of the
session. Only a conclusive answer is cached now; an unreachable backend is
re-probed on the next insert, while a version that cannot be parsed still
caches since it will not change.
- Test suites listed by `get_test_suites` kept `_hashes_synced=True` with an
empty hash set, so the first deduplicated insert compared against nothing and
resubmitted items the suite already held. They now start unsynced, matching
`get_datasets` and `get_test_suite`.
- Reject a non-bool `deduplication`, so a truthy string or `None` cannot
silently select the wrong duplicate-checking behaviour.
- Note the resync cost of `deduplication=False` in the `insert` docstring.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(dataset): gate worker count in the insert funnel and test dedup by behaviour
Addresses the review comments on the follow-up.
- The parallel-upload version gate moves from `insert` into
`__internal_api__insert_items_as_dataclasses__`, so a direct caller passing
`num_threads > 1` can no longer reach the thread pool against a backend that
races on batches sharing a batch_group_id.
- The probe-recovery test now spies on `_send_batches` and asserts the worker
count that actually reached the upload, instead of only counting probes.
- The listed-suite regression test now inserts an item the suite already holds
and asserts it is left out of the REST batch, rather than inspecting the
private `_hashes_synced` flag.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(dataset): validate num_threads at the insert funnel and assert real uploads
- The funnel compared `num_threads > 1` before checking its type, so a direct
caller passing a non-orderable value got a `TypeError` from the gate rather
than the `ValueError` naming the argument. It now validates both parameters
it consumes.
- The sequential-gate test spied on `_send_batches` without calling through, so
it only covered argument plumbing. It now calls through and asserts every
item still reached the backend exactly once.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* docs(dataset): document the ValueError raised by insert's argument checks
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent b903f52 commit c9eb439
4 files changed
Lines changed: 301 additions & 22 deletions
File tree
- sdks/python
- src/opik/api_objects/dataset
- tests/unit/api_objects/dataset
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
356 | 361 | | |
357 | 362 | | |
358 | 363 | | |
| |||
611 | 616 | | |
612 | 617 | | |
613 | 618 | | |
614 | | - | |
| 619 | + | |
615 | 620 | | |
616 | 621 | | |
617 | 622 | | |
618 | 623 | | |
619 | 624 | | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | | - | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
626 | 633 | | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
627 | 637 | | |
628 | 638 | | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
629 | 648 | | |
630 | 649 | | |
631 | 650 | | |
632 | 651 | | |
633 | 652 | | |
634 | 653 | | |
635 | | - | |
| 654 | + | |
636 | 655 | | |
637 | 656 | | |
638 | | - | |
639 | | - | |
640 | | - | |
641 | | - | |
642 | | - | |
643 | | - | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
648 | 657 | | |
649 | 658 | | |
| 659 | + | |
650 | 660 | | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
651 | 671 | | |
| 672 | + | |
652 | 673 | | |
653 | 674 | | |
654 | 675 | | |
| |||
718 | 739 | | |
719 | 740 | | |
720 | 741 | | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
721 | 761 | | |
722 | 762 | | |
723 | 763 | | |
| |||
756 | 796 | | |
757 | 797 | | |
758 | 798 | | |
759 | | - | |
| 799 | + | |
| 800 | + | |
760 | 801 | | |
761 | 802 | | |
762 | 803 | | |
763 | 804 | | |
764 | 805 | | |
765 | 806 | | |
766 | 807 | | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
767 | 812 | | |
768 | 813 | | |
769 | 814 | | |
770 | 815 | | |
771 | 816 | | |
772 | | - | |
773 | | - | |
774 | | - | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
775 | 820 | | |
776 | 821 | | |
777 | 822 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
287 | 291 | | |
288 | 292 | | |
289 | 293 | | |
| |||
Lines changed: 142 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
551 | 552 | | |
552 | 553 | | |
553 | 554 | | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
554 | 696 | | |
555 | 697 | | |
556 | 698 | | |
| |||
0 commit comments