httk.workflow.adapters¶
Versioned JSON remote-adapter bundles.
Attributes¶
Classes¶
Resolved remote bundle. |
Functions¶
|
Return the UUID and current root reported for a remote workspace name. |
|
Return the application settings a remote seeds a workspace with. |
|
Return the metadata file of one adapter bundle. |
|
Read the metadata of one adapter bundle. |
|
Validate static adapter metadata and the single dispatcher executable. |
|
Validate and return one remote name. |
|
Resolve project-local before global remote definitions. |
|
Return where one project keeps its remotes. |
|
List definitions with project entries shadowing global entries. |
|
Copy one maintained adapter template into user/project data. |
|
Partition |
|
Read remote credentials that never enter a project manifest. |
|
Merge settings into the manifest-excluded remote credentials. |
|
Return persisted remote settings with credentials merged back in. |
|
Map a recognizable legacy executable bundle to the versioned contract. |
|
Execute one JSON adapter operation without invoking a shell. |
Module Contents¶
- httk.workflow.adapters.ADAPTER_OPERATIONS = ('configure', 'install', 'invoke', 'push', 'pull', 'status')¶
- httk.workflow.adapters.ADAPTER_EXECUTABLE = 'adapter'¶
- httk.workflow.adapters.CREDENTIALS_FILE = 'credentials.json'¶
- httk.workflow.adapters.METADATA_FILE = 'remote.json'¶
- httk.workflow.adapters.ADAPTER_FORMAT = 'httk-computer-adapter'¶
- httk.workflow.adapters.REQUEST_FORMAT = 'httk-computer-request'¶
- httk.workflow.adapters.RESULT_FORMAT = 'httk-computer-result'¶
- httk.workflow.adapters.PERSISTABLE_REMOTE_SETTINGS¶
- httk.workflow.adapters.REMOTE_WORKSPACE_INIT_COMMAND = ('httk', 'workspace', 'init')¶
- httk.workflow.adapters.REMOTE_WORKSPACE_DELETE_COMMAND = ('httk', 'workspace', 'delete')¶
- httk.workflow.adapters.REMOTE_WORKSPACE_FSCK_COMMAND = ('httk', 'workspace', 'fsck')¶
- httk.workflow.adapters.REMOTE_WORKSPACE_GC_COMMAND = ('httk', 'workspace', 'gc')¶
- httk.workflow.adapters.REMOTE_WORKSPACE_LIST_COMMAND = ('httk', 'workspace', 'list')¶
- httk.workflow.adapters.REMOTE_WORKSPACE_MOVE_COMMAND = ('httk', 'workspace', 'move')¶
- httk.workflow.adapters.REMOTE_RECEIVE_COMMAND = ('httk', 'workflow', 'transfer', 'receive')¶
- httk.workflow.adapters.REMOTE_OFFER_COMMAND = ('httk', 'workflow', 'transfer', 'offer')¶
- httk.workflow.adapters.REMOTE_RETIRE_COMMAND = ('httk', 'workflow', 'transfer', 'retire')¶
- httk.workflow.adapters.REMOTE_STATUS_COMMAND = ('httk', 'workspace', 'status')¶
- httk.workflow.adapters.REMOTE_WORKSPACE_SETTINGS_COMMAND = ('httk', 'workspace', 'settings')¶
- httk.workflow.adapters.REMOTE_WORKSPACE_WORKFLOW_PRELUDE_COMMAND = ('httk', 'workspace', 'workflow-prelude')¶
- httk.workflow.adapters.REMOTE_MANAGER_COMMAND = ('httk', 'workflow', 'manager', 'run')¶
- httk.workflow.adapters.REMOTE_JOB_REQUEST_ENVELOPES_COMMAND = ('httk', 'job', 'request-envelopes')¶
- httk.workflow.adapters.REMOTE_JOB_PUBLISH_REQUESTS_COMMAND = ('httk', 'job', 'publish-requests')¶
- httk.workflow.adapters.REMOTE_JOB_LIST_COMMAND = ('httk', 'job', 'list')¶
- httk.workflow.adapters.REMOTE_JOB_DELETE_COMMAND = ('httk', 'job', 'delete')¶
- httk.workflow.adapters.REMOTE_JOB_SHOW_COMMAND = ('httk', 'job', 'show')¶
- httk.workflow.adapters.REMOTE_JOB_LOG_COMMAND = ('httk', 'job', 'log')¶
- httk.workflow.adapters.REMOTE_JOB_WHY_COMMAND = ('httk', 'job', 'why')¶
- httk.workflow.adapters.probe_remote_workspace(target, name, *, timeout, noun='workspace', adapter=None)¶
Return the UUID and current root reported for a remote workspace name.
- Parameters:
target (RemoteTarget) – The resolved remote adapter bundle.
name (str) – The remote workspace name.
timeout (float | None) – The adapter operation timeout.
noun (str) – The noun used in diagnostic messages.
adapter (collections.abc.Callable[Ellipsis, dict[str, Any]] | None) – The adapter callable, or
run_adapter()when omitted.
- Returns:
The remote workspace identifier and root.
- Raises:
RuntimeError – If the remote status operation fails.
ValueError – If the remote returns an incompatible status document.
- Return type:
- httk.workflow.adapters.SEED_SETTING_MAP: collections.abc.Mapping[str, str]¶
- httk.workflow.adapters.seed_application_settings(bundle)¶
Return the application settings a remote seeds a workspace with.
- class httk.workflow.adapters.RemoteTarget¶
Resolved remote bundle.
- Parameters:
name – The remote name.
bundle – The resolved adapter bundle path.
project_local – Whether the bundle came from project data.
- bundle: pathlib.Path¶
- httk.workflow.adapters.metadata_path(bundle)¶
Return the metadata file of one adapter bundle.
- Parameters:
bundle (str | os.PathLike[str]) – The adapter bundle path.
- Returns:
The bundle metadata path.
- Return type:
- httk.workflow.adapters.read_metadata(bundle)¶
Read the metadata of one adapter bundle.
- Parameters:
bundle (str | os.PathLike[str]) – The adapter bundle path.
- Returns:
The decoded metadata document.
- Raises:
ValueError – If the metadata cannot be read as an object.
- Return type:
- httk.workflow.adapters.validate_adapter_bundle(bundle)¶
Validate static adapter metadata and the single dispatcher executable.
- Parameters:
bundle (str | os.PathLike[str]) – The adapter bundle path.
- Returns:
The validated metadata document.
- Raises:
ValueError – If metadata, the dispatcher, or a required binary is invalid or unavailable.
- Return type:
- httk.workflow.adapters.valid_remote_name(name)¶
Validate and return one remote name.
- Parameters:
name (str) – The remote name to validate.
- Returns:
The validated remote name.
- Raises:
httk.workflow.errors.ResolutionMiss – If the name is not valid for remote resolution.
- Return type:
- httk.workflow.adapters.resolve_remote(value, *, project=None)¶
Resolve project-local before global remote definitions.
- Parameters:
value (str) – The remote name to resolve.
project (str | os.PathLike[str] | None) – The project path, or the discovered project when omitted.
- Returns:
The resolved remote target.
- Raises:
httk.workflow.errors.ResolutionMiss – If the name is invalid or no bundle is found.
- Return type:
- httk.workflow.adapters.project_remote_roots(project_root)¶
Return where one project keeps its remotes.
- Parameters:
project_root (pathlib.Path) – The project root.
- Returns:
The project remote roots in precedence order.
- Return type:
tuple[pathlib.Path, Ellipsis]
- httk.workflow.adapters.list_remotes(project=None)¶
List definitions with project entries shadowing global entries.
- httk.workflow.adapters.add_remote(name, *, template, global_scope=False, project=None)¶
Copy one maintained adapter template into user/project data.
- Parameters:
- Returns:
The newly created adapter bundle path.
- Raises:
ValueError – If the name, template, or scope is invalid.
FileExistsError – If the destination already exists.
- Return type:
- httk.workflow.adapters.split_settings(settings)¶
Partition
--setvalues into persistable settings and credentials.
- httk.workflow.adapters.read_credentials(bundle)¶
Read remote credentials that never enter a project manifest.
- Parameters:
bundle (str | os.PathLike[str]) – The adapter bundle path.
- Returns:
The stored credential document, or an empty mapping when absent.
- Raises:
ValueError – If the credentials file is not a JSON object.
- Return type:
- httk.workflow.adapters.store_credentials(bundle, settings)¶
Merge settings into the manifest-excluded remote credentials.
- Parameters:
bundle (str | os.PathLike[str]) – The adapter bundle path.
settings (collections.abc.Mapping[str, str]) – Credential members to merge.
- Returns:
The credentials file path.
- Raises:
ValueError – If the existing credentials file is invalid.
- Return type:
- httk.workflow.adapters.remote_settings(bundle)¶
Return persisted remote settings with credentials merged back in.
- Parameters:
bundle (str | os.PathLike[str]) – The adapter bundle path.
- Returns:
Persisted settings and manifest-excluded credentials.
- Raises:
ValueError – If adapter metadata or credentials are invalid.
- Return type:
- httk.workflow.adapters.import_v1_remote(source, *, name=None, global_scope=False, project=None)¶
Map a recognizable legacy executable bundle to the versioned contract.
Legacy shell programs are never copied or executed. Only their simple assignment-only
configfiles are read, and the result uses a maintained v2 adapter implementation. What is read is an httk v1 computer definition, so the legacy names below are the names that tree really uses.- Parameters:
source (str | os.PathLike[str]) – The legacy executable bundle path.
name (str | None) – The imported remote name, or the source directory name when omitted.
global_scope (bool) – Whether to create the imported remote in global data.
project (str | os.PathLike[str] | None) – The project path for a project-local import.
- Returns:
The created versioned adapter bundle path.
- Raises:
ValueError – If the legacy bundle cannot be recognized or imported.
- Return type:
- httk.workflow.adapters.run_adapter(bundle, operation, request, *, timeout=None)¶
Execute one JSON adapter operation without invoking a shell.
- Parameters:
bundle (str | os.PathLike[str]) – The adapter bundle path.
operation (str) – The adapter operation name.
request (collections.abc.Mapping[str, object]) – The operation request members.
timeout (float | None) – The operation timeout, or the bundle default when omitted.
- Returns:
The adapter result document.
- Raises:
TimeoutError – If the adapter exceeds its timeout.
ValueError – If the request or result violates the adapter protocol.
RuntimeError – If the adapter refuses or fails the operation.
- Return type: