5. Debugpanel API Reference

5.1. lockss.debugpanel

Library and command line tool to interact with the LOCKSS 1.x DebugPanel servlet.

class lockss.debugpanel.Node(node_reference, u, p)

Connector to a LOCKSS 1.x node.

Parameters:
  • node_reference (str)

  • u (str)

  • p (str)

DEFAULT_PROTOCOL = 'http'
authenticate(req)

Does what is necessary to authenticate with the given Request object.

Parameters:

req (Request) -- A Request instance.

Return type:

None

get_url()

Returns the full URL corresponding to this node (with protocol but no final slash).

Returns:

The full URL corresponding to this node.

Return type:

str

type lockss.debugpanel.RequestUrlOpenT = Any
lockss.debugpanel.check_substance(node, auid)

Performs the DebugPanel servlet "Check Substance" operation on the given node for the given AUID.

Parameters:
  • node (Node) -- A Node instance.

  • auid (str) -- An AUID.

Returns:

The result of urllib.request.urlopen.

Return type:

RequestUrlOpenT

Raises:

Exception -- Whatever urllib.request.urlopen might raise.

lockss.debugpanel.crawl(node, auid)

Performs the DebugPanel servlet "Force Start Crawl" operation on the given node for the given AUID.

Parameters:
  • node (Node) -- A Node instance.

  • auid (str) -- An AUID.

Returns:

The result of urllib.request.urlopen.

Return type:

RequestUrlOpenT

Raises:

Exception -- Whatever urllib.request.urlopen might raise.

lockss.debugpanel.crawl_plugins(node)

Performs the DebugPanel servlet "Crawl Plugins" operation on the given node.

Parameters:

node (Node) -- A Node instance.

Returns:

The result of urllib.request.urlopen.

Return type:

RequestUrlOpenT

Raises:

Exception -- Whatever urllib.request.urlopen might raise.

lockss.debugpanel.deep_crawl(node, auid, depth=123)

Performs the DebugPanel servlet "Force Deep Crawl" operation on the given node for the given AUID, with the given depth (default DEFAULT_DEPTH).

Parameters:
  • node (Node) -- A Node instance.

  • auid (int) -- An AUID.

  • depth (int) -- A strictly positive refetch depth.

Returns:

The result of urllib.request.urlopen.

Return type:

RequestUrlOpenT

Raises:
  • ValueError -- If depth is negative or zero.

  • Exception -- Whatever urllib.request.urlopen might raise.

lockss.debugpanel.disable_indexing(node, auid)

Performs the DebugPanel servlet "Disable Indexing" operation on the given node for the given AUID.

Parameters:
  • node (Node) -- A Node instance.

  • auid (str) -- An AUID.

Returns:

The result of urllib.request.urlopen.

Return type:

RequestUrlOpenT

Raises:

Exception -- Whatever urllib.request.urlopen might raise.

lockss.debugpanel.node(node_reference, u, p)

DEPRECATED: Constructs a new Node instance (see the Node constructor); THIS FUNCTION WILL BE REMOVED IN VERSION 0.9.0.

Parameters:
  • node_reference (str) -- See the Node constructor.

  • u (str) -- See the Node constructor.

  • p (str) -- See the Node constructor.

Returns:

See the Node constructor.

Return type:

Node

lockss.debugpanel.poll(node, auid)

Performs the DebugPanel servlet "Start V3 Poll" operation on the given node for the given AUID.

Parameters:
  • node (Node) -- A Node instance.

  • auid (str) -- An AUID.

Returns:

The result of urllib.request.urlopen.

Return type:

RequestUrlOpenT

Raises:

Exception -- Whatever urllib.request.urlopen might raise.

lockss.debugpanel.reindex_metadata(node, auid)

Performs the DebugPanel servlet "Force Reindex Metadata" operation on the given node for the given AUID.

Parameters:
  • node (Node) -- A Node instance.

  • auid (str) -- An AUID.

Returns:

The result of urllib.request.urlopen.

Return type:

RequestUrlOpenT

Raises:

Exception -- Whatever urllib.request.urlopen might raise.

lockss.debugpanel.reload_config(node)

Performs the DebugPanel servlet "Reload Config" operation on the given node.

Parameters:

node (Node) -- A Node instance.

Returns:

The result of urllib.request.urlopen.

Return type:

RequestUrlOpenT

Raises:

Exception -- Whatever urllib.request.urlopen might raise.

lockss.debugpanel.validate_files(node, auid)

Performs the DebugPanel servlet "Validate Files" operation on the given node for the given AUID.

Parameters:
  • node (Node) -- A Node instance.

  • auid (str) -- An AUID.

Returns:

The result of urllib.request.urlopen.

Return type:

RequestUrlOpenT

Raises:

Exception -- Whatever urllib.request.urlopen might raise.

5.2. lockss.debugpanel.cli

Command line tool to interact with the LOCKSS 1.x DebugPanel servlet.

