Funks package computation as Runnable values. Calling a staged funk records an execution DAG; its normalized runnable and DaggerML arguments form the cache identity. This page reads the durable artifact produced by the preceding page and runs one fixture-owned script path and one Docker path.
Run self-contained script work
A script worker receives persisted source, not the authoring interpreter’s imports or globals. Import dependencies inside the function, or explicitly inject source with extra_objs or post_lines.
import osfrom urllib.parse import urlparseimport daggerml as dmlfrom daggerml.contrib import api@api.funkify(tags=["course", "summary"])def summarize_artifact(dag, source):from daggerml.contrib.s3 import S3Store values = [int(value) for value in S3Store().get(source.value()).splitlines()[0].split(b",")]return {"count": len(values), "total": sum(values)}flags = []endpoint = os.environ.get("AWS_ENDPOINT_URL")if endpoint: parsed = urlparse(endpoint)if parsed.scheme =="http"and parsed.port isnotNone: flags += ["--add-host=host.docker.internal:host-gateway","-e",f"AWS_ENDPOINT_URL=http://host.docker.internal:{parsed.port}", ]for key in ("AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN", "AWS_REGION", "AWS_DEFAULT_REGION"):if value := os.environ.get(key): flags += ["-e", f"{key}={value}"]
Compose Docker work
Docker is an outer runnable wrapper around the inner script. Its image and flags are staged data, so they also participate in the execution boundary and identity.
Script execution and cache coordination require remote.root; Docker also needs Docker, S3 access at its execution boundary, and an image containing the script’s dependencies. The built-in choices are script and Docker through the local adapter, SSH-wrapped work through the local adapter, and AWS Batch through the Lambda adapter. SSH can source env_files; Batch additionally needs a Lambda integration, container image, queues, task role, and AWS credentials. Other schedulers or cloud integrations require an installed extension.