force session commit in AddLogForJob() if no recent commit - 5 seconds
This commit is contained in:
2
TODO
2
TODO
@@ -1,7 +1,5 @@
|
|||||||
## GENERAL
|
## 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
|
* refimg
|
||||||
- remove AI menu from top-level -> make a sub-of Person, and just have Match or AI
|
- 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) ...
|
- store the face locations? (good for debugging later, and we calc them as part of GenFace anyway) ...
|
||||||
|
|||||||
@@ -409,6 +409,15 @@ def AddLogForJob(job, message):
|
|||||||
session.add(log)
|
session.add(log)
|
||||||
# some logs have DEBUG: in front, so clean that up
|
# some logs have DEBUG: in front, so clean that up
|
||||||
message = message.replace("DEBUG:", "" )
|
message = message.replace("DEBUG:", "" )
|
||||||
|
# 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}" )
|
print( f"DEBUG: {message}" )
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -1119,7 +1128,6 @@ def ProcessFilesInDir(job, e, file_func, count_dirs):
|
|||||||
else:
|
else:
|
||||||
d=session.query(Dir).filter(Dir.eid==e.id).first()
|
d=session.query(Dir).filter(Dir.eid==e.id).first()
|
||||||
if count_dirs:
|
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
|
job.current_file_num+=1
|
||||||
files = session.query(Entry).join(EntryDirLink).filter(EntryDirLink.dir_eid==d.eid).all()
|
files = session.query(Entry).join(EntryDirLink).filter(EntryDirLink.dir_eid==d.eid).all()
|
||||||
for sub in files:
|
for sub in files:
|
||||||
|
|||||||
Reference in New Issue
Block a user