render-lab-tasks-render 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- render_lab_tasks_render/__init__.py +1 -0
- render_lab_tasks_render/_app.py +3 -0
- render_lab_tasks_render/await_deploy.py +18 -0
- render_lab_tasks_render/client.py +525 -0
- render_lab_tasks_render/create_private_service.py +20 -0
- render_lab_tasks_render/create_project.py +18 -0
- render_lab_tasks_render/delete_project.py +18 -0
- render_lab_tasks_render/delete_resource.py +18 -0
- render_lab_tasks_render/ensure_service.py +18 -0
- render_lab_tasks_render/get_deploy_diagnostics.py +20 -0
- render_lab_tasks_render/get_service.py +18 -0
- render_lab_tasks_render/provision_key_value.py +18 -0
- render_lab_tasks_render/provision_postgres.py +18 -0
- render_lab_tasks_render/provision_service.py +43 -0
- render_lab_tasks_render/py.typed +0 -0
- render_lab_tasks_render/resume_service.py +18 -0
- render_lab_tasks_render/retry.py +5 -0
- render_lab_tasks_render/scale_service.py +18 -0
- render_lab_tasks_render/suspend_service.py +18 -0
- render_lab_tasks_render/tasks.py +50 -0
- render_lab_tasks_render/trigger_deploy.py +18 -0
- render_lab_tasks_render/types.py +367 -0
- render_lab_tasks_render-0.1.0.dist-info/METADATA +54 -0
- render_lab_tasks_render-0.1.0.dist-info/RECORD +26 -0
- render_lab_tasks_render-0.1.0.dist-info/WHEEL +4 -0
- render_lab_tasks_render-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from render import TaskContext
|
|
2
|
+
|
|
3
|
+
from ._app import app
|
|
4
|
+
from .client import Deps, dependencies
|
|
5
|
+
from .retry import RENDER_RETRY
|
|
6
|
+
from .types import GetServiceInput, ServiceDTO
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
async def get_service_impl(
|
|
10
|
+
ctx: TaskContext, input: GetServiceInput, *, deps: Deps | None = None
|
|
11
|
+
) -> ServiceDTO:
|
|
12
|
+
async with dependencies(deps) as resolved:
|
|
13
|
+
return await resolved.render.get_service(input)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@app.task(name="render.getService", retry=RENDER_RETRY)
|
|
17
|
+
async def get_service(ctx: TaskContext, input: GetServiceInput) -> ServiceDTO:
|
|
18
|
+
return await get_service_impl(ctx, input)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from render import TaskContext
|
|
2
|
+
|
|
3
|
+
from ._app import app
|
|
4
|
+
from .client import Deps, dependencies
|
|
5
|
+
from .retry import PROVISION_RETRY
|
|
6
|
+
from .types import KeyValueDTO, ProvisionKeyValueInput
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
async def provision_key_value_impl(
|
|
10
|
+
ctx: TaskContext, input: ProvisionKeyValueInput, *, deps: Deps | None = None
|
|
11
|
+
) -> KeyValueDTO:
|
|
12
|
+
async with dependencies(deps) as resolved:
|
|
13
|
+
return await resolved.render.provision_key_value(input)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@app.task(name="render.provisionKeyValue", retry=PROVISION_RETRY)
|
|
17
|
+
async def provision_key_value(ctx: TaskContext, input: ProvisionKeyValueInput) -> KeyValueDTO:
|
|
18
|
+
return await provision_key_value_impl(ctx, input)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from render import TaskContext
|
|
2
|
+
|
|
3
|
+
from ._app import app
|
|
4
|
+
from .client import Deps, dependencies
|
|
5
|
+
from .retry import PROVISION_RETRY
|
|
6
|
+
from .types import PostgresDTO, ProvisionPostgresInput
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
async def provision_postgres_impl(
|
|
10
|
+
ctx: TaskContext, input: ProvisionPostgresInput, *, deps: Deps | None = None
|
|
11
|
+
) -> PostgresDTO:
|
|
12
|
+
async with dependencies(deps) as resolved:
|
|
13
|
+
return await resolved.render.provision_postgres(input)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@app.task(name="render.provisionPostgres", retry=PROVISION_RETRY)
|
|
17
|
+
async def provision_postgres(ctx: TaskContext, input: ProvisionPostgresInput) -> PostgresDTO:
|
|
18
|
+
return await provision_postgres_impl(ctx, input)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""Checkpoint the ensure phase and poll only the resulting deploy."""
|
|
2
|
+
|
|
3
|
+
from render import TaskContext
|
|
4
|
+
|
|
5
|
+
from ._app import app
|
|
6
|
+
from .client import DEPLOY_FAILED, Deps, dependencies
|
|
7
|
+
from .ensure_service import ensure_service
|
|
8
|
+
from .retry import PROVISION_RETRY
|
|
9
|
+
from .types import ProvisionServiceInput, ProvisionServiceResult
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
async def provision_service_impl(
|
|
13
|
+
ctx: TaskContext, input: ProvisionServiceInput, *, deps: Deps | None = None
|
|
14
|
+
) -> ProvisionServiceResult:
|
|
15
|
+
if input["type"] == "static_site" and not input.get("repo"):
|
|
16
|
+
raise ValueError("render.provisionService static sites require { repo }.")
|
|
17
|
+
if not input.get("repo") and not (input["type"] == "private_service" and input.get("image")):
|
|
18
|
+
raise ValueError(
|
|
19
|
+
"render.provisionService requires a source: pass { repo } or supported { image }."
|
|
20
|
+
)
|
|
21
|
+
# ctx.run checkpoints the wrapped ensure task across durable redispatches.
|
|
22
|
+
if deps is None:
|
|
23
|
+
ensured = await ctx.run(ensure_service, input)
|
|
24
|
+
elif deps.ensure_service is not None:
|
|
25
|
+
ensured = await deps.ensure_service(input)
|
|
26
|
+
else:
|
|
27
|
+
ensured = await deps.render.ensure_service(input)
|
|
28
|
+
if not ensured["deployId"]:
|
|
29
|
+
raise ValueError(f'Service "{input["name"]}" still deploying (no deploy yet)')
|
|
30
|
+
async with dependencies(deps) as resolved:
|
|
31
|
+
status = (await resolved.render.get_deploy(ensured["service"]["id"], ensured["deployId"]))[
|
|
32
|
+
"status"
|
|
33
|
+
]
|
|
34
|
+
if status != "live" and status not in DEPLOY_FAILED:
|
|
35
|
+
raise ValueError(f'Service "{input["name"]}" still deploying ({status})')
|
|
36
|
+
return {**ensured, "status": status, "live": status == "live"}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@app.task(name="render.provisionService", retry=PROVISION_RETRY)
|
|
40
|
+
async def provision_service(
|
|
41
|
+
ctx: TaskContext, input: ProvisionServiceInput
|
|
42
|
+
) -> ProvisionServiceResult:
|
|
43
|
+
return await provision_service_impl(ctx, input)
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from render import TaskContext
|
|
2
|
+
|
|
3
|
+
from ._app import app
|
|
4
|
+
from .client import Deps, dependencies
|
|
5
|
+
from .retry import RENDER_RETRY
|
|
6
|
+
from .types import ResumeServiceInput, ResumeServiceResult
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
async def resume_service_impl(
|
|
10
|
+
ctx: TaskContext, input: ResumeServiceInput, *, deps: Deps | None = None
|
|
11
|
+
) -> ResumeServiceResult:
|
|
12
|
+
async with dependencies(deps) as resolved:
|
|
13
|
+
return await resolved.render.resume_service(input)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@app.task(name="render.resumeService", retry=RENDER_RETRY)
|
|
17
|
+
async def resume_service(ctx: TaskContext, input: ResumeServiceInput) -> ResumeServiceResult:
|
|
18
|
+
return await resume_service_impl(ctx, input)
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
from render import Retry
|
|
2
|
+
|
|
3
|
+
AWAIT_DEPLOY_RETRY = Retry(max_retries=120, wait_duration_ms=15000, backoff_scaling=1)
|
|
4
|
+
PROVISION_RETRY = Retry(max_retries=80, wait_duration_ms=15000, backoff_scaling=1)
|
|
5
|
+
RENDER_RETRY = Retry(max_retries=3, wait_duration_ms=1000, backoff_scaling=2)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from render import TaskContext
|
|
2
|
+
|
|
3
|
+
from ._app import app
|
|
4
|
+
from .client import Deps, dependencies
|
|
5
|
+
from .retry import RENDER_RETRY
|
|
6
|
+
from .types import ScaleServiceInput, ScaleServiceResult
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
async def scale_service_impl(
|
|
10
|
+
ctx: TaskContext, input: ScaleServiceInput, *, deps: Deps | None = None
|
|
11
|
+
) -> ScaleServiceResult:
|
|
12
|
+
async with dependencies(deps) as resolved:
|
|
13
|
+
return await resolved.render.scale_service(input)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@app.task(name="render.scaleService", retry=RENDER_RETRY)
|
|
17
|
+
async def scale_service(ctx: TaskContext, input: ScaleServiceInput) -> ScaleServiceResult:
|
|
18
|
+
return await scale_service_impl(ctx, input)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from render import TaskContext
|
|
2
|
+
|
|
3
|
+
from ._app import app
|
|
4
|
+
from .client import Deps, dependencies
|
|
5
|
+
from .retry import RENDER_RETRY
|
|
6
|
+
from .types import SuspendServiceInput, SuspendServiceResult
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
async def suspend_service_impl(
|
|
10
|
+
ctx: TaskContext, input: SuspendServiceInput, *, deps: Deps | None = None
|
|
11
|
+
) -> SuspendServiceResult:
|
|
12
|
+
async with dependencies(deps) as resolved:
|
|
13
|
+
return await resolved.render.suspend_service(input)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@app.task(name="render.suspendService", retry=RENDER_RETRY)
|
|
17
|
+
async def suspend_service(ctx: TaskContext, input: SuspendServiceInput) -> SuspendServiceResult:
|
|
18
|
+
return await suspend_service_impl(ctx, input)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
from ._app import app
|
|
2
|
+
from .await_deploy import await_deploy, await_deploy_impl
|
|
3
|
+
from .create_private_service import create_private_service, create_private_service_impl
|
|
4
|
+
from .create_project import create_project, create_project_impl
|
|
5
|
+
from .delete_project import delete_project, delete_project_impl
|
|
6
|
+
from .delete_resource import delete_resource, delete_resource_impl
|
|
7
|
+
from .ensure_service import ensure_service, ensure_service_impl
|
|
8
|
+
from .get_deploy_diagnostics import get_deploy_diagnostics, get_deploy_diagnostics_impl
|
|
9
|
+
from .get_service import get_service, get_service_impl
|
|
10
|
+
from .provision_key_value import provision_key_value, provision_key_value_impl
|
|
11
|
+
from .provision_postgres import provision_postgres, provision_postgres_impl
|
|
12
|
+
from .provision_service import provision_service, provision_service_impl
|
|
13
|
+
from .resume_service import resume_service, resume_service_impl
|
|
14
|
+
from .scale_service import scale_service, scale_service_impl
|
|
15
|
+
from .suspend_service import suspend_service, suspend_service_impl
|
|
16
|
+
from .trigger_deploy import trigger_deploy, trigger_deploy_impl
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"app",
|
|
20
|
+
"await_deploy",
|
|
21
|
+
"await_deploy_impl",
|
|
22
|
+
"create_private_service",
|
|
23
|
+
"create_private_service_impl",
|
|
24
|
+
"create_project",
|
|
25
|
+
"create_project_impl",
|
|
26
|
+
"delete_project",
|
|
27
|
+
"delete_project_impl",
|
|
28
|
+
"delete_resource",
|
|
29
|
+
"delete_resource_impl",
|
|
30
|
+
"ensure_service",
|
|
31
|
+
"ensure_service_impl",
|
|
32
|
+
"get_deploy_diagnostics",
|
|
33
|
+
"get_deploy_diagnostics_impl",
|
|
34
|
+
"get_service",
|
|
35
|
+
"get_service_impl",
|
|
36
|
+
"provision_key_value",
|
|
37
|
+
"provision_key_value_impl",
|
|
38
|
+
"provision_postgres",
|
|
39
|
+
"provision_postgres_impl",
|
|
40
|
+
"provision_service",
|
|
41
|
+
"provision_service_impl",
|
|
42
|
+
"resume_service",
|
|
43
|
+
"resume_service_impl",
|
|
44
|
+
"scale_service",
|
|
45
|
+
"scale_service_impl",
|
|
46
|
+
"suspend_service",
|
|
47
|
+
"suspend_service_impl",
|
|
48
|
+
"trigger_deploy",
|
|
49
|
+
"trigger_deploy_impl",
|
|
50
|
+
]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from render import TaskContext
|
|
2
|
+
|
|
3
|
+
from ._app import app
|
|
4
|
+
from .client import Deps, dependencies
|
|
5
|
+
from .retry import RENDER_RETRY
|
|
6
|
+
from .types import TriggerDeployInput, TriggerDeployResult
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
async def trigger_deploy_impl(
|
|
10
|
+
ctx: TaskContext, input: TriggerDeployInput, *, deps: Deps | None = None
|
|
11
|
+
) -> TriggerDeployResult:
|
|
12
|
+
async with dependencies(deps) as resolved:
|
|
13
|
+
return await resolved.render.trigger_deploy(input)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@app.task(name="render.triggerDeploy", retry=RENDER_RETRY)
|
|
17
|
+
async def trigger_deploy(ctx: TaskContext, input: TriggerDeployInput) -> TriggerDeployResult:
|
|
18
|
+
return await trigger_deploy_impl(ctx, input)
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
"""JSON contracts ported from the pinned TypeScript pack."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Literal, NotRequired, TypedDict
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class DeployDiagnosticsResultDeploy(TypedDict):
|
|
9
|
+
id: str
|
|
10
|
+
serviceId: str
|
|
11
|
+
status: DeployStatus
|
|
12
|
+
commitId: str | None
|
|
13
|
+
createdAt: str
|
|
14
|
+
updatedAt: str
|
|
15
|
+
finishedAt: str | None
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class DeleteResourceInputValueVariant4(TypedDict):
|
|
19
|
+
kind: Literal["disk"]
|
|
20
|
+
id: str
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class DeleteResourceInputValueVariant3(TypedDict):
|
|
24
|
+
kind: Literal["keyValue"]
|
|
25
|
+
id: str
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class DeleteResourceInputValueVariant2(TypedDict):
|
|
29
|
+
kind: Literal["postgres"]
|
|
30
|
+
id: str
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class DeleteResourceInputValueVariant1(TypedDict):
|
|
34
|
+
kind: Literal["service"]
|
|
35
|
+
id: str
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class CreatePrivateServiceInputEnvVarsItem(TypedDict):
|
|
39
|
+
key: str
|
|
40
|
+
value: str
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
type DeployStatus = (
|
|
44
|
+
Literal["created"]
|
|
45
|
+
| Literal["queued"]
|
|
46
|
+
| Literal["build_in_progress"]
|
|
47
|
+
| Literal["update_in_progress"]
|
|
48
|
+
| Literal["pre_deploy_in_progress"]
|
|
49
|
+
| Literal["live"]
|
|
50
|
+
| Literal["build_failed"]
|
|
51
|
+
| Literal["update_failed"]
|
|
52
|
+
| Literal["pre_deploy_failed"]
|
|
53
|
+
| Literal["canceled"]
|
|
54
|
+
| Literal["deactivated"]
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
type ResourceStatus = (
|
|
58
|
+
Literal["creating"]
|
|
59
|
+
| Literal["available"]
|
|
60
|
+
| Literal["unavailable"]
|
|
61
|
+
| Literal["suspended"]
|
|
62
|
+
| Literal["maintenance_in_progress"]
|
|
63
|
+
| Literal["recovery_in_progress"]
|
|
64
|
+
| Literal["recovery_failed"]
|
|
65
|
+
| Literal["unknown"]
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
type RenderServiceType = (
|
|
69
|
+
Literal["web_service"]
|
|
70
|
+
| Literal["private_service"]
|
|
71
|
+
| Literal["background_worker"]
|
|
72
|
+
| Literal["static_site"]
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class ServiceDTO(TypedDict):
|
|
77
|
+
id: str
|
|
78
|
+
name: str
|
|
79
|
+
type: str
|
|
80
|
+
runtime: NotRequired[str | None]
|
|
81
|
+
region: NotRequired[str | None]
|
|
82
|
+
plan: NotRequired[str | None]
|
|
83
|
+
repositoryUrl: NotRequired[str | None]
|
|
84
|
+
branch: NotRequired[str | None]
|
|
85
|
+
createdAt: NotRequired[str]
|
|
86
|
+
updatedAt: NotRequired[str]
|
|
87
|
+
suspended: bool
|
|
88
|
+
url: str | None
|
|
89
|
+
dashboardUrl: str | None
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class DeployDTO(TypedDict):
|
|
93
|
+
id: str
|
|
94
|
+
serviceId: str
|
|
95
|
+
status: DeployStatus
|
|
96
|
+
commitId: str | None
|
|
97
|
+
createdAt: NotRequired[str]
|
|
98
|
+
updatedAt: NotRequired[str]
|
|
99
|
+
finishedAt: NotRequired[str | None]
|
|
100
|
+
failureReason: NotRequired[str | None]
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class PostgresDTO(TypedDict):
|
|
104
|
+
id: str
|
|
105
|
+
name: str
|
|
106
|
+
status: ResourceStatus
|
|
107
|
+
plan: str | None
|
|
108
|
+
region: str | None
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
class KeyValueDTO(TypedDict):
|
|
112
|
+
id: str
|
|
113
|
+
name: str
|
|
114
|
+
status: ResourceStatus
|
|
115
|
+
plan: str | None
|
|
116
|
+
region: str | None
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class ProjectDTO(TypedDict):
|
|
120
|
+
id: str
|
|
121
|
+
name: str
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
class EnvironmentVariableInput(TypedDict):
|
|
125
|
+
key: str
|
|
126
|
+
value: str
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
class DiskInput(TypedDict):
|
|
130
|
+
name: str
|
|
131
|
+
mountPath: str
|
|
132
|
+
sizeGB: float
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class DiskDTO(DiskInput):
|
|
136
|
+
id: str
|
|
137
|
+
ownerId: NotRequired[str]
|
|
138
|
+
serviceId: str
|
|
139
|
+
createdAt: NotRequired[str]
|
|
140
|
+
updatedAt: NotRequired[str]
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
class TriggerDeployInput(TypedDict):
|
|
144
|
+
serviceId: str
|
|
145
|
+
clearCache: NotRequired[bool]
|
|
146
|
+
commitId: NotRequired[str]
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
class TriggerDeployResult(TypedDict):
|
|
150
|
+
serviceId: str
|
|
151
|
+
deployId: str
|
|
152
|
+
status: DeployStatus
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
class AwaitDeployInput(TypedDict):
|
|
156
|
+
serviceId: str
|
|
157
|
+
deployId: str
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class AwaitDeployResult(TypedDict):
|
|
161
|
+
serviceId: str
|
|
162
|
+
deployId: str
|
|
163
|
+
status: DeployStatus
|
|
164
|
+
live: bool
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
class ScaleServiceInput(TypedDict):
|
|
168
|
+
serviceId: str
|
|
169
|
+
numInstances: NotRequired[float]
|
|
170
|
+
plan: NotRequired[str]
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
class ScaleServiceResult(TypedDict):
|
|
174
|
+
serviceId: str
|
|
175
|
+
numInstances: float | None
|
|
176
|
+
plan: str | None
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
class SuspendServiceInput(TypedDict):
|
|
180
|
+
serviceId: str
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
class SuspendServiceResult(TypedDict):
|
|
184
|
+
serviceId: str
|
|
185
|
+
suspended: bool
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class ResumeServiceInput(TypedDict):
|
|
189
|
+
serviceId: str
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
class ResumeServiceResult(TypedDict):
|
|
193
|
+
serviceId: str
|
|
194
|
+
suspended: bool
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
class ProvisionPostgresInput(TypedDict):
|
|
198
|
+
name: str
|
|
199
|
+
ownerId: NotRequired[str]
|
|
200
|
+
plan: NotRequired[str]
|
|
201
|
+
region: NotRequired[str]
|
|
202
|
+
version: NotRequired[str]
|
|
203
|
+
databaseName: NotRequired[str]
|
|
204
|
+
databaseUser: NotRequired[str]
|
|
205
|
+
environmentId: NotRequired[str]
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
class ProvisionKeyValueInput(TypedDict):
|
|
209
|
+
name: str
|
|
210
|
+
ownerId: NotRequired[str]
|
|
211
|
+
plan: NotRequired[str]
|
|
212
|
+
region: NotRequired[str]
|
|
213
|
+
maxmemoryPolicy: NotRequired[str]
|
|
214
|
+
environmentId: NotRequired[str]
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
class CreatePrivateServiceInput(TypedDict):
|
|
218
|
+
name: str
|
|
219
|
+
ownerId: NotRequired[str]
|
|
220
|
+
region: NotRequired[str]
|
|
221
|
+
plan: NotRequired[str]
|
|
222
|
+
repo: NotRequired[str]
|
|
223
|
+
branch: NotRequired[str]
|
|
224
|
+
image: NotRequired[str]
|
|
225
|
+
envVars: NotRequired[list[CreatePrivateServiceInputEnvVarsItem]]
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
class CreatePrivateServiceResult(TypedDict):
|
|
229
|
+
serviceId: str
|
|
230
|
+
name: str
|
|
231
|
+
status: DeployStatus
|
|
232
|
+
live: bool
|
|
233
|
+
url: str | None
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
class GetServiceInput(TypedDict):
|
|
237
|
+
serviceId: str
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
class CommonProvisionServiceInput(TypedDict):
|
|
241
|
+
name: str
|
|
242
|
+
ownerId: NotRequired[str]
|
|
243
|
+
region: NotRequired[str]
|
|
244
|
+
plan: NotRequired[str]
|
|
245
|
+
repo: NotRequired[str]
|
|
246
|
+
branch: NotRequired[str]
|
|
247
|
+
rootDir: NotRequired[str]
|
|
248
|
+
preDeployCommand: NotRequired[str]
|
|
249
|
+
autoDeploy: NotRequired[bool]
|
|
250
|
+
envVars: NotRequired[list[EnvironmentVariableInput]]
|
|
251
|
+
environmentId: NotRequired[str]
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
class BaseProvisionServiceInput(CommonProvisionServiceInput):
|
|
255
|
+
buildCommand: NotRequired[str]
|
|
256
|
+
disk: NotRequired[DiskInput]
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
class DockerBuildInput(TypedDict):
|
|
260
|
+
dockerfilePath: NotRequired[str]
|
|
261
|
+
dockerContext: NotRequired[str]
|
|
262
|
+
dockerCommand: NotRequired[str]
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
class WebServiceInput(BaseProvisionServiceInput, DockerBuildInput):
|
|
266
|
+
type: Literal["web_service"]
|
|
267
|
+
runtime: str
|
|
268
|
+
startCommand: str
|
|
269
|
+
healthCheckPath: NotRequired[str]
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
class PrivateServiceInput(BaseProvisionServiceInput, DockerBuildInput):
|
|
273
|
+
type: Literal["private_service"]
|
|
274
|
+
runtime: NotRequired[str]
|
|
275
|
+
startCommand: NotRequired[str]
|
|
276
|
+
image: NotRequired[str]
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
class BackgroundWorkerInput(BaseProvisionServiceInput, DockerBuildInput):
|
|
280
|
+
type: Literal["background_worker"]
|
|
281
|
+
runtime: str
|
|
282
|
+
startCommand: str
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
class StaticSiteInput(CommonProvisionServiceInput):
|
|
286
|
+
type: Literal["static_site"]
|
|
287
|
+
buildCommand: str
|
|
288
|
+
publishPath: str
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
type ProvisionServiceInput = (
|
|
292
|
+
WebServiceInput | PrivateServiceInput | BackgroundWorkerInput | StaticSiteInput
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
class EnsureServiceResult(TypedDict):
|
|
297
|
+
service: ServiceDTO
|
|
298
|
+
deployId: str | None
|
|
299
|
+
created: bool
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
class ProvisionServiceResult(TypedDict):
|
|
303
|
+
service: ServiceDTO
|
|
304
|
+
created: bool
|
|
305
|
+
deployId: str | None
|
|
306
|
+
status: DeployStatus
|
|
307
|
+
live: bool
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
type DeleteResourceInput = (
|
|
311
|
+
DeleteResourceInputValueVariant1
|
|
312
|
+
| DeleteResourceInputValueVariant2
|
|
313
|
+
| DeleteResourceInputValueVariant3
|
|
314
|
+
| DeleteResourceInputValueVariant4
|
|
315
|
+
)
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
class DeleteResourceResult(TypedDict):
|
|
319
|
+
kind: Literal["service", "postgres", "keyValue", "disk"]
|
|
320
|
+
id: str
|
|
321
|
+
deleted: Literal[True]
|
|
322
|
+
alreadyMissing: bool
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
class CreateProjectInput(TypedDict):
|
|
326
|
+
name: str
|
|
327
|
+
ownerId: NotRequired[str]
|
|
328
|
+
environmentName: NotRequired[str]
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
class CreateProjectResult(TypedDict):
|
|
332
|
+
project: ProjectDTO
|
|
333
|
+
environmentId: str
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
class DeleteProjectInput(TypedDict):
|
|
337
|
+
projectId: str
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
class DeleteProjectResult(TypedDict):
|
|
341
|
+
projectId: str
|
|
342
|
+
deleted: Literal[True]
|
|
343
|
+
alreadyMissing: bool
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
class LogLineDTO(TypedDict):
|
|
347
|
+
timestamp: str
|
|
348
|
+
resourceId: str
|
|
349
|
+
level: str
|
|
350
|
+
type: str
|
|
351
|
+
message: str
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
class GetDeployDiagnosticsInput(TypedDict):
|
|
355
|
+
serviceId: str
|
|
356
|
+
deployId: str
|
|
357
|
+
ownerId: str
|
|
358
|
+
maxBytes: NotRequired[float]
|
|
359
|
+
maxLines: NotRequired[float]
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
class DeployDiagnosticsResult(TypedDict):
|
|
363
|
+
deploy: DeployDiagnosticsResultDeploy
|
|
364
|
+
logs: list[LogLineDTO]
|
|
365
|
+
failureReason: str | None
|
|
366
|
+
truncated: bool
|
|
367
|
+
nextStartTime: str | None
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: render-lab-tasks-render
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: render tasks for Render Workflows
|
|
5
|
+
Project-URL: Repository, https://github.com/render-lab/render-tasks-python
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: >=3.12
|
|
9
|
+
Requires-Dist: httpx<0.29,>=0.28
|
|
10
|
+
Requires-Dist: render-lab-tasks-core<0.2,>=0.1.1
|
|
11
|
+
Requires-Dist: render==1.0.1
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# render-lab-tasks-render
|
|
15
|
+
|
|
16
|
+
Fifteen Render control-plane tasks for services, deploys, Postgres, Key Value,
|
|
17
|
+
projects, and diagnostics. Import `render_lab_tasks_render.tasks` to register;
|
|
18
|
+
every operation also exports injectable async `*_impl(ctx, input, *, deps=...)`.
|
|
19
|
+
|
|
20
|
+
`RENDER_API_KEY` is read lazily. Provision/create operations accept `ownerId` or
|
|
21
|
+
use `RENDER_OWNER_ID`. Pass explicit ownerId for name-based lookup scoping and
|
|
22
|
+
`environmentId` for project placement. Names are not a concurrency-safe unique
|
|
23
|
+
key: simultaneous creators or matches beyond the first 20 results need care.
|
|
24
|
+
|
|
25
|
+
`render.provisionService` uses ctx.run on the wrapped `render.ensureService`
|
|
26
|
+
child. The checkpointed ensure phase does not repeat on every deploy poll.
|
|
27
|
+
Terminal deploy failure returns live=false; pending states throw to drive the
|
|
28
|
+
durable retry. Inject a context runner plus the read port for composition tests.
|
|
29
|
+
Other awaiters retain source error-message/retry behavior, including source
|
|
30
|
+
messages built before status reads (created/undefined in progress messages).
|
|
31
|
+
|
|
32
|
+
Service reconciliation checks managed serviceDetails fields. Environment-only,
|
|
33
|
+
repository, or branch drift does not trigger reconciliation, matching TS. Docker
|
|
34
|
+
commands use envSpecificDetails; image sources are top-level and exclude repo.
|
|
35
|
+
|
|
36
|
+
Python uses durable retries only; the source's in-process 429/5xx exception is
|
|
37
|
+
not reproduced. This matches the Python repository's single retry owner rule.
|
|
38
|
+
Diagnostics actually clips UTF-8 log message bytes to maxBytes rather than the
|
|
39
|
+
source's ineffective drop-one-line heuristic. These deviations and required live
|
|
40
|
+
checks are recorded in ADR-0013 and the shared testing backlog.
|
|
41
|
+
|
|
42
|
+
No resources are created by importing the package. Live control-plane writes,
|
|
43
|
+
project placement, quota handling, and durable checkpoint replay remain unverified.
|
|
44
|
+
Any new Render-DX test services must belong to taskpack-test/testing.
|
|
45
|
+
|
|
46
|
+
`Deps.ensure_service` can inject the provisioning creation collaborator. If omitted
|
|
47
|
+
on custom dependencies, the injected port handles creation. Default wrapped calls
|
|
48
|
+
continue to checkpoint `render.ensureService` through `ctx.run`.
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
pip install render-lab-tasks-render==0.1.0
|
|
54
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
render_lab_tasks_render/__init__.py,sha256=fGcyw3Sxjue9wB_1RdFbEFKm5DXSlw_6vD2ud03a6og,58
|
|
2
|
+
render_lab_tasks_render/_app.py,sha256=nkWSD_6eq3xzdPJ_G7z6d5mv8tSB-Rq21yp07usJihA,48
|
|
3
|
+
render_lab_tasks_render/await_deploy.py,sha256=bZPMzczKASEuwQINlR9Q_l_U4hU9xZ8z1AQHNf9EM5Q,620
|
|
4
|
+
render_lab_tasks_render/client.py,sha256=mGLbllWXn5Gqu_aLJJmAys8fnN0wP5DUB2OIEqW0KCA,21466
|
|
5
|
+
render_lab_tasks_render/create_private_service.py,sha256=UGeGhE1l0njePtFRPFC8DF6kMQzNsFUyz7fJ5-MXsyM,723
|
|
6
|
+
render_lab_tasks_render/create_project.py,sha256=FEBF68Z8an21oqUFN8D00fRfwxKLptjoJvFOgQZMC0o,630
|
|
7
|
+
render_lab_tasks_render/delete_project.py,sha256=DmgTJQVRse8I-I_Q8rZ2QrhsdzNeNZyBaHkyrp9dfgs,630
|
|
8
|
+
render_lab_tasks_render/delete_resource.py,sha256=EhzyqI8n58UlGwjpcgFC5i7KtSJk6wdaYuPwWCgXYu8,641
|
|
9
|
+
render_lab_tasks_render/ensure_service.py,sha256=_-mOt4NK4T3xkTIxbKTNXALvlTNQ_xjPTSWaH8KrIQQ,639
|
|
10
|
+
render_lab_tasks_render/get_deploy_diagnostics.py,sha256=JXIwo0FTHuixqNOp2T3zK1E_UU3FBVT7SDDzMgIPx1g,708
|
|
11
|
+
render_lab_tasks_render/get_service.py,sha256=BeyqabXJVW4DUO0VDM0BdW3qsLGk1vczJoq1FQsxqME,579
|
|
12
|
+
render_lab_tasks_render/provision_key_value.py,sha256=iiREmH1HidwmwbaojlQ47h6UBnBqRtvEeEnS7Ug1I4w,648
|
|
13
|
+
render_lab_tasks_render/provision_postgres.py,sha256=7lXRW1s_AsTzuyzIIHzfjvRhNmaanCSOnC88Bi1NTV4,644
|
|
14
|
+
render_lab_tasks_render/provision_service.py,sha256=FgWwx8tRmRxsqVNjWgTH38Pn4-qmh69YQZ19TqMn7-c,1891
|
|
15
|
+
render_lab_tasks_render/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
|
+
render_lab_tasks_render/resume_service.py,sha256=v5dWtW772maOVogxdF3Vmo1dSVw91iEZ024VhoLGRhE,630
|
|
17
|
+
render_lab_tasks_render/retry.py,sha256=U-ePRAu5ZOulsBvCZrV8Lp3VEAQHtq1HvzA9ky1t8r0,274
|
|
18
|
+
render_lab_tasks_render/scale_service.py,sha256=cEpi6-e6N2SJG9mgjnqqJqL0qkx8AqIjZHFXhpFpOCc,619
|
|
19
|
+
render_lab_tasks_render/suspend_service.py,sha256=YpsWw_CqR_IAlO0RAisuygYIFmdt72N-lfkn4iJmiJg,641
|
|
20
|
+
render_lab_tasks_render/tasks.py,sha256=4G_arDkf0cr7aiOAgACBIKjbLHaOq62fvuMK6DUtCLQ,1863
|
|
21
|
+
render_lab_tasks_render/trigger_deploy.py,sha256=b1OU-My9AodSFIp86CJxt0BHpmh8mGj9TfDG5iajA_E,630
|
|
22
|
+
render_lab_tasks_render/types.py,sha256=bS9P6v2N_q9XLGBaef8JzIqAF-HVvJPtzwzQqh6Tkrg,7695
|
|
23
|
+
render_lab_tasks_render-0.1.0.dist-info/METADATA,sha256=St2AkKyKnDVVrctbMhoRsUnMcdTnDQ9PAFaDj8L4kc0,2613
|
|
24
|
+
render_lab_tasks_render-0.1.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
25
|
+
render_lab_tasks_render-0.1.0.dist-info/licenses/LICENSE,sha256=LvmsuKGkhvlSISJRqvBIPUQ_BqVDFRe0RghPSmDebzU,1067
|
|
26
|
+
render_lab_tasks_render-0.1.0.dist-info/RECORD,,
|