durabletask 0.0.0.dev40__tar.gz → 0.0.0.dev43__tar.gz
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.
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/PKG-INFO +1 -1
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/client.py +74 -51
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask.egg-info/PKG-INFO +1 -1
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/pyproject.toml +1 -1
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/LICENSE +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/README.md +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/__init__.py +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/entities/__init__.py +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/entities/durable_entity.py +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/entities/entity_context.py +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/entities/entity_instance_id.py +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/entities/entity_lock.py +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/entities/entity_metadata.py +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/entities/entity_operation_failed_exception.py +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/internal/entity_state_shim.py +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/internal/exceptions.py +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/internal/grpc_interceptor.py +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/internal/helpers.py +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/internal/json_encode_output_exception.py +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/internal/orchestration_entity_context.py +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/internal/orchestrator_service_pb2.py +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/internal/orchestrator_service_pb2.pyi +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/internal/orchestrator_service_pb2_grpc.py +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/internal/proto_task_hub_sidecar_service_stub.py +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/internal/shared.py +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/py.typed +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/task.py +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/worker.py +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask.egg-info/SOURCES.txt +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask.egg-info/dependency_links.txt +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask.egg-info/requires.txt +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask.egg-info/top_level.txt +0 -0
- {durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/setup.cfg +0 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import logging
|
|
5
5
|
import uuid
|
|
6
6
|
from dataclasses import dataclass
|
|
7
|
-
from datetime import datetime,
|
|
7
|
+
from datetime import datetime, timezone
|
|
8
8
|
from enum import Enum
|
|
9
9
|
from typing import Any, List, Optional, Sequence, TypeVar, Union
|
|
10
10
|
|
|
@@ -57,10 +57,10 @@ class OrchestrationState:
|
|
|
57
57
|
self.failure_details)
|
|
58
58
|
|
|
59
59
|
|
|
60
|
+
@dataclass
|
|
60
61
|
class PurgeInstancesResult:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
self.is_complete = is_complete
|
|
62
|
+
deleted_instance_count: int
|
|
63
|
+
is_complete: bool
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
class OrchestrationFailedError(Exception):
|
|
@@ -183,31 +183,42 @@ class TaskHubGrpcClient:
|
|
|
183
183
|
_continuation_token: Optional[pb2.StringValue] = None
|
|
184
184
|
) -> List[OrchestrationState]:
|
|
185
185
|
if max_instance_count is None:
|
|
186
|
-
#
|
|
186
|
+
# Some backends do not behave well with max_instance_count = None, so we set to max 32-bit signed value
|
|
187
187
|
max_instance_count = (1 << 31) - 1
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
_continuation_token=resp.continuationToken
|
|
188
|
+
|
|
189
|
+
self._logger.info(f"Querying orchestration instances with filters - "
|
|
190
|
+
f"created_time_from={created_time_from}, "
|
|
191
|
+
f"created_time_to={created_time_to}, "
|
|
192
|
+
f"runtime_status={[str(status) for status in runtime_status] if runtime_status else None}, "
|
|
193
|
+
f"max_instance_count={max_instance_count}, "
|
|
194
|
+
f"fetch_inputs_and_outputs={fetch_inputs_and_outputs}, "
|
|
195
|
+
f"continuation_token={_continuation_token.value if _continuation_token else None}")
|
|
196
|
+
|
|
197
|
+
states = []
|
|
198
|
+
|
|
199
|
+
while True:
|
|
200
|
+
req = pb.QueryInstancesRequest(
|
|
201
|
+
query=pb.InstanceQuery(
|
|
202
|
+
runtimeStatus=[status.value for status in runtime_status] if runtime_status else None,
|
|
203
|
+
createdTimeFrom=helpers.new_timestamp(created_time_from) if created_time_from else None,
|
|
204
|
+
createdTimeTo=helpers.new_timestamp(created_time_to) if created_time_to else None,
|
|
205
|
+
maxInstanceCount=max_instance_count,
|
|
206
|
+
fetchInputsAndOutputs=fetch_inputs_and_outputs,
|
|
207
|
+
continuationToken=_continuation_token
|
|
208
|
+
)
|
|
210
209
|
)
|
|
210
|
+
resp: pb.QueryInstancesResponse = self._stub.QueryInstances(req)
|
|
211
|
+
states += [parse_orchestration_state(res) for res in resp.orchestrationState]
|
|
212
|
+
# Check the value for continuationToken - none or "0" indicates that there are no more results.
|
|
213
|
+
if resp.continuationToken and resp.continuationToken.value and resp.continuationToken.value != "0":
|
|
214
|
+
self._logger.info(f"Received continuation token with value {resp.continuationToken.value}, fetching next list of instances...")
|
|
215
|
+
if _continuation_token and _continuation_token.value and _continuation_token.value == resp.continuationToken.value:
|
|
216
|
+
self._logger.warning(f"Received the same continuation token value {resp.continuationToken.value} again, stopping to avoid infinite loop.")
|
|
217
|
+
break
|
|
218
|
+
_continuation_token = resp.continuationToken
|
|
219
|
+
else:
|
|
220
|
+
break
|
|
221
|
+
|
|
211
222
|
states = [state for state in states if state is not None] # Filter out any None values
|
|
212
223
|
return states
|
|
213
224
|
|
|
@@ -295,6 +306,11 @@ class TaskHubGrpcClient:
|
|
|
295
306
|
created_time_to: Optional[datetime] = None,
|
|
296
307
|
runtime_status: Optional[List[OrchestrationStatus]] = None,
|
|
297
308
|
recursive: bool = False) -> PurgeInstancesResult:
|
|
309
|
+
self._logger.info("Purging orchestrations by filter: "
|
|
310
|
+
f"created_time_from={created_time_from}, "
|
|
311
|
+
f"created_time_to={created_time_to}, "
|
|
312
|
+
f"runtime_status={[str(status) for status in runtime_status] if runtime_status else None}, "
|
|
313
|
+
f"recursive={recursive}")
|
|
298
314
|
resp: pb.PurgeInstancesResponse = self._stub.PurgeInstances(pb.PurgeInstancesRequest(
|
|
299
315
|
instanceId=None,
|
|
300
316
|
purgeInstanceFilter=pb.PurgeInstanceFilter(
|
|
@@ -356,29 +372,36 @@ class TaskHubGrpcClient:
|
|
|
356
372
|
page_size: Optional[int] = None,
|
|
357
373
|
_continuation_token: Optional[pb2.StringValue] = None
|
|
358
374
|
) -> List[EntityMetadata]:
|
|
359
|
-
self._logger.info(f"
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
include_transient=include_transient,
|
|
381
|
-
page_size=page_size,
|
|
382
|
-
_continuation_token=resp.continuationToken
|
|
375
|
+
self._logger.info(f"Retrieving entities by filter: "
|
|
376
|
+
f"instance_id_starts_with={instance_id_starts_with}, "
|
|
377
|
+
f"last_modified_from={last_modified_from}, "
|
|
378
|
+
f"last_modified_to={last_modified_to}, "
|
|
379
|
+
f"include_state={include_state}, "
|
|
380
|
+
f"include_transient={include_transient}, "
|
|
381
|
+
f"page_size={page_size}")
|
|
382
|
+
|
|
383
|
+
entities = []
|
|
384
|
+
|
|
385
|
+
while True:
|
|
386
|
+
query_request = pb.QueryEntitiesRequest(
|
|
387
|
+
query=pb.EntityQuery(
|
|
388
|
+
instanceIdStartsWith=helpers.get_string_value(instance_id_starts_with),
|
|
389
|
+
lastModifiedFrom=helpers.new_timestamp(last_modified_from) if last_modified_from else None,
|
|
390
|
+
lastModifiedTo=helpers.new_timestamp(last_modified_to) if last_modified_to else None,
|
|
391
|
+
includeState=include_state,
|
|
392
|
+
includeTransient=include_transient,
|
|
393
|
+
pageSize=helpers.get_int_value(page_size),
|
|
394
|
+
continuationToken=_continuation_token
|
|
395
|
+
)
|
|
383
396
|
)
|
|
397
|
+
resp: pb.QueryEntitiesResponse = self._stub.QueryEntities(query_request)
|
|
398
|
+
entities += [EntityMetadata.from_entity_metadata(entity, query_request.query.includeState) for entity in resp.entities]
|
|
399
|
+
if resp.continuationToken and resp.continuationToken.value and resp.continuationToken.value != "0":
|
|
400
|
+
self._logger.info(f"Received continuation token with value {resp.continuationToken.value}, fetching next page of entities...")
|
|
401
|
+
if _continuation_token and _continuation_token.value and _continuation_token.value == resp.continuationToken.value:
|
|
402
|
+
self._logger.warning(f"Received the same continuation token value {resp.continuationToken.value} again, stopping to avoid infinite loop.")
|
|
403
|
+
break
|
|
404
|
+
_continuation_token = resp.continuationToken
|
|
405
|
+
else:
|
|
406
|
+
break
|
|
384
407
|
return entities
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/entities/entity_instance_id.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/internal/entity_state_shim.py
RENAMED
|
File without changes
|
|
File without changes
|
{durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/internal/grpc_interceptor.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask/internal/orchestrator_service_pb2.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{durabletask-0.0.0.dev40 → durabletask-0.0.0.dev43}/durabletask.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|