© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
RunpodR
Runpod•3y ago•
4 replies
abtx

How do indicated job status in a handler?

For example in https://docs.runpod.io/serverless/workers/handlers/handler-async
import runpod
import asyncio


async def async_generator_handler(job):
    for i in range(5):
        # Generate an asynchronous output token
        output = f"Generated async token output {i}"
        yield output

        # Simulate an asynchronous task, such as processing time for a large language model
        await asyncio.sleep(1)


# Configure and start the RunPod serverless function
runpod.serverless.start(
    {
        "handler": async_generator_handler,  # Required: Specify the async handler
        "return_aggregate_stream": True,  # Optional: Aggregate results are accessible via /run endpoint
    }
)
import runpod
import asyncio


async def async_generator_handler(job):
    for i in range(5):
        # Generate an asynchronous output token
        output = f"Generated async token output {i}"
        yield output

        # Simulate an asynchronous task, such as processing time for a large language model
        await asyncio.sleep(1)


# Configure and start the RunPod serverless function
runpod.serverless.start(
    {
        "handler": async_generator_handler,  # Required: Specify the async handler
        "return_aggregate_stream": True,  # Optional: Aggregate results are accessible via /run endpoint
    }
)


Dopes the job status automatically becomes "COMPLETED" after
async_generator_handler
async_generator_handler
returns? In general how do you update the status of the job in runpod python sdk?

What I am trying to achieve is to use a single machine at a time for training purposes. I am not sure 1 hour long POST request is a good idea. How should this be done?
Asynchronous Handler | RunPod Documentation
RunPod supports the use of asynchronous handlers, enabling efficient handling of tasks that benefit from non-blocking operations. This feature is particularly useful for tasks like processing large datasets, interacting with APIs, or handling I/O-bound operations.
Asynchronous Handler | RunPod Documentation
Runpod banner
RunpodJoin
We're a community of enthusiasts, engineers, and enterprises, all sharing insights on AI, Machine Learning and GPUs!
21,906Members
Sponsored
morphllm
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Continue the conversation

Join the Discord to ask follow-up questions and connect with the community

RunpodR

Runpod

We're a community of enthusiasts, engineers, and enterprises, all sharing insights on AI, Machine Learning and GPUs!

21,906 Members

Join

Similar Threads

Possible error in docs: Status of a job with python code
RunpodRRunpod / ⚡|serverless
3y ago
How do I write handler for /run
RunpodRRunpod / ⚡|serverless
3y ago
Managing webhook auth & changes of job status
RunpodRRunpod / ⚡|serverless
7mo ago
How do I estimate completion time (ETA) of a job request?
RunpodRRunpod / ⚡|serverless
3y ago