@@ -497,6 +497,7 @@ def test_predict_forward_time(self):
497497 def test_plan_partition_changes_no_empty_partitions (self ):
498498 with self .assertRaises (NoEmptyPartitionsAvailableException ):
499499 _plan_partition_changes (
500+ Table ("table" ),
500501 [mkPPart ("p_20201231" , 0 ), mkPPart ("p_20210102" , 200 )],
501502 mkPos (50 ),
502503 datetime (2021 , 1 , 1 , tzinfo = timezone .utc ),
@@ -505,8 +506,9 @@ def test_plan_partition_changes_no_empty_partitions(self):
505506 )
506507
507508 def test_plan_partition_changes_imminent (self ):
508- with self .assertLogs ("plan_partition_changes" , level = "INFO" ) as logctx :
509+ with self .assertLogs ("plan_partition_changes:table " , level = "INFO" ) as logctx :
509510 planned = _plan_partition_changes (
511+ Table ("table" ),
510512 [
511513 mkPPart ("p_20201231" , 100 ),
512514 mkPPart ("p_20210102" , 200 ),
@@ -521,7 +523,7 @@ def test_plan_partition_changes_imminent(self):
521523 self .assertEqual (
522524 logctx .output ,
523525 [
524- "INFO:plan_partition_changes:Start-of-fill predicted at "
526+ "INFO:plan_partition_changes:table: Start-of-fill predicted at "
525527 "2021-01-03 which is not 2021-01-02. This change will be marked "
526528 "as important to ensure that p_20210102: (200) is moved to "
527529 "2021-01-03"
@@ -545,8 +547,9 @@ def test_plan_partition_changes_imminent(self):
545547 )
546548
547549 def test_plan_partition_changes_wildly_off_dates (self ):
548- with self .assertLogs ("plan_partition_changes" , level = "INFO" ) as logctx :
550+ with self .assertLogs ("plan_partition_changes:table " , level = "INFO" ) as logctx :
549551 planned = _plan_partition_changes (
552+ Table ("table" ),
550553 [
551554 mkPPart ("p_20201231" , 100 ),
552555 mkPPart ("p_20210104" , 200 ),
@@ -561,7 +564,7 @@ def test_plan_partition_changes_wildly_off_dates(self):
561564 self .assertEqual (
562565 logctx .output ,
563566 [
564- "INFO:plan_partition_changes:Start-of-fill predicted at "
567+ "INFO:plan_partition_changes:table: Start-of-fill predicted at "
565568 "2021-01-02 which is not 2021-01-04. This change will be marked "
566569 "as important to ensure that p_20210104: (200) is moved to "
567570 "2021-01-02"
@@ -583,6 +586,7 @@ def test_plan_partition_changes_wildly_off_dates(self):
583586
584587 def test_plan_partition_changes_long_delay (self ):
585588 planned = _plan_partition_changes (
589+ Table ("table" ),
586590 [
587591 mkPPart ("p_20210101" , 100 ),
588592 mkPPart ("p_20210415" , 200 ),
@@ -610,6 +614,7 @@ def test_plan_partition_changes_long_delay(self):
610614 def test_plan_partition_changes_short_names (self ):
611615 self .maxDiff = None
612616 planned = _plan_partition_changes (
617+ Table ("table" ),
613618 [
614619 mkPPart ("p_2019" , 1912499867 ),
615620 mkPPart ("p_2020" , 8890030931 ),
@@ -651,6 +656,7 @@ def test_plan_partition_changes_short_names(self):
651656
652657 def test_plan_partition_changes_bespoke_names (self ):
653658 planned = _plan_partition_changes (
659+ Table ("table" ),
654660 [mkPPart ("p_start" , 100 ), mkTailPart ("p_future" )],
655661 mkPos (50 ),
656662 datetime (2021 , 1 , 6 , tzinfo = timezone .utc ),
@@ -686,6 +692,7 @@ def test_plan_partition_changes_bespoke_names(self):
686692 def test_plan_partition_changes (self ):
687693 self .maxDiff = None
688694 planned = _plan_partition_changes (
695+ Table ("table" ),
689696 [
690697 mkPPart ("p_20201231" , 100 ),
691698 mkPPart ("p_20210102" , 200 ),
@@ -710,6 +717,7 @@ def test_plan_partition_changes(self):
710717
711718 self .assertEqual (
712719 _plan_partition_changes (
720+ Table ("table" ),
713721 [
714722 mkPPart ("p_20201231" , 100 ),
715723 mkPPart ("p_20210102" , 200 ),
@@ -739,6 +747,7 @@ def test_plan_partition_changes_misprediction(self):
739747 match reality. """
740748 self .maxDiff = None
741749 planned = _plan_partition_changes (
750+ Table ("table" ),
742751 [
743752 mkPPart ("p_20210505" , 9505010028 ),
744753 mkPPart ("p_20210604" , 10152257517 ),
@@ -770,25 +779,32 @@ def test_plan_partition_changes_misprediction(self):
770779 def test_should_run_changes (self ):
771780 self .assertFalse (
772781 _should_run_changes (
773- [ChangePlannedPartition (mkPPart ("p_20210102" , 200 )).set_position ([300 ])]
782+ Table ("table" ),
783+ [
784+ ChangePlannedPartition (mkPPart ("p_20210102" , 200 )).set_position (
785+ [300 ]
786+ )
787+ ],
774788 )
775789 )
776790
777791 self .assertFalse (
778792 _should_run_changes (
793+ Table ("table" ),
779794 [
780795 ChangePlannedPartition (mkPPart ("p_20210102" , 200 )).set_position (
781796 [300 ]
782797 ),
783798 ChangePlannedPartition (mkPPart ("p_20210109" , 1000 )).set_position (
784799 [1300 ]
785800 ),
786- ]
801+ ],
787802 )
788803 )
789- with self .assertLogs ("should_run_changes" , level = "DEBUG" ) as logctx :
804+ with self .assertLogs ("should_run_changes:table " , level = "DEBUG" ) as logctx :
790805 self .assertTrue (
791806 _should_run_changes (
807+ Table ("table" ),
792808 [
793809 ChangePlannedPartition (mkPPart ("p_20210102" , 200 )).set_position (
794810 [302 ]
@@ -802,17 +818,21 @@ def test_should_run_changes(self):
802818 NewPlannedPartition ()
803819 .set_position ([662 ])
804820 .set_timestamp (datetime (2021 , 1 , 23 , tzinfo = timezone .utc )),
805- ]
821+ ],
806822 )
807823 )
808824 self .assertEqual (
809825 logctx .output ,
810- ["DEBUG:should_run_changes:Add: [542] 2021-01-16 " "00:00:00+00:00 is new" ],
826+ [
827+ "DEBUG:should_run_changes:table:Add: [542] 2021-01-16 "
828+ "00:00:00+00:00 is new"
829+ ],
811830 )
812831
813- with self .assertLogs ("should_run_changes" , level = "DEBUG" ) as logctx :
832+ with self .assertLogs ("should_run_changes:table " , level = "DEBUG" ) as logctx :
814833 self .assertTrue (
815834 _should_run_changes (
835+ Table ("table" ),
816836 [
817837 ChangePlannedPartition (mkPPart ("p_20210102" , 200 )),
818838 NewPlannedPartition ()
@@ -821,12 +841,15 @@ def test_should_run_changes(self):
821841 NewPlannedPartition ()
822842 .set_position ([662 ])
823843 .set_timestamp (datetime (2021 , 1 , 23 , tzinfo = timezone .utc )),
824- ]
844+ ],
825845 )
826846 )
827847 self .assertEqual (
828848 logctx .output ,
829- ["DEBUG:should_run_changes:Add: [542] 2021-01-16 " "00:00:00+00:00 is new" ],
849+ [
850+ "DEBUG:should_run_changes:table:Add: [542] 2021-01-16 "
851+ "00:00:00+00:00 is new"
852+ ],
830853 )
831854
832855 def testgenerate_sql_reorganize_partition_commands_no_change (self ):
@@ -976,6 +999,7 @@ def test_plan_andgenerate_sql_reorganize_partition_commands_with_future_partitio
976999 self
9771000 ):
9781001 planned = _plan_partition_changes (
1002+ Table ("table" ),
9791003 [
9801004 mkPPart ("p_20201231" , 100 ),
9811005 mkPPart ("p_20210104" , 200 ),
@@ -999,7 +1023,7 @@ def test_plan_andgenerate_sql_reorganize_partition_commands_with_future_partitio
9991023
10001024 def test_get_pending_sql_reorganize_partition_commands_no_changes (self ):
10011025 with self .assertLogs (
1002- "get_pending_sql_reorganize_partition_commands" , level = "INFO"
1026+ "get_pending_sql_reorganize_partition_commands:plushies " , level = "INFO"
10031027 ) as logctx :
10041028 cmds = get_pending_sql_reorganize_partition_commands (
10051029 table = Table ("plushies" ),
@@ -1017,7 +1041,7 @@ def test_get_pending_sql_reorganize_partition_commands_no_changes(self):
10171041 self .assertEqual (
10181042 logctx .output ,
10191043 [
1020- "INFO:get_pending_sql_reorganize_partition_commands:"
1044+ "INFO:get_pending_sql_reorganize_partition_commands:plushies: "
10211045 "Table plushies does not need to be modified currently."
10221046 ],
10231047 )
@@ -1026,7 +1050,7 @@ def test_get_pending_sql_reorganize_partition_commands_no_changes(self):
10261050
10271051 def test_get_pending_sql_reorganize_partition_commands_with_changes (self ):
10281052 with self .assertLogs (
1029- "get_pending_sql_reorganize_partition_commands" , level = "DEBUG"
1053+ "get_pending_sql_reorganize_partition_commands:plushies " , level = "DEBUG"
10301054 ) as logctx :
10311055 cmds = get_pending_sql_reorganize_partition_commands (
10321056 table = Table ("plushies" ),
@@ -1044,7 +1068,7 @@ def test_get_pending_sql_reorganize_partition_commands_with_changes(self):
10441068 self .assertEqual (
10451069 logctx .output ,
10461070 [
1047- "DEBUG:get_pending_sql_reorganize_partition_commands:"
1071+ "DEBUG:get_pending_sql_reorganize_partition_commands:plushies: "
10481072 "Table plushies has changes waiting."
10491073 ],
10501074 )
0 commit comments