Log
The model log is useful for debugging a model and for optimizing model performance.
HubitLog
dataclass
Hubit log. For each query, various run data such as the number of workers spawned and the executions time is added to the log as a LogItem as the first element.
Often your simply want to print the log for a HubitModel
instance e.g.
print(hmodel.log())
.
get_all(self, attr)
Get all log item values corresponding to attribute name attr
.
Examples:
To get the elapsed time for all queries on the HubitModel
instance
hmodel
execute hmodel.log().get_all("elapsed_time")
. If two queries
has been executed on the model, the return value
is a list of times e.g. [0.5028373999812175, 0.6225477000162937]
where the first element represent the elapsed time for for latest
query.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
attr |
str |
Valid values are attributes names of the LogItem class. |
required |
Returns:
Type | Description |
---|---|
List |
Log item values for |
LogItem
dataclass
Hubit log item. Keys in all attribute dicts (e.g.
worker_counts
and cache_counts
) are the same.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
elapsed_time |
float |
Query execution time |
required |
worker_counts |
Dict[str, int] |
For each component function name the value is the count of spawned workers. |
required |
cache_counts |
Dict[str, int] |
For each component function name the value is the number of workers that used the cache. |
required |