lce_service.sf_tools_api.dispatch_tools module
- lce_service.sf_tools_api.dispatch_tools.dispatch_sf_tool(dbc: silo_cursor, appliance: Dict[str, Any], request: SFToolRequest, user: User) int
Queues a Snippet Framework tool run on a collector and returns its process id.
The job is recorded the way device_tools_run.inc records it: as the tool’s own Remote Toolbox tool id, against the first job’s device and with the first job’s application as the policy, so the platform’s toolbox history describes it the same way whichever way it was started. A wildcard has no id to record, so the platform’s “none” sentinel stands in for it.
- Parameters:
dbc – A silo_cursor instance used to queue the command and record its ownership.
appliance – The collecting appliance to run on, as resolve_sf_tool_collector returns it.
request – A validated SFToolRequest.
user – The User instance the queued command is attributed to.
- Returns:
The process id to poll for the tool’s output.
- Raises:
DatabaseExecutionError – Raised when the command cannot be queued or attributed.
- lce_service.sf_tools_api.dispatch_tools.run_sf_tool_locally(request: SFToolRequest) LocalRun
Runs a tool on this host, rather than queueing it, and waits for it to finish.
The command is the one dispatch_sf_tool queues, run the way the collector’s Remote Toolbox runs it, so its log and result read the same either way. Nothing is written to the spool or the ownership table: the output is answered directly and never has to be read back.
- Parameters:
request – A validated SFToolRequest.
- Returns:
The LocalRun of the tool.
- Raises:
InvalidToolboxRequestError – Raised when the command cannot be run as given.