Commit cecaaeb4 authored by Aaron Petkau's avatar Aaron Petkau

Merge branch 'monitor-fix' into 'development'

fixed directory monitoring from scanning to deep + readonly checking

See merge request !54
parents 65d5ba1d cc8f3734
Pipeline #7234 passed with stage
in 7 minutes and 16 seconds
......@@ -86,20 +86,27 @@ def search_for_upload(directory, cond):
.miseqUploaderInfo files.
"""
global toMonitor
for root, dirs, files in os.walk(directory, topdown=True):
for name in dirs:
checkForCompJob = os.path.join(root, name, "CompletedJobInfo.xml")
checkForMiSeq = os.path.join(root, name, ".miseqUploaderInfo")
if os.path.isfile(checkForCompJob):
if not os.path.isfile(checkForMiSeq):
path_to_upload = checkForCompJob
if toMonitor:
on_created(path_to_upload, cond)
# After upload, start back at the start of directories
return
# Check each step of loop if monitoring is still required
if not toMonitor:
if not os.access(directory, os.W_OK):
logging.warning("Could not access directory while monitoring for samples, directory is not writeable {}".format(directory))
return
root = next(os.walk(directory))[0]
dirs = next(os.walk(directory))[1]
for name in dirs:
check_for_comp_job = os.path.join(root, name, "CompletedJobInfo.xml")
check_for_miseq = os.path.join(root, name, ".miseqUploaderInfo")
if os.path.isfile(check_for_comp_job):
if not os.path.isfile(check_for_miseq):
path_to_upload = check_for_comp_job
if toMonitor:
on_created(path_to_upload, cond)
# After upload, start back at the start of directories
return
# Check each step of loop if monitoring is still required
if not toMonitor:
return
return
def stop_monitoring():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment