logger
sc_crawler.logger
#
log_start_end
#
Log the start and end of the decorated function.
Source code in sc_crawler/logger.py
ScRichHandler
#
Bases: RichHandler
Extend RichHandler with function name logged in the right column.
Source code in sc_crawler/logger.py
VendorProgressTracker
#
Tracking the progress of the vendor's inventory updates.
Source code in sc_crawler/logger.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
|
task_ids
class-attribute
instance-attribute
#
List of active task ids for the current vendor
.
vendor
instance-attribute
#
vendor = vendor
A sc_crawler.tables.Vendor instance for which tracking progress.
progress_panel
instance-attribute
#
progress_panel = progress_panel
A rich
panel including progress bars.
Should not be used directly, see the vendors
, tasks
and metadata
attributes.
vendors
instance-attribute
#
rich.progress.Progress for tracking the inventory steps of the vendor.
tasks
instance-attribute
#
rich.progress.Progress for tracking the lower-level tasks within each step.
metadata
instance-attribute
#
rich.text.Text metadata, e.g. data sources and records to be udpated.
start_vendor
#
Starts a progress bar for the Vendor's steps.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
total |
int
|
Overall number of steps to show in the progress bar. |
required |
Returns:
Name | Type | Description |
---|---|---|
TaskId |
TaskID
|
The progress bar's identifier to be referenced in future updates. |
Source code in sc_crawler/logger.py
advance_vendor
#
Increment the number of finished steps.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
advance |
int
|
Number of steps to advance. |
1
|
update_vendor
#
Update the vendor's progress bar.
Useful fields:
- step
: Name of the currently running step to be shown on the progress bar.
start_task
#
Starts a progress bar in the list of current jobs.
Besides returning the TaskID
, it will also register in self.tasks.task_ids
as the last task, which will be the default value for future advance_task
,
hide_task
etc calls. The latter will remove the TaskID
from the task_ids
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Name to show in front of the progress bar. Will be prefixed by Vendor's name. |
required |
total |
int
|
Overall number of steps to show in the progress bar. |
required |
Returns:
Name | Type | Description |
---|---|---|
TaskId |
TaskID
|
The progress bar's identifier to be referenced in future updates. |
Source code in sc_crawler/logger.py
last_task
#
advance_task
#
Increment the number of finished steps.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id |
Optional[TaskID]
|
The progress bar's identifier returned by |
None
|
advance |
int
|
Number of steps to advance. |
1
|
Source code in sc_crawler/logger.py
update_task
#
Update the task's progress bar.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id |
Optional[TaskID]
|
The progress bar's identifier returned by |
None
|
Other Parameters:
Name | Type | Description |
---|---|---|
step |
str
|
Name of the currently running step to be shown on the progress bar. |
See rich.progress.Progress.update
for further keyword arguments.
Source code in sc_crawler/logger.py
hide_task
#
Hide a task from the list of progress bars.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id |
Optional[TaskID]
|
The progress bar's identifier returned by |
None
|
Source code in sc_crawler/logger.py
VoidProgressTracker
#
Bases: VendorProgressTracker
Progress tracker reference not doing antyhing.