@@ -937,7 +937,7 @@ def parse_messages_response(self, response):
937937 for line in response .iter_lines ():
938938 string_message = line .decode ("utf-8" )
939939 string_messages .append (string_message [string_message .index ('=' ) + 1 :])
940- print (string_messages [len (string_messages )- 1 ])
940+ print (string_messages [len (string_messages ) - 1 ])
941941 return string_messages
942942
943943 def get_columns (self , table_name , * , only_names = True , verbose = False ):
@@ -1031,20 +1031,23 @@ def get_datalabs_path(self, filename, default_volume=None):
10311031 path = self ._get_decoded_string (string = job ["file_path" ][0 ])
10321032 path_parsed = path .split ("hstdata/" , 1 )[1 ]
10331033
1034- # Automatic fill: convert /hstdata/hstdata_i/i/b4x/04 to /data/user/hub_hstdata_i/i/b4x/04
1035- if default_volume is None :
1036- full_path = "/data/user/hub_" + path_parsed + "/" + filename
1037- file_exists = os .path .exists (full_path )
1034+ for datalabs_path in ["/data/user/" , "/data/" ]:
1035+ # Automatic fill: convert /hstdata/hstdata_i/i/b4x/04 to <datalabs_path>/hub_hstdata_i/i/b4x/04
1036+ if default_volume is None :
1037+ full_path = datalabs_path + "hub_" + path_parsed + "/" + filename
1038+
1039+ # Use the path provided by the user: convert /hstdata/hstdata_i/i/b4x/04 to <datalabs_path>/myPath/i/b4x/04
1040+ else :
1041+ trimmed_path = path_parsed .split ("/" , 1 )[1 ]
1042+ full_path = datalabs_path + default_volume + "/" + trimmed_path + "/" + filename
10381043
1039- # Use the path provided by the user: convert /hstdata/hstdata_i/i/b4x/04 to /data/user/myPath/i/b4x/04
1040- else :
1041- path_parsed = path_parsed .split ("/" , 1 )[1 ]
1042- full_path = "/data/user/" + default_volume + "/" + path_parsed + "/" + filename
10431044 file_exists = os .path .exists (full_path )
10441045
1045- if not file_exists :
1046- warnings .warn (f"File { filename } is not accessible. Please ensure the { instrument_name } "
1047- "volume is mounted in your ESA Datalabs instance." )
1046+ if file_exists :
1047+ return full_path
1048+
1049+ warnings .warn (f"File { filename } is not accessible. Please ensure the { instrument_name } "
1050+ "volume is mounted in your ESA Datalabs instance." )
10481051 return full_path
10491052
10501053
0 commit comments