purge_instance_history_by raises exception when optional created_time_from is not passed
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 42/100
Hướng nghiên cứu
Bắt đầu trong azure/durable_functions/models/DurableOrchestrationClient.py tại purge_instance_history_by, đặc biệt là đường dẫn dẫn đến delete_async_request quanh dòng 413. Tái hiện vấn đề với ví dụ function_app.py chỉ sử dụng created_time_to, sau đó so sánh với trường hợp created_time_from đang hoạt động. Hoàn tất khi việc purge chỉ với created_time_to không còn trả về lỗi 400 đã được báo cáo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
🐛 Describe the bug
A clear and concise description of what the bug is.
When created_time_from: Optional[datetime] = None is not passed to purge_instance_history_by it causes an exception in delete_async_request.
Exception has occurred: Exception
The operation failed with an unexpected status code 400
File "/home/andre/code/durable-function/.venv/lib/python3.10/site-packages/azure/durable_functions/models/DurableOrchestrationClient.py", line 413, in purge_instance_history_by
return self._parse_purge_instance_history_response(response)
File "/home/andre/code/durable-function/function_app.py", line 15, in http_clean
result = await client.purge_instance_history_by(
File "/home/andre/code/durable-function/.venv/lib/python3.10/site-packages/azure/durable_functions/decorators/durable_app.py", line 199, in df_client_middleware
return await user_code(*args, **kwargs)
File "/usr/lib/azure-functions-core-tools-4/workers/python/3.10/LINUX/X64/azure_functions_worker/extension.py", line 147, in get_async_invocation_wrapper
result = await function(**args)
File "/usr/lib/azure-functions-core-tools-4/workers/python/3.10/LINUX/X64/azure_functions_worker/dispatcher.py", line 758, in _run_async_func
return await ExtensionManager.get_async_invocation_wrapper(
File "/usr/lib/azure-functions-core-tools-4/workers/python/3.10/LINUX/X64/azure_functions_worker/dispatcher.py", line 475, in _handle__invocation_request
call_result = await self._run_async_func(
File "/usr/lib/azure-functions-core-tools-4/workers/python/3.10/LINUX/X64/azure_functions_worker/dispatcher.py", line 261, in _dispatch_grpc_request
resp = await request_handler(request)
File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/usr/lib/python3.10/asyncio/base_events.py", line 1909, in _run_once
handle._run()
File "/usr/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
self._run_once()
File "/usr/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
self.run_forever()
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/azure-functions-core-tools-4/workers/python/3.10/LINUX/X64/azure_functions_worker/main.py", line 49, in main
return aio_compat.run(start_async(
File "/usr/lib/azure-functions-core-tools-4/workers/python/3.10/LINUX/X64/worker.py", line 74, in <module>
main.main()
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
Exception: The operation failed with an unexpected status code 400
🤔 Expected behavior
What should have happened?
Clean instances older than created_time_to. Or purge_instance_history_by not to allow None in created_time_to.
☕ Steps to reproduce
What Durable Functions patterns are you using, if any?
Any minimal reproducer we can use?
Yes. function_app.py below replicates the issue.
import azure.functions as func
import azure.durable_functions as df
from datetime import datetime, timedelta
app = df.DFApp(http_auth_level=func.AuthLevel.ANONYMOUS)
@app.route(route="clean")
@app.durable_client_input(client_name="client")
async def http_clean(req: func.HttpRequest, client: df.DurableOrchestrationClient):
now = datetime.today()
created_time_to = now + timedelta(minutes=1) # leave at least 1 mins
# Clean up function
result = await client.purge_instance_history_by(
created_time_to=created_time_to,
)
return f"Cleaned {result.instances_deleted}"
For example if only created_time_from is passed, it works as expected and the entries are deleted but if only created_time_to is passed, it throws the 400 exception.
created_time_from = now - timedelta(hours=50)
# Clean up function
result = await client.purge_instance_history_by(
created_time_from=created_time_from,
)
Are you running this locally or on Azure?
Locally.
azure-functions==1.17.0
azure-functions-durable==1.2.8
⚡If deployed to Azure
We have access to a lot of telemetry that can help with investigations. Please provide as much of the following information as you can to help us investigate!
- Timeframe issue observed:
- Function App name:
- Function name(s):
- Azure region:
- Orchestration instance ID(s):
- Azure storage account name:
If you don't want to share your Function App or storage account name GitHub, please at least share the orchestration instance ID. Otherwise it's extremely difficult to look up information.
- Ngôn ngữ chính
- Python
- Star
- 157
- Fork
- 70
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Azure/azure-functions-durable-python
-
Enhancement fixed-in-v2 P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Azure/azure-functions-durable-python#617 · 1 bình luận ·
-
bug Debuggability fixed-in-v2 P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Azure/azure-functions-durable-python#587 · 2 bình luận · 1 reaction ·
-
Custom object serialization broken for orchestrator return valuesCó thể đã có người làm @andystaples đã nhận 68 ngày trước. Đang mởbug fixed-in-v2 P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Azure/azure-functions-durable-python#568 · 1 bình luận ·
-
bug fixed-in-v2 P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Azure/azure-functions-durable-python#475 · 1 bình luận ·
-
Enhancement fixed-in-v2 P3
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 62/100
Azure/azure-functions-durable-python#618 · 1 bình luận ·
Tất cả issue của Azure/azure-functions-durable-python
Issue tương tự
-
Link Checker ReportĐang mởautomated issue report
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
RapidAI/RapidOCRDocs#119 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
btclib-org/btclib-node#1833 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
IRIS reader: no-data velocity bins (DB_VEL, DB_VELC) returned as 0.0 m/s instead of NaNCó thể đã có người làm @syedhamidali đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
elodin-sys/elodin#890 ·
Maintainer thường phản hồi trong vòng 1 ngày