Skip to content

Commit 18e216e

Browse files
committed
Interesting
1 parent f8a6a4f commit 18e216e

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

temporalio/contrib/opentelemetry.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class should return the workflow interceptor subclass from
7171
custom attributes desired.
7272
"""
7373

74-
def __init__(
74+
def __init__( # type: ignore[reportMissingSuperCall]
7575
self,
7676
tracer: Optional[opentelemetry.trace.Tracer] = None,
7777
*,
@@ -125,11 +125,10 @@ def workflow_interceptor_class(
125125
:py:meth:`temporalio.worker.Interceptor.workflow_interceptor_class`.
126126
"""
127127
# Set the externs needed
128-
# TODO(cretz): MyPy works w/ spread kwargs instead of direct passing
129128
input.unsafe_extern_functions.update(
130-
**_WorkflowExternFunctions(
131-
__temporal_opentelemetry_completed_span=self._completed_workflow_span,
132-
)
129+
{
130+
"__temporal_opentelemetry_completed_span": self._completed_workflow_span,
131+
}
133132
)
134133
return TracingWorkflowInboundInterceptor
135134

temporalio/converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ def default(self, o: Any) -> Any:
508508
if isinstance(o, datetime):
509509
return o.isoformat()
510510
# Dataclass support
511-
if dataclasses.is_dataclass(o):
511+
if dataclasses.is_dataclass(o) and not isinstance(o, type):
512512
return dataclasses.asdict(o)
513513
# Support for Pydantic v1's dict method
514514
dict_fn = getattr(o, "dict", None)

temporalio/worker/_activity.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -818,13 +818,10 @@ def _execute_sync_activity(
818818
thread_id = threading.current_thread().ident
819819
if thread_id is not None:
820820
cancel_thread_raiser.set_thread_id(thread_id)
821-
heartbeat_fn: Callable[..., None]
822821
if isinstance(heartbeat, SharedHeartbeatSender):
823-
# To make mypy happy
824-
heartbeat_sender = heartbeat
825-
heartbeat_fn = lambda *details: heartbeat_sender.send_heartbeat(
826-
info.task_token, *details
827-
)
822+
823+
def heartbeat_fn(*details: Any) -> None:
824+
heartbeat.send_heartbeat(info.task_token, *details)
828825
else:
829826
heartbeat_fn = heartbeat
830827
temporalio.activity._Context.set(
@@ -902,7 +899,7 @@ async def register_heartbeater(
902899
raise NotImplementedError
903900

904901
@abstractmethod
905-
def unregister_heartbeater(self, task_token: bytes) -> None:
902+
async def unregister_heartbeater(self, task_token: bytes) -> None:
906903
"""Unregisters a previously registered heartbeater for the task
907904
token. This should also flush any pending heartbeats.
908905
"""

0 commit comments

Comments
 (0)