Код: Выделить всё
keys = [
SearchAttributeKey.for_keyword(key)
for key in ('inquiryId', 'personId', 'flowId', 'reservationId', 'workspaceId', 'segmentId')
]
await client.operator_service.add_search_attributes(
AddSearchAttributesRequest(
namespace=client.namespace,
search_attributes={
key.name: IndexedValueType.ValueType(key.indexed_value_type)
for key in keys_to_create
},
),
)
Код: Выделить всё
await self._temporal_client.start_workflow(
ExecuteFlowWorkflow.run,
flow,
id=f"execute-flow-{uuid4()}",
task_queue=self._temporal_settings.task_queue,
search_attributes=TypedSearchAttributes([
SearchAttributePair(SearchAttributeKey.for_text(f"flowId"), str(flow.id)),
SearchAttributePair(SearchAttributeKey.for_text(f"personId"), str(person_id)),
SearchAttributePair(SearchAttributeKey.for_text(f"reservationId"), str(reservation_id)),
SearchAttributePair(SearchAttributeKey.for_text(f"workspaceId"), str(workspace_id)),
])
)
Код: Выделить всё
async for workflow in temporal_client.list_workflows(query='WorkflowType="ExecuteFlowWorkflow"', page_size=10000):
if workflow.status != WorkflowExecutionStatus.RUNNING:
continue
print(workflow.search_attributes)
# OUTPUT:
{'flowId': ['018fcbab-6642-7b8a-ab59-43ded6b563bb'], 'workspaceId': ['018c1bec-682c-7518-992a-ec875e8efe63'], 'reservationId': ['0190d10c-ba1e-759c-a9a1-590845cb120a'], 'personId': ['0190d10c-b8c7-7ad6-a0ff-cf5cd3d2b0a5']}
Код: Выделить всё
async for workflow in temporal_client.list_workflows(query=f'workspaceId="018c1bec-682c-7518-992a-ec875e8efe63"'):
print(workflow)
# No output
Подробнее здесь: https://stackoverflow.com/questions/787 ... s-not-work