def get_path_for_build_results_archive(self, build_id: int, is_tar_request: bool=False) -> str: """ Given a build id, get the absolute file path for the archive file containing the build results. :param build_id: The build id for which to retrieve the artifacts archive file :param is_tar_request: If true, download the tar.gz archive instead of a zip. :return: The path to the archived results file """ build = self._all_builds_by_id.get(build_id) # type: Build if build is None: raise ItemNotFoundError('Invalid build id.') archive_file = build.artifacts_tar_file if is_tar_request else build.artifacts_zip_file if archive_file is None: raise ItemNotReadyError('Build artifact file is not yet ready. Try again later.') return archive_file
def get_path_for_build_results_archive(self, build_id): """ Given a build id, get the absolute file path for the archive file containing the build results. :param build_id: The build id for which to retrieve the artifacts archive file :type build_id: int :return: The path to the archived results file :rtype: str """ build = self._all_builds_by_id.get(build_id) if build is None: raise ItemNotFoundError('Invalid build id.') archive_file = build.artifacts_archive_file if archive_file is None: raise ItemNotReadyError('Build artifact file is not yet ready. Try again later.') return archive_file
def get_events(since_timestamp=None, since_id=None): """ Retrieve all events from the current eventlog since the given timestamp or event id. This is used to expose events via the API and is useful for building dashboards that monitor the system. :param since_timestamp: Get all events after (greater than) this timestamp :type since_timestamp: float | None :param since_id: Get all events after (greater than) this id :type since_id: int | None :return: The list of events in the given range :rtype: list[dict] | None """ if _event_log: since_timestamp = float( since_timestamp) if since_timestamp else since_timestamp since_id = int(since_id) if since_id else since_id return _event_log.get_events(since_timestamp=since_timestamp, since_id=since_id) else: raise ItemNotReadyError( 'Analytics was not initialized. Call initialize first')