diff --git a/TODO b/TODO index bfe1bf7..ffda7fe 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,5 @@ ## GENERAL - * with any job, count logs, then commit per 100 log lines of a job (and then ditch the commit in import dir for this) - * refimg - remove AI menu from top-level -> make a sub-of Person, and just have Match or AI - store the face locations? (good for debugging later, and we calc them as part of GenFace anyway) ... diff --git a/pa_job_manager.py b/pa_job_manager.py index c0d7421..751d01b 100644 --- a/pa_job_manager.py +++ b/pa_job_manager.py @@ -409,7 +409,16 @@ def AddLogForJob(job, message): session.add(log) # some logs have DEBUG: in front, so clean that up message = message.replace("DEBUG:", "" ) - print( f"DEBUG: {message}" ) + # if its been more than 5 seconds since our last log, then commit to the DB to show some progress + if hasattr(job, 'last_commit'): + if (now - job.last_commit).seconds > 5: + job.last_commmit=now + print( "DELME: we have taken longer than 5 seconds since last commit so do it") + session.commit() + else: + job.last_commit = now + if DEBUG: + print( f"DEBUG: {message}" ) return def RunJob(job): @@ -1119,7 +1128,6 @@ def ProcessFilesInDir(job, e, file_func, count_dirs): else: d=session.query(Dir).filter(Dir.eid==e.id).first() if count_dirs: - print( f"{e.name} about to add 1 to cfn for a dir, {job.current_file_num}" ) job.current_file_num+=1 files = session.query(Entry).join(EntryDirLink).filter(EntryDirLink.dir_eid==d.eid).all() for sub in files: