Skip to content

Commit

Permalink
better error catch, set completion to decimal percentage to match oth…
Browse files Browse the repository at this point in the history
…er functions, changed logging message to use class function
  • Loading branch information
LTDakin committed Jun 25, 2024
1 parent 2c7c1a9 commit b52d7df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions datalab/datalab_session/data_operations/data_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def get_percent_completion(self) -> float:

def set_output(self, output_data: dict):
self.set_status('COMPLETED')
self.set_percent_completion(100.0)
self.set_percent_completion(1.0)
cache.set(f'operation_{self.cache_key}_output', output_data, CACHE_DURATION)

def get_output(self) -> dict:
Expand Down Expand Up @@ -145,7 +145,7 @@ def get_fits_npdata(self, input_files: list[dict], percent=None, cur_percent=Non

try:
fits_url = archive_record[0].get('url', 'No URL found')
except Exception as e:
except IndexError as e:
raise FileNotFoundError(f"No image found with specified basename: {basename} Error: {e}")

with fits.open(fits_url) as hdu_list:
Expand Down
2 changes: 1 addition & 1 deletion datalab/datalab_session/data_operations/median.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ def operate(self):
else:
output = {'output_files': []}

log.info(f'Median operation output: {output}')
self.set_percent_completion(1.0)
self.set_output(output)
log.info(f'Median output: {self.get_output()}')

0 comments on commit b52d7df

Please sign in to comment.