@@ -1027,17 +1027,37 @@ def get_datalabs_path(self, filename, default_volume=None):
1027
1027
if job is None :
1028
1028
return None
1029
1029
1030
+ query2 = f"select observation_id from ehst.artifact where file_name = '{ filename } '"
1031
+ job2 = self .query_tap (query = query2 )
1032
+ if job2 is None :
1033
+ return None
1034
+
1035
+ observation_id = job2 ["observation_id" ][0 ]
1036
+ query3 = f"select instrument_name from ehst.observation where observation_id = '{ observation_id } '"
1037
+ job3 = self .query_tap (query = query3 )
1038
+ if job3 is None :
1039
+ return None
1040
+
1041
+ instrument_name = job3 ["instrument_name" ][0 ]
1042
+
1030
1043
# Output example for path: /hstdata/hstdata_i/i/b4x/04, or hstdata_i/i/b4x/04 for path_parsed
1031
1044
path = self ._get_decoded_string (string = job ["file_path" ][0 ])
1032
1045
path_parsed = path .split ("hstdata/" , 1 )[1 ]
1033
1046
1034
1047
# Automatic fill: convert /hstdata/hstdata_i/i/b4x/04 to /data/user/hub_hstdata_i/i/b4x/04
1035
1048
if default_volume is None :
1036
- return "/data/user/hub_" + path_parsed + "/" + filename
1037
-
1049
+ full_path = "/data/user/hub_" + path_parsed + "/" + filename
1050
+ file_exists = os .path .exists (full_path )
1051
+
1038
1052
# Use the path provided by the user: convert /hstdata/hstdata_i/i/b4x/04 to /data/user/myPath/i/b4x/04
1039
- path_parsed = path_parsed .split ("/" , 1 )[1 ]
1040
- return "/data/user/" + default_volume + "/" + path_parsed + "/" + filename
1053
+ else :
1054
+ path_parsed = path_parsed .split ("/" , 1 )[1 ]
1055
+ full_path = "/data/user/" + default_volume + "/" + path_parsed + "/" + filename
1056
+ file_exists = os .path .exists (full_path )
1057
+
1058
+ if not file_exists :
1059
+ print (f"File '{ filename } ' is not accessible. Please ensure the '{ instrument_name } ' volume is mounted in your ESA Datalabs instance." )
1060
+ return full_path
1041
1061
1042
1062
1043
1063
ESAHubble = ESAHubbleClass ()
0 commit comments