Skip to content

DownloadFileService

Handles FITS download workflow.

backend.services.download_file_service.DownloadFileService

Service responsible for: - Identifying files that need downloading - downloading raw files - updating lifecycle states - managing download retries

download_files_by_downlink(instrument, downlink_start_utc, downlink_end_utc)

Download files within a given downlink time frame and instrument.

:param instrument: Instrument used for observation :param downlink_start_utc: start timestamp :param downlink_end_utc: end timestamp :return: number of files downloaded successfully.

download_files_by_observation

download_files_by_observation(instrument, observation_start_utc, observation_end_utc, cancel_event)

download files within an observation time period and instrument.

:param instrument: Instrument used for observation :param observation_start_utc: start timestamp :param observation_end_utc: end timestamp :return: number of files downloaded successfully.

download_files_by_slots

download_files_by_slots(instrument, slots, cancel_event)

Downloads files corresponding to slots and given instrument.

  • fetch metadata for slot range
  • identify potential files for download
  • identify eligible files for download (retry + new)
  • perform parallel download

:param instrument: instrument used for observation :param slots: list of slot domain entities :return: returns number of successfully downloaded files.

get_downloaded_files_by_time

get_downloaded_files_by_time(instrument, download_start_utc, download_end_utc)

returns downloaded files between a time window

:param instrument: instrument used for observation :param download_start_utc: start timestamp :param download_end_utc: end timestamp :return: list of process file entities

recover_stale_files

recover_stale_files(now_utc, instrument)

Recovers files stuck in intermediate states DOWNLOADING by marking them as failed if they exceed allowed timeout.

:param now_utc: current UTC timestamp :return: number of files recovered.