type cli.RequestUrlOpenT = Any
lockss.debugpanel.cli._AUID_COMMANDS = Section(AUID commands, is_sorted=False)

A subcommand section for AUID commands.

lockss.debugpanel.cli._DEFAULT_JOB_POOL_TYPE: _JobPoolType = _JobPoolType.THREAD_POOL

The default _JobPoolType.

class lockss.debugpanel.cli._DebugPanelCli(ctx)

DebugPanel command line application.

Parameters:

ctx (ExtraContext)

_auids: list[str] | None
_ctx: ExtraContext
_do_auid_command(node_auid_func, **kwargs)

Performs one AUID-centric command.

Parameters:

node_auid_func (Callable[[Node, str], RequestUrlOpenT]) -- A function that applies to a Node and an AUID and returns what urllib.request.urlopen returns.

Return type:

None

_do_node_command(node_func, **kwargs)

Performs one node-centric command.

Parameters:

node_func (Callable[[Node], RequestUrlOpenT]) -- A function that applies to a Node and returns what urllib.request.urlopen returns.

Return type:

None

_executor: Executor | None
_initialize_auid_operation()

Initializes for an AUID-centric operation. Fails if the list of AUIDs ends up being empty.

Return type:

None

_initialize_node_operation()

Initializes for a node-centric operation. Fails if the list of nodes ends up being empty.

Return type:

None

_nodes: list[str] | None
_opts: _Opts | None
check_substance()

Implementation of the check-substance command.

Return type:

None

crawl()

Implementation of the crawl command.

Return type:

None

crawl_plugins()

Implementation of the crawl-plugins command.

Return type:

None

deep_crawl()

Implementation of the deep-crawl command.

Return type:

None

disable_indexing()

Implementation of the disable-indexing command.

Return type:

None

dispatch(method, **cli_kwargs)

Initializes from the given command line options and invokes the given (bound) method.

Parameters:
  • method (Callable[[], None]) -- A (bound) method.

  • cli_kwargs (dict[str, Any]) -- The command line arguments passed by Click Extra.

Return type:

None

poll()

Implementation of the poll command.

Return type:

None

reindex_metadata()

Implementation of the reindex-metadata command.

Return type:

None

reload_config()

Implementation of the reload-config command.

Return type:

None

validate_files()

Implementation of the validate-files command.

Return type:

None

class lockss.debugpanel.cli._JobPoolType(*values)

An enum of job pool types.

PROCESS_POOL = 'process-pool'
THREAD_POOL = 'thread-pool'
lockss.debugpanel.cli._NODE_COMMANDS = Section(Node commands, is_sorted=False)

A subcommand section for node commands.

class lockss.debugpanel.cli._Opts(*, node=(), nodes=(), u=None, username=None, p=None, password=None, auid=(), auids=(), depth=None, pool_size=None, pool_type=None, process_pool=False, thread_pool=False, headings=None, progress=None, table_format=None)

Data class to hold parsed command line options.

Parameters:
  • node (tuple[str, ...])

  • nodes (tuple[Path, ...])

  • u (str | None)

  • username (str | None)

  • p (str | None)

  • password (str | None)

  • auid (tuple[str, ...])

  • auids (tuple[Path, ...])

  • depth (int | None)

  • pool_size (int | None)

  • pool_type (_JobPoolType | None)

  • process_pool (bool)

  • thread_pool (bool)

  • headings (bool | None)

  • progress (bool | None)

  • table_format (TableFormat | None)

auid: tuple[str, ...] = ()
auids: tuple[Path, ...] = ()
depth: int | None = None
headings: bool | None = None
node: tuple[str, ...] = ()
nodes: tuple[Path, ...] = ()
p: str | None = None
password: str | None = None
pool_size: int | None = None
pool_type: _JobPoolType | None = None
process_pool: bool = False
progress: bool | None = None
table_format: TableFormat | None = None
thread_pool: bool = False
u: str | None = None
username: str | None = None
lockss.debugpanel.cli._auid_operation(decorated)

The composite AUID operation decorator.

lockss.debugpanel.cli._auid_option_group(f)

The AUID option group: --auid/-a, --auids/-A

Parameters:

f (F)

Return type:

F

lockss.debugpanel.cli._depth_option_group(f)

The depth option group: --depth/-d

Parameters:

f (F)

Return type:

F

lockss.debugpanel.cli._node_operation(decorated)

The composite node operation decorator.

lockss.debugpanel.cli._node_option_group(f)

The node option group: --node/-n, --nodes/-N, --username/-U, --password/-P

Parameters:

f (F)

Return type:

F

lockss.debugpanel.cli._output_option_group(f)

The output option group: --headings/--no-headings, --progress/--no-progress, --table-format/-T

Parameters:

f (F)

Return type:

F

lockss.debugpanel.cli._pool_option_group(f)

The job pool option group: --pool-size, --pool-type

Parameters:

f (F)

Return type:

F

lockss.debugpanel.cli.main()

Main entry point of the module.

Return type:

None