Skip to content

Interactive fleet Sample - #502

Open
Luke-Roy-IBM wants to merge 1 commit into
mainfrom
interactive-fleet
Open

Luke-Roy-IBM wants to merge 1 commit into
mainfrom
interactive-fleet

Conversation

@Luke-Roy-IBM

Copy link
Copy Markdown
Member

interactive-fleets — new sample

Adds serverless-fleets/interactive-fleets, a general-purpose submit-and-poll pattern
that turns any Code Engine Fleet workload into a synchronous HTTP API.

What it does

A Code Engine Function acts as an HTTP gateway to a fleet:

  • POST / or GET / — accepts arbitrary JSON input (or query parameters), generates a task ID,
    submits the input as a fleet task, and polls COS for the result for up to POLL_TIMEOUT seconds.
    Returns HTTP 200 with the result if it arrives in time, or HTTP 202 with a retrieve_url
    if the poll window expires.
  • GET /result/{task_id} — retrieves a previously submitted result from COS at any time.

The fleet task receives the full input payload as a single JSON string in $1, processes it,
and writes the result to a COS-mounted path. No message queue, no polling infrastructure —
just a function, a fleet, and a COS bucket.

What's included

File Description
deploy Single script — builds task image, creates fleet, creates secret, deploys function
function/__main__.py Python CE Function — routing, IAM token exchange, fleet task submission, COS polling
task-container/entrypoint.sh Sample enrichment worker — receives JSON in $1, adds metadata, writes result to COS mount
task-container/Dockerfile ubi-minimal + bash + jq + util-linux
README.md Architecture diagram, curl examples, configuration reference, customisation guide

Authentication

A single IBM Cloud API key (CE_API_KEY) is used for both the CE Fleet API and COS access
via IAM Bearer tokens.

Use cases

This pattern can be adapted for any fleet workload that needs an HTTP interface:
ML inference, document processing, data transformation, external API orchestration, or any
batch job that produces a result file.

@Luke-Roy-IBM
Luke-Roy-IBM force-pushed the interactive-fleet branch 2 times, most recently from b8f70bd to b26d79e Compare October 9, 2026 07:04
Signed-off-by: Luke Roy <luke.roy@ibm.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant