File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -601,20 +601,15 @@ def cleanup_jobs(self):
601601
602602 This cleanup should not need to run very often, but helps maintain database consistency.
603603 """
604- invalid_removed = 0
605-
606- incomplete_query = (
607- self .jobs & {"table_name" : self .target .table_name } & "status != 'success'"
608- )
609- if incomplete_query :
604+ removed = 0
605+ if len (self .jobs ):
610606 keys2do = self ._jobs_to_do ({}).fetch ("KEY" )
611- invalid_incomplete = len (incomplete_query ) - len (keys2do )
612- if invalid_incomplete > 0 :
613- for key , job_key in zip (* incomplete_query .fetch ("KEY" , "key" )):
607+ if len (self .jobs ) - len (keys2do ) > 0 :
608+ for key , job_key in zip (* self .jobs .fetch ("KEY" , "key" )):
614609 if job_key not in keys2do :
615610 (self .jobs & key ).delete ()
616- invalid_removed += 1
611+ removed += 1
617612
618613 logger .info (
619- f"{ invalid_removed } invalid jobs removed for `{ to_camel_case (self .target .table_name )} `"
614+ f"{ removed } invalid jobs removed for `{ to_camel_case (self .target .table_name )} `"
620615 )
You can’t perform that action at this time.
0 commit comments