Progress Reporting with Callbacks

class dnf.callback.Payload

Represents one item (file) from the download batch.

__str__()

Provide concise, human-readable representation of this Payload.

download_size()

Total size of this Payload when transferred (e.g. over network).

class dnf.callback.DownloadProgress

Base class providing callbacks to receive information about an ongoing download.

end(payload, status, msg)

Report finished download of a payload, Payload instance. status is a constant with the following meaning:

status value meaning
STATUS_OK Download finished successfully.
STATUS_DRPM DRPM rebuilt successfully.
STATUS_ALREADY_EXISTS Download skipped because the local file already exists.
STATUS_MIRROR Download failed on the current mirror, will try to use next mirror in the list.
STATUS_FAILED Download failed because of another error.

msg is an optional string error message further explaining the status.

progress(payload, done)

Report ongoing progress on the given payload. done is the number of bytes already downloaded from payload.

start(total_files, total_size)

Report start of a download batch. total_files is the total number of payloads in the batch. total_size is the total number of bytes to be downloaded.

class dnf.callback.TransactionProgress

Base class providing callbacks to receive information about an ongoing transaction.

error(message)

Report an error that occurred during the transaction. message is a string which describes the error.

progress(package, action, ti_done, ti_total, ts_done, ts_total)

Report ongoing progress on the given transaction item. package is the dnf.package.Package being processed and action is a constant with the following meaning:

action value meaning
PKG_CLEANUP package cleanup is being performed.
PKG_DOWNGRADE package is being downgraded.
PKG_INSTALL package is being installed.
PKG_OBSOLETE package is being obsoleted.
PKG_REINSTALL package is being reinstalled.
PKG_REMOVE package is being removed.
PKG_UPGRADE package is being upgraded.
PKG_VERIFY package is being verified.
TRANS_POST The post-trans phase started. In this case, all the other arguments are None.

ti_done is the number of processed bytes of the transaction item, ti_total is the total number of bytes of the transaction item, ts_done is the number of actions processed in the whole transaction and ts_total is the total number of actions in the whole transaction.