Skip to content

Commit 3fcef31

Browse files
Merge branch 'main' into jobs-api
2 parents 5805397 + 147f1c4 commit 3fcef31

File tree

14 files changed

+75
-12
lines changed

14 files changed

+75
-12
lines changed

.github/workflows/fossa.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ jobs:
4343
uses: actions/checkout@v4
4444

4545
- name: "Run FOSSA Scan"
46-
uses: fossas/fossa-action@v1.4.0 # Use a specific version if locking is preferred
46+
uses: fossas/fossa-action@v1.7.0 # Use a specific version if locking is preferred
4747
with:
4848
api-key: ${{ env.FOSSA_API_KEY }}
4949

5050
- name: "Run FOSSA Test"
51-
uses: fossas/fossa-action@v1.4.0 # Use a specific version if locking is preferred
51+
uses: fossas/fossa-action@v1.7.0 # Use a specific version if locking is preferred
5252
with:
5353
api-key: ${{ env.FOSSA_API_KEY }}
5454
run-tests: true

dapr/actor/runtime/_reminder_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __init__(
3636
reminder_name: str,
3737
state: Optional[bytes],
3838
due_time: timedelta,
39-
period: timedelta,
39+
period: Optional[timedelta] = None,
4040
ttl: Optional[timedelta] = None,
4141
):
4242
"""Creates new :class:`ActorReminderData` instance.
@@ -77,7 +77,7 @@ def due_time(self) -> timedelta:
7777
return self._due_time
7878

7979
@property
80-
def period(self) -> timedelta:
80+
def period(self) -> Optional[timedelta]:
8181
"""Gets period of Actor Reminder."""
8282
return self._period
8383

dapr/actor/runtime/actor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ async def register_reminder(
112112
name: str,
113113
state: bytes,
114114
due_time: timedelta,
115-
period: timedelta,
115+
period: Optional[timedelta] = None,
116116
ttl: Optional[timedelta] = None,
117117
) -> None:
118118
"""Registers actor reminder.

dapr/actor/runtime/mock_actor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ async def register_reminder(
8686
name: str,
8787
state: bytes,
8888
due_time: timedelta,
89-
period: timedelta,
89+
period: Optional[timedelta] = None,
9090
ttl: Optional[timedelta] = None,
9191
) -> None:
9292
"""Adds actor reminder to self._state_manager._mock_reminders.

dapr/actor/runtime/state_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def ttl_in_seconds(self) -> Optional[int]:
5656
return self._ttl_in_seconds
5757

5858
@ttl_in_seconds.setter
59-
def ttl_in_seconds(self, new_ttl_in_seconds: int) -> None:
59+
def ttl_in_seconds(self, new_ttl_in_seconds: Optional[int]) -> None:
6060
self._ttl_in_seconds = new_ttl_in_seconds
6161

6262

dapr/clients/grpc/_request.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def __init__(
109109
super(InvokeMethodRequest, self).__init__(())
110110

111111
self._content_type = content_type
112-
self._http_verb = None
112+
self._http_verb: Optional[str] = None
113113
self._http_querystring: Dict[str, str] = {}
114114

115115
self.set_data(data)
@@ -127,7 +127,7 @@ def http_verb(self) -> Optional[str]:
127127
@http_verb.setter
128128
def http_verb(self, val: Optional[str]) -> None:
129129
"""Sets HTTP method to Dapr invocation request."""
130-
if val not in self.HTTP_METHODS:
130+
if val is not None and val not in self.HTTP_METHODS:
131131
raise ValueError(f'{val} is the invalid HTTP verb.')
132132
self._http_verb = val
133133

@@ -285,6 +285,7 @@ def __init__(
285285
data: Optional[Union[bytes, str]] = None,
286286
etag: Optional[str] = None,
287287
operation_type: TransactionOperationType = TransactionOperationType.upsert,
288+
metadata: Optional[Dict[str, str]] = None,
288289
):
289290
"""Initializes TransactionalStateOperation item from
290291
:obj:`runtime_v1.TransactionalStateOperation`.
@@ -305,6 +306,7 @@ def __init__(
305306
self._data = data # type: ignore
306307
self._etag = etag
307308
self._operation_type = operation_type
309+
self._metadata = metadata
308310

309311
@property
310312
def key(self) -> str:
@@ -326,6 +328,11 @@ def operation_type(self) -> TransactionOperationType:
326328
"""Gets etag."""
327329
return self._operation_type
328330

331+
@property
332+
def metadata(self) -> Dict[str, str]:
333+
"""Gets metadata."""
334+
return {} if self._metadata is None else self._metadata
335+
329336

330337
class EncryptRequestIterator(DaprRequest):
331338
"""An iterator for cryptography encrypt API requests.

dapr/clients/grpc/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,7 @@ def execute_state_transaction(
940940
key=o.key,
941941
value=to_bytes(o.data) if o.data is not None else to_bytes(''),
942942
etag=common_v1.Etag(value=o.etag) if o.etag is not None else None,
943+
metadata=o.metadata,
943944
),
944945
)
945946
for o in operations

daprdocs/content/en/python-sdk-docs/python-sdk-extensions/python-fastapi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class RawEventModel(BaseModel):
4747

4848
class User(BaseModel):
4949
id: int
50-
name = 'Jane Doe'
50+
name: str
5151

5252
class CloudEventModel(BaseModel):
5353
data: User

examples/state_store/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,15 @@ expected_stdout_lines:
4141
- "== APP == Cannot save bulk due to bad etags. ErrorCode=StatusCode.ABORTED"
4242
- "== APP == Got value=b'value_1' eTag=1"
4343
- "== APP == Got items with etags: [(b'value_1_updated', '2'), (b'value_2', '2')]"
44+
- "== APP == Transaction with outbox pattern executed successfully!"
45+
- "== APP == Got value after outbox pattern: b'val1'"
4446
- "== APP == Got values after transaction delete: [b'', b'']"
4547
- "== APP == Got value after delete: b''"
4648
timeout_seconds: 5
4749
-->
4850

4951
```bash
50-
dapr run -- python3 state_store.py
52+
dapr run --resources-path components/ -- python3 state_store.py
5153
```
5254
<!-- END_STEP -->
5355

@@ -68,6 +70,10 @@ The output should be as follows:
6870
6971
== APP == Got items with etags: [(b'value_1_updated', '2'), (b'value_2', '2')]
7072
73+
== APP == Transaction with outbox pattern executed successfully!
74+
75+
== APP == Got value after outbox pattern: b'val1'
76+
7177
== APP == Got values after transaction delete: [b'', b'']
7278
7379
== APP == Got value after delete: b''
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: dapr.io/v1alpha1
2+
kind: Component
3+
metadata:
4+
name: pubsub
5+
spec:
6+
type: pubsub.redis
7+
version: v1
8+
metadata:
9+
- name: redisHost
10+
value: localhost:6379
11+
- name: redisPassword
12+
value: ""

0 commit comments

Comments
 (0)