diff --git a/pa_job_manager.py b/pa_job_manager.py index 4af3ff1..e886c9b 100644 --- a/pa_job_manager.py +++ b/pa_job_manager.py @@ -358,6 +358,7 @@ def JobsForPaths( parent_job, paths, ptype ): if parent_job: AddLogForJob(parent_job, "adding job id={} {} (wait for: {})".format( job3.id, job3.id, job3.name, job3.wait_for ) ) """ + ### FIXME: wait for job3 not job2! job4=Job(start_time=now, last_update=now, name="checkdups", state="New", wait_for=job2.id, pa_job_state="New", current_file_num=0 ) session.add(job4) session.commit() @@ -797,13 +798,10 @@ def JobImportDir(job): overall_file_cnt+= len(subdirs) + len(files) path_obj.num_files=overall_file_cnt - # this is needed so that later on, when we AddDir for any dirs we find via os.walk, they have a parent dir object that is the dir for the path we are in - parent_dir=session.query(Dir).join(PathDirLink).join(Path).filter(Path.id==path_obj.id,Dir.rel_path=='').first() - - # first time through we need dir to be the top level, we have a special if below to no recreate the top dir that AddPath created already - dir=parent_dir + # find the dir we created with AddPath to use for entries at top-level of path + dir=session.query(Dir).join(PathDirLink).join(Path).filter(Path.id==path_obj.id,Dir.rel_path=='').first() # session.add in case we already have imported this dir (as AddDir wont) & now we might have diff num of files to last time, - session.add(parent_dir) + session.add(dir) # if we set / then commit this now, the web page will know how many files # to process as we then do the slow job of processing them @@ -817,6 +815,7 @@ def JobImportDir(job): if root != path: pp=SymlinkName( path_obj.type.name, path, root )+'/'+os.path.basename(root) rel_path=pp.replace(symlink+'/','') + parent_dir=session.query(Dir).join(PathDirLink).join(Path).filter(Path.id==path_obj.id,Dir.rel_path==os.path.dirname(rel_path)).first() dir=AddDir(job, os.path.basename(root), parent_dir, rel_path, path_obj) for basename in files: # commit every 100 files to see progress being made but not hammer the database @@ -847,7 +846,6 @@ def JobImportDir(job): job.current_file_num+=1 job.current_file_num += len(subdirs) dir.last_import_date = time.time() - parent_dir=dir job.num_files=overall_file_cnt rm_cnt=HandleAnyFSDeletions(job)