Skip to content

Commit bdb2557

Browse files
committed
Additional spec conformance
1 parent 6fdf17a commit bdb2557

File tree

2 files changed

+6
-153
lines changed

2 files changed

+6
-153
lines changed

cross-sdk-design.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1996,14 +1996,8 @@ The following discrepancies exist between the spec above and the current Python
19961996

19971997
4. **`ActivityExecutionCountAggregationGroup.group_values`**: Spec says `Sequence[temporalio.common.SearchAttributeValue]`, implementation uses `Sequence[Any]`.
19981998

1999-
### Parameter Name Discrepancies
2000-
2001-
1. **`start_activity` uses `static_summary` and `static_details`**: Spec says parameter should be named `summary` (no `static_` prefix) and explicitly says "no static_details". Implementation should be updated to match spec.
2002-
20031999
### Extra Items (Not in Spec)
20042000

2005-
1. **`ActivityHandle.pause()`, `unpause()`, `reset()` methods**: These activity lifecycle methods are implemented but not specified. These should be removed from implementation.
2006-
20072001
2. **`ActivityExecutionDescription.input: Sequence[Any]`**: Extra field providing deserialized activity input. Not in spec but useful for debugging.
20082002

20092003
3. **`PendingActivityState` enum**: Added to `temporalio.common` to support `ActivityExecutionDescription.run_state`. Should be added to spec.

temporalio/client.py

