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.
- start(total_files, total_size, total_drpms=0)
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. total_drpms is the total number of drpms payloads in the batch.
- progress(payload, done)
Report ongoing progress on the given payload. done is the number of bytes already downloaded from payload.
- 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.
- 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
Appearance*
PKG_CLEANUP
package cleanup is being performed.
3
PKG_DOWNGRADE
package is being installed as a downgrade.
2
PKG_DOWNGRADED
installed package is being downgraded.
2
PKG_INSTALL
package is being installed.
2
PKG_OBSOLETE
package is obsoleting another package.
2
PKG_OBSOLETED
installed package is being obsoleted.
2
PKG_REINSTALL
package is installed as a reinstall.
2
PKG_REINSTALLED
installed package is being reinstalled.
2
PKG_REMOVE
package is being removed.
2
PKG_UPGRADE
package is installed as an upgrade.
2
PKG_UPGRADED
installed package is being upgraded.
2
PKG_VERIFY
package is being verified.
5
PKG_SCRIPTLET
package scriptlet is being performed.
Anytime
TRANS_PREPARATION
transaction is being prepared.
1
TRANS_POST
The post-trans phase started. In this case, all the other arguments are
None
.4
*This is order in which state of transaction which callback action can appear. Only PKG_SCRIPTLET can appear anytime during transaction even before transaction starts.
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.