Skip to content

Commit

Permalink
Merge pull request #973 from biorack/untargeted_dev
Browse files Browse the repository at this point in the history
Untargeted dev
  • Loading branch information
bkieft-usa authored Nov 7, 2024
2 parents 5270a33 + 71d7379 commit 93e85cb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions metatlas/untargeted/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def upload_to_google_drive(
logging.critical(tab_print("Warning! Google Drive upload failed on upload with overwrite=%s with exception on command %s"%(overwrite, upload_command), 3))
return False
# Check that upload worked
check_upload_command = f'/global/cfs/cdirs/m342/USA/shared-envs/rclone/bin/rclone ls ben_lbl_gdrive:/untargeted_outputs | grep "{project_folder}"'
check_upload_command = f'/global/cfs/cdirs/m342/USA/shared-envs/rclone/bin/rclone ls ben_lbl_gdrive:/untargeted_outputs --max-depth 1 | grep "{project_folder}"'
try:
check_upload_out = subprocess.check_output(check_upload_command, shell=True)
if check_upload_out.decode('utf-8').strip():
Expand All @@ -479,7 +479,7 @@ def upload_to_google_drive(
return False
if overwrite == False:
# Overwrite is False, so first check if the project folder already exists on Google Drive
check_upload_command = f'/global/cfs/cdirs/m342/USA/shared-envs/rclone/bin/rclone ls ben_lbl_gdrive:/untargeted_outputs | grep "{project_folder}"'
check_upload_command = f'/global/cfs/cdirs/m342/USA/shared-envs/rclone/bin/rclone ls ben_lbl_gdrive:/untargeted_outputs --max-depth 1 | grep "{project_folder}"'
try:
check_upload_out = subprocess.check_output(check_upload_command, shell=True)
if check_upload_out.decode('utf-8').strip():
Expand All @@ -490,7 +490,7 @@ def upload_to_google_drive(
try:
subprocess.check_output(upload_command, shell=True)
try:
check_upload = f'/global/cfs/cdirs/m342/USA/shared-envs/rclone/bin/rclone ls ben_lbl_gdrive:/untargeted_outputs | grep "{project_folder}"'
check_upload = f'/global/cfs/cdirs/m342/USA/shared-envs/rclone/bin/rclone ls ben_lbl_gdrive:/untargeted_outputs --max-depth 1 | grep "{project_folder}"'
check_upload_out = subprocess.check_output(check_upload, shell=True)
if check_upload_out.decode('utf-8').strip():
logging.info(tab_print("Google Drive upload confirmed!", 3))
Expand Down Expand Up @@ -557,7 +557,7 @@ def get_untargeted_status(
return
if not df.empty:
# Get all projects in gdrive
all_gdrive_projects_cmd = f'/global/cfs/cdirs/m342/USA/shared-envs/rclone/bin/rclone lsl ben_lbl_gdrive:/untargeted_outputs'
all_gdrive_projects_cmd = f'/global/cfs/cdirs/m342/USA/shared-envs/rclone/bin/rclone lsl ben_lbl_gdrive:/untargeted_outputs --max-depth 1'
try:
all_gdrive_projects = subprocess.check_output(all_gdrive_projects_cmd, shell=True)
all_gdrive_projects_list = all_gdrive_projects.decode('utf-8').strip().split('\n')
Expand Down Expand Up @@ -665,6 +665,8 @@ def download_fbmn_results(
polarity_short = polarity[:3]
if row['%s_%s_status'%(tasktype,polarity_short)] == '12 not relevant':
continue
if row['%s_%s_status'%(tasktype,polarity_short)] != '07 complete' and row['%s_%s_status'%("mzmine",polarity_short)] != '07 complete':
continue # skip this polarity even if the other one is finished
if row['%s_%s_status'%(tasktype,polarity_short)] == '09 error':
logging.warning(tab_print("Warning! FBMN task for %s %s has error status. Not downloading files."%(project_name,polarity), 1))
continue
Expand Down

0 comments on commit 93e85cb

Please sign in to comment.