Lines changed: 6 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,8 +1287,7 @@ async def start_activity(
12871287
id_conflict_policy: temporalio.common.ActivityIDConflictPolicy = temporalio.common.ActivityIDConflictPolicy.FAIL,
12881288
retry_policy: temporalio.common.RetryPolicy | None = None,
12891289
search_attributes: temporalio.common.TypedSearchAttributes | None = None,
1290-
static_summary: str | None = None,
1291-
static_details: str | None = None,
1290+
summary: str | None = None,
12921291
priority: temporalio.common.Priority = temporalio.common.Priority.default,
12931292
rpc_metadata: Mapping[str, str | bytes] = {},
12941293
rpc_timeout: timedelta | None = None,
@@ -1314,10 +1313,8 @@ async def start_activity(
13141313
Default is FAIL.
13151314
retry_policy: Retry policy for the activity.
13161315
search_attributes: Search attributes for the activity.
1317-
static_summary: A single-line fixed summary for this activity that may appear
1316+
summary: A single-line fixed summary for this activity that may appear
13181317
in the UI/CLI. This can be in single-line Temporal markdown format.
1319-
static_details: General fixed details for this activity that may appear in
1320-
UI/CLI. This can be in Temporal markdown format and can span multiple lines.
13211318
priority: Priority of the activity execution.
13221319
rpc_metadata: Headers used on the RPC call.
13231320
rpc_timeout: Optional RPC deadline to set for the RPC call.
@@ -1343,8 +1340,7 @@ async def start_activity(
13431340
id_conflict_policy=id_conflict_policy,
13441341
retry_policy=retry_policy,
13451342
search_attributes=search_attributes,
1346-
summary=static_summary,
1347-
details=static_details,
1343+
summary=summary,
13481344
headers={},
13491345
rpc_metadata=rpc_metadata,
13501346
rpc_timeout=rpc_timeout,
@@ -1369,8 +1365,7 @@ async def execute_activity(
13691365
id_conflict_policy: temporalio.common.ActivityIDConflictPolicy = temporalio.common.ActivityIDConflictPolicy.FAIL,
13701366
retry_policy: temporalio.common.RetryPolicy | None = None,
13711367
search_attributes: temporalio.common.TypedSearchAttributes | None = None,
1372-
static_summary: str | None = None,
1373-
static_details: str | None = None,
1368+
summary: str | None = None,
13741369
priority: temporalio.common.Priority = temporalio.common.Priority.default,
13751370
rpc_metadata: Mapping[str, str | bytes] = {},
13761371
rpc_timeout: timedelta | None = None,
@@ -1403,8 +1398,7 @@ async def execute_activity(
14031398
id_conflict_policy=id_conflict_policy,
14041399
retry_policy=retry_policy,
14051400
search_attributes=search_attributes,
1406-
static_summary=static_summary,
1407-
static_details=static_details,
1401+
summary=summary,
14081402
priority=priority,
14091403
rpc_metadata=rpc_metadata,
14101404
rpc_timeout=rpc_timeout,
@@ -3778,138 +3772,6 @@ async def describe(
37783772
)
37793773
)
37803774

3781-
# TODO:
3782-
# update_options
3783-
3784-
async def pause(
3785-
self,
3786-
*,
3787-
reason: str | None = None,
3788-
rpc_metadata: Mapping[str, str | bytes] = {},
3789-
rpc_timeout: timedelta | None = None,
3790-
) -> None:
3791-
"""Pause the activity.
3792-
3793-
.. warning::
3794-
This API is experimental.
3795-
3796-
Args:
3797-
reason: Reason for pausing the activity.
3798-
rpc_metadata: Headers used on the RPC call. Keys here override
3799-
client-level RPC metadata keys.
3800-
rpc_timeout: Optional RPC deadline to set for the RPC call.
3801-
"""
3802-
id_ref = ActivityIDReference(
3803-
activity_id=self._activity_id,
3804-
run_id=self._activity_run_id,
3805-
workflow_id=None,
3806-
)
3807-
if not isinstance(id_ref, ActivityIDReference):
3808-
raise ValueError("Cannot pause activity with task token")
3809-
3810-
await self._client.workflow_service.pause_activity(
3811-
temporalio.api.workflowservice.v1.PauseActivityRequest(
3812-
namespace=self._client.namespace,
3813-
execution=temporalio.api.common.v1.WorkflowExecution(
3814-
workflow_id=id_ref.workflow_id or "",
3815-
run_id=id_ref.run_id or "",
3816-
),
3817-
identity=self._client.identity,
3818-
id=id_ref.activity_id,
3819-
reason=reason or "",
3820-
),
3821-
retry=True,
3822-
metadata=rpc_metadata,
3823-
timeout=rpc_timeout,
3824-
)
3825-
3826-
async def unpause(
3827-
self,
3828-
*,
3829-
reset_attempts: bool = False,
3830-
rpc_metadata: Mapping[str, str | bytes] = {},
3831-
rpc_timeout: timedelta | None = None,
3832-
) -> None:
3833-
"""Unpause the activity.
3834-
3835-
.. warning::
3836-
This API is experimental.
3837-
3838-
Args:
3839-
reset_attempts: Whether to reset the number of attempts.
3840-
rpc_metadata: Headers used on the RPC call. Keys here override
3841-
client-level RPC metadata keys.
3842-
rpc_timeout: Optional RPC deadline to set for the RPC call.
3843-
"""
3844-
id_ref = ActivityIDReference(
3845-
activity_id=self._activity_id,
3846-
run_id=self._activity_run_id,
3847-
workflow_id=None,
3848-
)
3849-
if not isinstance(id_ref, ActivityIDReference):
3850-
raise ValueError("Cannot unpause activity with task token")
3851-
3852-
await self._client.workflow_service.unpause_activity(
3853-
temporalio.api.workflowservice.v1.UnpauseActivityRequest(
3854-
namespace=self._client.namespace,
3855-
execution=temporalio.api.common.v1.WorkflowExecution(
3856-
workflow_id=id_ref.workflow_id or "",
3857-
run_id=id_ref.run_id or "",
3858-
),
3859-
identity=self._client.identity,
3860-
id=id_ref.activity_id,
3861-
reset_attempts=reset_attempts,
3862-
),
3863-
retry=True,
3864-
metadata=rpc_metadata,
3865-
timeout=rpc_timeout,
3866-
)
3867-
3868-
async def reset(
3869-
self,
3870-
*,
3871-
reset_heartbeat: bool = False,
3872-
keep_paused: bool = False,
3873-
rpc_metadata: Mapping[str, str | bytes] = {},
3874-
rpc_timeout: timedelta | None = None,
3875-
) -> None:
3876-
"""Reset the activity.
3877-
3878-
.. warning::
3879-
This API is experimental.
3880-
3881-
Args:
3882-
reset_heartbeat: Whether to reset heartbeat details.
3883-
keep_paused: If activity is paused, whether to keep it paused after reset.
3884-
rpc_metadata: Headers used on the RPC call. Keys here override
3885-
client-level RPC metadata keys.
3886-
rpc_timeout: Optional RPC deadline to set for the RPC call.
3887-
"""
3888-
id_ref = ActivityIDReference(
3889-
activity_id=self._activity_id,
3890-
run_id=self._activity_run_id,
3891-
workflow_id=None,
3892-
)
3893-
if not isinstance(id_ref, ActivityIDReference):
3894-
raise ValueError("Cannot reset activity with task token")
3895-
3896-
await self._client.workflow_service.reset_activity(
3897-
temporalio.api.workflowservice.v1.ResetActivityRequest(
3898-
namespace=self._client.namespace,
3899-
execution=temporalio.api.common.v1.WorkflowExecution(
3900-
workflow_id=id_ref.workflow_id or "",
3901-
run_id=id_ref.run_id or "",
3902-
),
3903-
identity=self._client.identity,
3904-
id=id_ref.activity_id,
3905-
reset_heartbeat=reset_heartbeat,
3906-
keep_paused=keep_paused,
3907-
),
3908-
retry=True,
3909-
metadata=rpc_metadata,
3910-
timeout=rpc_timeout,
3911-
)
3912-
39133775

39143776
@dataclass
39153777
class WorkflowExecution:
@@ -6531,7 +6393,6 @@ class StartActivityInput:
65316393
priority: temporalio.common.Priority
65326394
search_attributes: temporalio.common.TypedSearchAttributes | None
65336395
summary: str | None
6534-
details: str | None
65356396
headers: Mapping[str, temporalio.api.common.v1.Payload]
65366397
rpc_metadata: Mapping[str, str | bytes]
65376398
rpc_timeout: timedelta | None
@@ -7532,9 +7393,7 @@ async def _build_start_activity_execution_request(
75327393
)
75337394

75347395
# Set user metadata
7535-
metadata = await _encode_user_metadata(
7536-
data_converter, input.summary, input.details
7537-
)
7396+
metadata = await _encode_user_metadata(data_converter, input.summary, None)
75387397
if metadata is not None:
75397398
req.user_metadata.CopyFrom(metadata)
75407399

0 commit comments

Comments
 (0)