Skip to content

Commit

Permalink
Merge pull request #1008 from golemfactory/2088-outbound-network-docs
Browse files Browse the repository at this point in the history
Computation Payload Manifest documentation
  • Loading branch information
shadeofblue authored Nov 4, 2022
2 parents 74fe935 + 22e1928 commit 7f7ceb1
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion yapapi/payload/vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
logger = logging.getLogger(__name__)

VM_CAPS_VPN: str = "vpn"
VM_CAPS_MANIFEST_SUPPORT: str = "manifest-support"

VmCaps = Literal["vpn", "inet", "manifest-support"]

Expand Down Expand Up @@ -117,6 +118,35 @@ async def manifest(
min_cpu_threads: int = 1,
capabilities: Optional[List[VmCaps]] = None,
) -> Package:
"""
Build a reference to application payload.
:param manifest: base64 encoded Computation Payload Manifest https://handbook.golem.network/requestor-tutorials/vm-runtime/computation-payload-manifest
:param manifest_sig: an optional signature of of base64 encoded Computation Payload Manifest
:manifest_sig_algorithm: an optional signature algorithm, e.g. "sha256"
:manifest_cert: an optional base64 encoded public certificate (DER or PEM) matching key used to generate signature
:param min_mem_gib: minimal memory required to execute application code
:param min_storage_gib: minimal disk storage to execute tasks
:param min_cpu_threads: minimal available logical CPU cores
:param capabilities: an optional list of required VM capabilities
:return: the payload definition for the given VM image
example usage::
package = await vm.manifest(
manifest = open("manifest.json.base64", "r").read(),
)
example usage with a signed Computation Pyload Manifest and additional "inet" capability::
package = await vm.manifest(
manifest = open("manifest.json.base64", "r").read(),
manifest_sig = open("manifest.json.sig.base64", "r").read(),
manifest_sig_algorithm = "sha256",
manifest_cert = open("cert.der.base64", "r").read(),
capabilities = ["manifest-support", "inet"],
)
"""
capabilities = capabilities or list()
constraints = _VmConstraints(min_mem_gib, min_storage_gib, min_cpu_threads, capabilities)

Expand Down Expand Up @@ -164,7 +194,7 @@ async def repo(
:param min_mem_gib: minimal memory required to execute application code
:param min_storage_gib: minimal disk storage to execute tasks
:param min_cpu_threads: minimal available logical CPU cores
:param capabilities: an optional list of required vm capabilities
:param capabilities: an optional list of required VM capabilities
:return: the payload definition for the given VM image
example usage::
Expand Down

0 comments on commit 7f7ceb1

Please sign in to comment.