durabletask 0.0.0.dev54__tar.gz → 0.0.0.dev56__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.dev54 → durabletask-0.0.0.dev56}/PKG-INFO +1 -1
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/client.py +45 -70
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask.egg-info/PKG-INFO +1 -1
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/pyproject.toml +1 -1
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/LICENSE +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/README.md +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/__init__.py +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/entities/__init__.py +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/entities/durable_entity.py +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/entities/entity_context.py +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/entities/entity_instance_id.py +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/entities/entity_lock.py +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/entities/entity_metadata.py +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/entities/entity_operation_failed_exception.py +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/internal/entity_state_shim.py +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/internal/exceptions.py +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/internal/grpc_interceptor.py +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/internal/helpers.py +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/internal/json_encode_output_exception.py +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/internal/orchestration_entity_context.py +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/internal/orchestrator_service_pb2.py +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/internal/orchestrator_service_pb2.pyi +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/internal/orchestrator_service_pb2_grpc.py +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/internal/proto_task_hub_sidecar_service_stub.py +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/internal/shared.py +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/py.typed +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/task.py +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/worker.py +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask.egg-info/SOURCES.txt +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask.egg-info/dependency_links.txt +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask.egg-info/requires.txt +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask.egg-info/top_level.txt +0 -0
- {durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/setup.cfg +0 -0
|
@@ -9,7 +9,6 @@ from enum import Enum
|
|
|
9
9
|
from typing import Any, List, Optional, Sequence, TypeVar, Union
|
|
10
10
|
|
|
11
11
|
import grpc
|
|
12
|
-
from google.protobuf import wrappers_pb2 as pb2
|
|
13
12
|
|
|
14
13
|
from durabletask.entities import EntityInstanceId
|
|
15
14
|
from durabletask.entities.entity_metadata import EntityMetadata
|
|
@@ -57,6 +56,27 @@ class OrchestrationState:
|
|
|
57
56
|
self.failure_details)
|
|
58
57
|
|
|
59
58
|
|
|
59
|
+
@dataclass
|
|
60
|
+
class OrchestrationQuery:
|
|
61
|
+
created_time_from: Optional[datetime] = None
|
|
62
|
+
created_time_to: Optional[datetime] = None
|
|
63
|
+
runtime_status: Optional[List[OrchestrationStatus]] = None
|
|
64
|
+
# Some backends don't respond well with max_instance_count = None, so we use the integer limit for non-paginated
|
|
65
|
+
# results instead.
|
|
66
|
+
max_instance_count: Optional[int] = (1 << 31) - 1
|
|
67
|
+
fetch_inputs_and_outputs: bool = False
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@dataclass
|
|
71
|
+
class EntityQuery:
|
|
72
|
+
instance_id_starts_with: Optional[str] = None
|
|
73
|
+
last_modified_from: Optional[datetime] = None
|
|
74
|
+
last_modified_to: Optional[datetime] = None
|
|
75
|
+
include_state: bool = True
|
|
76
|
+
include_transient: bool = False
|
|
77
|
+
page_size: Optional[int] = None
|
|
78
|
+
|
|
79
|
+
|
|
60
80
|
@dataclass
|
|
61
81
|
class PurgeInstancesResult:
|
|
62
82
|
deleted_instance_count: int
|
|
@@ -170,46 +190,24 @@ class TaskHubGrpcClient:
|
|
|
170
190
|
return new_orchestration_state(req.instanceId, res)
|
|
171
191
|
|
|
172
192
|
def get_all_orchestration_states(self,
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
runtime_status=None,
|
|
179
|
-
max_instance_count=max_instance_count,
|
|
180
|
-
fetch_inputs_and_outputs=fetch_inputs_and_outputs
|
|
181
|
-
)
|
|
193
|
+
orchestration_query: Optional[OrchestrationQuery] = None
|
|
194
|
+
) -> List[OrchestrationState]:
|
|
195
|
+
if orchestration_query is None:
|
|
196
|
+
orchestration_query = OrchestrationQuery()
|
|
197
|
+
_continuation_token = None
|
|
182
198
|
|
|
183
|
-
|
|
184
|
-
created_time_from: Optional[datetime] = None,
|
|
185
|
-
created_time_to: Optional[datetime] = None,
|
|
186
|
-
runtime_status: Optional[List[OrchestrationStatus]] = None,
|
|
187
|
-
max_instance_count: Optional[int] = None,
|
|
188
|
-
fetch_inputs_and_outputs: bool = False,
|
|
189
|
-
_continuation_token: Optional[pb2.StringValue] = None
|
|
190
|
-
) -> List[OrchestrationState]:
|
|
191
|
-
if max_instance_count is None:
|
|
192
|
-
# Some backends do not behave well with max_instance_count = None, so we set to max 32-bit signed value
|
|
193
|
-
max_instance_count = (1 << 31) - 1
|
|
194
|
-
|
|
195
|
-
self._logger.info(f"Querying orchestration instances with filters - "
|
|
196
|
-
f"created_time_from={created_time_from}, "
|
|
197
|
-
f"created_time_to={created_time_to}, "
|
|
198
|
-
f"runtime_status={[str(status) for status in runtime_status] if runtime_status else None}, "
|
|
199
|
-
f"max_instance_count={max_instance_count}, "
|
|
200
|
-
f"fetch_inputs_and_outputs={fetch_inputs_and_outputs}, "
|
|
201
|
-
f"continuation_token={_continuation_token.value if _continuation_token else None}")
|
|
199
|
+
self._logger.info(f"Querying orchestration instances with query: {orchestration_query}")
|
|
202
200
|
|
|
203
201
|
states = []
|
|
204
202
|
|
|
205
203
|
while True:
|
|
206
204
|
req = pb.QueryInstancesRequest(
|
|
207
205
|
query=pb.InstanceQuery(
|
|
208
|
-
runtimeStatus=[status.value for status in runtime_status] if runtime_status else None,
|
|
209
|
-
createdTimeFrom=helpers.new_timestamp(created_time_from) if created_time_from else None,
|
|
210
|
-
createdTimeTo=helpers.new_timestamp(created_time_to) if created_time_to else None,
|
|
211
|
-
maxInstanceCount=max_instance_count,
|
|
212
|
-
fetchInputsAndOutputs=fetch_inputs_and_outputs,
|
|
206
|
+
runtimeStatus=[status.value for status in orchestration_query.runtime_status] if orchestration_query.runtime_status else None,
|
|
207
|
+
createdTimeFrom=helpers.new_timestamp(orchestration_query.created_time_from) if orchestration_query.created_time_from else None,
|
|
208
|
+
createdTimeTo=helpers.new_timestamp(orchestration_query.created_time_to) if orchestration_query.created_time_to else None,
|
|
209
|
+
maxInstanceCount=orchestration_query.max_instance_count,
|
|
210
|
+
fetchInputsAndOutputs=orchestration_query.fetch_inputs_and_outputs,
|
|
213
211
|
continuationToken=_continuation_token
|
|
214
212
|
)
|
|
215
213
|
)
|
|
@@ -318,7 +316,6 @@ class TaskHubGrpcClient:
|
|
|
318
316
|
f"runtime_status={[str(status) for status in runtime_status] if runtime_status else None}, "
|
|
319
317
|
f"recursive={recursive}")
|
|
320
318
|
resp: pb.PurgeInstancesResponse = self._stub.PurgeInstances(pb.PurgeInstancesRequest(
|
|
321
|
-
instanceId=None,
|
|
322
319
|
purgeInstanceFilter=pb.PurgeInstanceFilter(
|
|
323
320
|
createdTimeFrom=helpers.new_timestamp(created_time_from) if created_time_from else None,
|
|
324
321
|
createdTimeTo=helpers.new_timestamp(created_time_to) if created_time_to else None,
|
|
@@ -357,46 +354,24 @@ class TaskHubGrpcClient:
|
|
|
357
354
|
return EntityMetadata.from_entity_metadata(res.entity, include_state)
|
|
358
355
|
|
|
359
356
|
def get_all_entities(self,
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
instance_id_starts_with=None,
|
|
365
|
-
last_modified_from=None,
|
|
366
|
-
last_modified_to=None,
|
|
367
|
-
include_state=include_state,
|
|
368
|
-
include_transient=include_transient,
|
|
369
|
-
page_size=page_size
|
|
370
|
-
)
|
|
357
|
+
entity_query: Optional[EntityQuery] = None) -> List[EntityMetadata]:
|
|
358
|
+
if entity_query is None:
|
|
359
|
+
entity_query = EntityQuery()
|
|
360
|
+
_continuation_token = None
|
|
371
361
|
|
|
372
|
-
|
|
373
|
-
instance_id_starts_with: Optional[str] = None,
|
|
374
|
-
last_modified_from: Optional[datetime] = None,
|
|
375
|
-
last_modified_to: Optional[datetime] = None,
|
|
376
|
-
include_state: bool = True,
|
|
377
|
-
include_transient: bool = False,
|
|
378
|
-
page_size: Optional[int] = None,
|
|
379
|
-
_continuation_token: Optional[pb2.StringValue] = None
|
|
380
|
-
) -> List[EntityMetadata]:
|
|
381
|
-
self._logger.info(f"Retrieving entities by filter: "
|
|
382
|
-
f"instance_id_starts_with={instance_id_starts_with}, "
|
|
383
|
-
f"last_modified_from={last_modified_from}, "
|
|
384
|
-
f"last_modified_to={last_modified_to}, "
|
|
385
|
-
f"include_state={include_state}, "
|
|
386
|
-
f"include_transient={include_transient}, "
|
|
387
|
-
f"page_size={page_size}")
|
|
362
|
+
self._logger.info(f"Retrieving entities by filter: {entity_query}")
|
|
388
363
|
|
|
389
364
|
entities = []
|
|
390
365
|
|
|
391
366
|
while True:
|
|
392
367
|
query_request = pb.QueryEntitiesRequest(
|
|
393
368
|
query=pb.EntityQuery(
|
|
394
|
-
instanceIdStartsWith=helpers.get_string_value(instance_id_starts_with),
|
|
395
|
-
lastModifiedFrom=helpers.new_timestamp(last_modified_from) if last_modified_from else None,
|
|
396
|
-
lastModifiedTo=helpers.new_timestamp(last_modified_to) if last_modified_to else None,
|
|
397
|
-
includeState=include_state,
|
|
398
|
-
includeTransient=include_transient,
|
|
399
|
-
pageSize=helpers.get_int_value(page_size),
|
|
369
|
+
instanceIdStartsWith=helpers.get_string_value(entity_query.instance_id_starts_with),
|
|
370
|
+
lastModifiedFrom=helpers.new_timestamp(entity_query.last_modified_from) if entity_query.last_modified_from else None,
|
|
371
|
+
lastModifiedTo=helpers.new_timestamp(entity_query.last_modified_to) if entity_query.last_modified_to else None,
|
|
372
|
+
includeState=entity_query.include_state,
|
|
373
|
+
includeTransient=entity_query.include_transient,
|
|
374
|
+
pageSize=helpers.get_int_value(entity_query.page_size),
|
|
400
375
|
continuationToken=_continuation_token
|
|
401
376
|
)
|
|
402
377
|
)
|
|
@@ -414,13 +389,13 @@ class TaskHubGrpcClient:
|
|
|
414
389
|
|
|
415
390
|
def clean_entity_storage(self,
|
|
416
391
|
remove_empty_entities: bool = True,
|
|
417
|
-
release_orphaned_locks: bool = True
|
|
418
|
-
_continuation_token: Optional[pb2.StringValue] = None
|
|
392
|
+
release_orphaned_locks: bool = True
|
|
419
393
|
) -> CleanEntityStorageResult:
|
|
420
394
|
self._logger.info("Cleaning entity storage")
|
|
421
395
|
|
|
422
396
|
empty_entities_removed = 0
|
|
423
397
|
orphaned_locks_released = 0
|
|
398
|
+
_continuation_token = None
|
|
424
399
|
|
|
425
400
|
while True:
|
|
426
401
|
req = pb.CleanEntityStorageRequest(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/entities/entity_instance_id.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/internal/entity_state_shim.py
RENAMED
|
File without changes
|
|
File without changes
|
{durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/durabletask/internal/grpc_interceptor.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{durabletask-0.0.0.dev54 → durabletask-0.0.0.dev56}/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.dev54 → durabletask-0.0.0.dev56}/durabletask.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|