Skip to content

Commit

Permalink
feat: enable speakeasy retries (#201)
Browse files Browse the repository at this point in the history
This commit enables the [speakeasy
retries](https://www.speakeasy.com/docs/customize-sdks/retries#global-retries)
feature for the SDKs.
  • Loading branch information
rickstaa authored Sep 13, 2024
1 parent 1b4f93c commit caa4bb7
Show file tree
Hide file tree
Showing 9 changed files with 145 additions and 60 deletions.
8 changes: 7 additions & 1 deletion runner/app/routes/audio_to_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ def handle_pipeline_error(e: Exception) -> JSONResponse:
operation_id="genAudioToText",
summary="Audio To Text",
tags=["generate"],
openapi_extra={"x-speakeasy-name-override": "audioToText"},
openapi_extra={
"x-speakeasy-name-override": "audioToText",
"x-speakeasy-retries": {
"strategy": "backoff",
"statusCodes": ["503"],
},
},
)
@router.post(
"/audio-to-text/",
Expand Down
8 changes: 7 additions & 1 deletion runner/app/routes/image_to_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@
operation_id="genImageToImage",
summary="Image To Image",
tags=["generate"],
openapi_extra={"x-speakeasy-name-override": "imageToImage"},
openapi_extra={
"x-speakeasy-name-override": "imageToImage",
"x-speakeasy-retries": {
"strategy": "backoff",
"statusCodes": ["503"],
},
},
)
@router.post(
"/image-to-image/",
Expand Down
8 changes: 7 additions & 1 deletion runner/app/routes/image_to_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@
operation_id="genImageToVideo",
summary="Image To Video",
tags=["generate"],
openapi_extra={"x-speakeasy-name-override": "imageToVideo"},
openapi_extra={
"x-speakeasy-name-override": "imageToVideo",
"x-speakeasy-retries": {
"strategy": "backoff",
"statusCodes": ["503"],
},
},
)
@router.post(
"/image-to-video/",
Expand Down
8 changes: 7 additions & 1 deletion runner/app/routes/segment_anything_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@
operation_id="genSegmentAnything2",
summary="Segment Anything 2",
tags=["generate"],
openapi_extra={"x-speakeasy-name-override": "segmentAnything2"},
openapi_extra={
"x-speakeasy-name-override": "segmentAnything2",
"x-speakeasy-retries": {
"strategy": "backoff",
"statusCodes": ["503"],
},
},
)
@router.post(
"/segment-anything-2/",
Expand Down
8 changes: 7 additions & 1 deletion runner/app/routes/text_to_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,13 @@ class TextToImageParams(BaseModel):
operation_id="genTextToImage",
summary="Text To Image",
tags=["generate"],
openapi_extra={"x-speakeasy-name-override": "textToImage"},
openapi_extra={
"x-speakeasy-name-override": "textToImage",
"x-speakeasy-retries": {
"strategy": "backoff",
"statusCodes": ["503"],
}
}
)
@router.post(
"/text-to-image/",
Expand Down
8 changes: 7 additions & 1 deletion runner/app/routes/upscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@
operation_id="genUpscale",
summary="Upscale",
tags=["generate"],
openapi_extra={"x-speakeasy-name-override": "upscale"},
openapi_extra={
"x-speakeasy-name-override": "upscale",
"x-speakeasy-retries": {
"strategy": "backoff",
"statusCodes": ["503"],
},
},
)
@router.post(
"/upscale/",
Expand Down
26 changes: 25 additions & 1 deletion runner/gateway.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.1.0
info:
title: Livepeer AI Runner
description: An application to run AI pipelines
version: v0.2.0
version: v0.3.0
servers:
- url: https://dream-gateway.livepeer.cloud
description: Livepeer Cloud Community Gateway
Expand Down Expand Up @@ -57,6 +57,10 @@ paths:
security:
- HTTPBearer: []
x-speakeasy-name-override: textToImage
x-speakeasy-retries:
strategy: backoff
statusCodes:
- '503'
/image-to-image:
post:
tags:
Expand Down Expand Up @@ -105,6 +109,10 @@ paths:
security:
- HTTPBearer: []
x-speakeasy-name-override: imageToImage
x-speakeasy-retries:
strategy: backoff
statusCodes:
- '503'
/image-to-video:
post:
tags:
Expand Down Expand Up @@ -153,6 +161,10 @@ paths:
security:
- HTTPBearer: []
x-speakeasy-name-override: imageToVideo
x-speakeasy-retries:
strategy: backoff
statusCodes:
- '503'
/upscale:
post:
tags:
Expand Down Expand Up @@ -201,6 +213,10 @@ paths:
security:
- HTTPBearer: []
x-speakeasy-name-override: upscale
x-speakeasy-retries:
strategy: backoff
statusCodes:
- '503'
/audio-to-text:
post:
tags:
Expand Down Expand Up @@ -255,6 +271,10 @@ paths:
security:
- HTTPBearer: []
x-speakeasy-name-override: audioToText
x-speakeasy-retries:
strategy: backoff
statusCodes:
- '503'
/segment-anything-2:
post:
tags:
Expand Down Expand Up @@ -303,6 +323,10 @@ paths:
security:
- HTTPBearer: []
x-speakeasy-name-override: segmentAnything2
x-speakeasy-retries:
strategy: backoff
statusCodes:
- '503'
components:
schemas:
APIError:
Expand Down
26 changes: 25 additions & 1 deletion runner/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.1.0
info:
title: Livepeer AI Runner
description: An application to run AI pipelines
version: v0.2.0
version: v0.3.0
servers:
- url: https://dream-gateway.livepeer.cloud
description: Livepeer Cloud Community Gateway
Expand Down Expand Up @@ -68,6 +68,10 @@ paths:
security:
- HTTPBearer: []
x-speakeasy-name-override: textToImage
x-speakeasy-retries:
strategy: backoff
statusCodes:
- '503'
/image-to-image:
post:
tags:
Expand Down Expand Up @@ -116,6 +120,10 @@ paths:
security:
- HTTPBearer: []
x-speakeasy-name-override: imageToImage
x-speakeasy-retries:
strategy: backoff
statusCodes:
- '503'
/image-to-video:
post:
tags:
Expand Down Expand Up @@ -164,6 +172,10 @@ paths:
security:
- HTTPBearer: []
x-speakeasy-name-override: imageToVideo
x-speakeasy-retries:
strategy: backoff
statusCodes:
- '503'
/upscale:
post:
tags:
Expand Down Expand Up @@ -212,6 +224,10 @@ paths:
security:
- HTTPBearer: []
x-speakeasy-name-override: upscale
x-speakeasy-retries:
strategy: backoff
statusCodes:
- '503'
/audio-to-text:
post:
tags:
Expand Down Expand Up @@ -266,6 +282,10 @@ paths:
security:
- HTTPBearer: []
x-speakeasy-name-override: audioToText
x-speakeasy-retries:
strategy: backoff
statusCodes:
- '503'
/segment-anything-2:
post:
tags:
Expand Down Expand Up @@ -314,6 +334,10 @@ paths:
security:
- HTTPBearer: []
x-speakeasy-name-override: segmentAnything2
x-speakeasy-retries:
strategy: backoff
statusCodes:
- '503'
components:
schemas:
APIError:
Expand Down
105 changes: 53 additions & 52 deletions worker/runner.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit caa4bb7

Please sign in to comment.