Skip to content
This repository has been archived by the owner on Oct 10, 2022. It is now read-only.

Commit

Permalink
Utility for platesolving options logging
Browse files Browse the repository at this point in the history
  • Loading branch information
GuLinux committed Jun 21, 2020
1 parent 9f52fae commit 546187b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions backend/platesolving/platesolving.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,16 @@ def __img_to_fits(self, temp_file, destination, remove=False):
except UnidentifiedImageError:
return False

def __platesolving_options_log(self, options):
return str(['{}: {}'.format(key, '<blob>' if key == 'fileBuffer' else value) for key, value in options.items()])


def __start_solver(self, options):
temp_path = os.path.join(StaticSettings.ASTROMETRY_TEMP_PATH, 'solve_field_{}'.format(time.time()))
os.makedirs(temp_path, exist_ok=True)

fits_file_path = None
logger.debug('Solve field options: %s', str(['{}: {}'.format(key, '<blob>' if key == 'fileBuffer' else value) for key, value in options.items()]))
logger.debug('Solve field options: %s', self.__platesolving_options_log(options))
if 'fileBuffer' in options:
data = base64.b64decode(options['fileBuffer'][options['fileBuffer'].find(PlateSolving.DATAURL_SEPARATOR) + len(PlateSolving.DATAURL_SEPARATOR):])
fits_file_path = self.__data_to_fits(data, temp_path)
Expand Down Expand Up @@ -202,7 +205,7 @@ def __wait_for_solution(self, options, resolution, fits_file_path, temp_path):
else:
raise FailedMethodError('Plate solving failed, check astrometry driver log')
except Exception as e:
logger.warning('Error running platesolver with options {}'.format(options), exc_info=e)
logger.warning('Error running platesolver with options {}'.format(self.__platesolving_options_log(options)), exc_info=e)
self.__set_status('error')
return {
'status': 'error',
Expand Down

0 comments on commit 546187b

Please sign in to comment.