duplicity.backend_pool module
- class duplicity.backend_pool.BackendPool(url_string, processes=None)[source]
Bases:
objectuses concurrent.futures.ProcessPoolExecutor to run backend commands in background
- class CmdStatus(function_name: str, args: Dict, kwargs: List, trk_rcd: duplicity.backend_pool.TrackRecord | None = None, done: bool = False)[source]
Bases:
object- __init__(function_name: str, args: Dict, kwargs: List, trk_rcd: TrackRecord | None = None, done: bool = False) None
- args: Dict
- done: bool = False
- function_name: str
- kwargs: List
- trk_rcd: TrackRecord | None = None
- _collect_finished_cmds()[source]
store finished results in all_results and remove command from queue
- _raise_exception_if_any(track_rcrd)[source]
raise the exception stored in track_rcrd if it occurred while running the command
- command(func_name, args=(), kwds=None)[source]
run function in a pool of independent processes. Call function by name. func_name: name of the backend method to execute args: positional arguments for the method kwds: key/value arguments for the method
Returns a unique ID for each command, increasing int
- command_throttled(func_name, commands_in_buffer=1, args=(), kwds=None)[source]
block, if queue gets bigger then number of workers + commands_in_buffer. Means this function my block a while to process queue and returns if enough queue items has been processed. func_name: name of the backend method to execute commands_in_buffer = number of commands that are queue for execution args: positional arguments for the method kwds: key/value arguments for the method
Returns a unique ID for each command, increasing int
- results_since_last_call(from_pos=None) Iterator[TrackRecord][source]
collect results from commands finished since last run of this method. This method should be called from one receiver only, as it keep track of what was send internally. param:
from_pos: use to overwrite the internal pointer __last_results_reported
- return:
list of future results
- class duplicity.backend_pool.TrackRecord(track_id: int, pid: int, trace_back: Optional[List[str]] = <factory>, result: object = None, log_prefix: str = '', start_time: datetime.datetime = datetime.datetime(2025, 10, 30, 11, 12, 6, 960937), stop_time: datetime.datetime = datetime.datetime(1, 1, 1, 0, 0))[source]
Bases:
object- __init__(track_id: int, pid: int, trace_back: ~typing.List[str] | None = <factory>, result: object = None, log_prefix: str = '', start_time: ~datetime.datetime = datetime.datetime(2025, 10, 30, 11, 12, 6, 960937), stop_time: ~datetime.datetime = datetime.datetime(1, 1, 1, 0, 0)) None
- log_prefix: str = ''
- pid: int
- result: object = None
- start_time: datetime = datetime.datetime(2025, 10, 30, 11, 12, 6, 960937)
- stop_time: datetime = datetime.datetime(1, 1, 1, 0, 0)
- trace_back: List[str] | None
- track_id: int
- duplicity.backend_pool.track_cmd(track_id, cmd_name: str, *args, **kwargs)[source]
wraps the pooled function for time tracking and exception handling. Recording the trace back of an exception when still in process pool context to point to the right place. (This function can’t be part of the BackendPool, as then the whole class get pickled)