From a0f91d02fe873b358dedbe3680282bc6d11de7f9 Mon Sep 17 00:00:00 2001 From: Tien Tong Date: Fri, 11 Oct 2024 22:22:20 -0400 Subject: [PATCH] fix self.output_ria_path and actual_output_ria_data_dir os.readlink returns path prepended with that will fail assert op.exists() --- babs/babs.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/babs/babs.py b/babs/babs.py index 372e3e9a..7f99c8a9 100644 --- a/babs/babs.py +++ b/babs/babs.py @@ -2,6 +2,7 @@ import os import os.path as op +from urllib.parse import urlparse import subprocess import warnings import pandas as pd @@ -206,7 +207,7 @@ def wtf_key_info(self, flag_output_ria_only=False): # ^^ another way to change the wd temporarily: add `cwd=self.xxx` in `subprocess.run()` # if success: no output; if failed: will raise CalledProcessError proc_output_ria_data_dir.check_returncode() - self.output_ria_data_dir = proc_output_ria_data_dir.stdout.decode('utf-8') + self.output_ria_data_dir = urlparse(proc_output_ria_data_dir.stdout.decode('utf-8')).path if self.output_ria_data_dir[-1:] == "\n": # remove the last 2 characters self.output_ria_data_dir = self.output_ria_data_dir[:-1] @@ -777,8 +778,9 @@ def babs_check_setup(self, input_ds, flag_job_test): # the one in `self` attr is directly got from `analysis` remote, # so should not use that here. # output_ria: - actual_output_ria_data_dir = os.readlink( - op.join(self.output_ria_path, "alias/data")) # get the symlink of `alias/data` + actual_output_ria_data_dir = urlparse(os.readlink( + op.join(self.output_ria_path, "alias/data") + )).path # get the symlink of `alias/data` then change to path assert op.exists(actual_output_ria_data_dir) # make sure this exists # get '000/0000-0000-0000-0000': data_foldername = op.join(