endpoint
on the Endpoint
class. This allows you to use the following methods or instances variables from the Endpoint
class:
run
or synchronous runSync
method.
Choosing between asynchronous and synchronous execution hinges on your task’s needs and application design.
runSync
method on your endpoint. This method blocks the execution until the endpoint run is complete or until it times out.
run
method on the endpoint. This method allows you to start an endpoint run and then check its status or wait for its completion at a later time.
await endpoint.status(id)
to check the status of the operation repeatedly until it either completes or fails. After each check, the function waits for 5 seconds (or any other suitable duration you choose) before checking the status again, using the sleep function. This approach ensures your application remains responsive and doesn’t overwhelm the Runpod endpoint with status requests.
"return_aggregate_stream": True
option on the start
method of your Handler. Once enabled, use the stream
method to receive data as it becomes available.
status
method and specify the id
of the run to get the status of a run.
cancel()
function on the run request. You might want to cancel a Job because it’s stuck with a status of IN_QUEUE
or IN_PROGRESS
, or because you no longer need the result.
run
method. Time is measured in milliseconds.
policy
parameter.
purgeQueue()
function.
purgeQueue()
doesn’t affect Jobs in progress.