Skip to content

octue/example-service-kueue

Repository files navigation

example-service-kueue

An example Octue Twined service using Kubernetes/Kueue as the service backend. The service calculates the first n values in the Fibonacci sequence.

The infrastructure that runs this service can be found here. It depends on these Terraform modules:

Usage

Install the client

pip install octue

Usage

Authenticate with GCP

Download a key for a developer service account and set the GOOGLE_APPLICATION_CREDENTIALS environment variable:

export GOOGLE_APPLICATION_CREDENTIALS=/path/to/gcp-credentials.json

Interact with the service

Run the following python code:

from octue.twined.resources import Child


# Point to the data service
child = Child(
    id="octue/example-service-kueue:0.2.0",
    backend={"name": "GCPPubSubBackend", "project_id": "octue-twined-services"},
)

# Ask a question
answer, _ = child.ask(input_values={"n": 10}, timeout=3600)

# Access the output data
answer
>>> {
    "kind": "result",
    "output_values": {"fibonacci": [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]},
    "output_manifest": None,
}

About

An example Octue Twined data service using Kueue as the service backend.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages