From 83551a9f882397e91c360bb0b9a985347041cabc Mon Sep 17 00:00:00 2001 From: David Justo Date: Fri, 3 Mar 2023 09:01:44 -0800 Subject: [PATCH 1/3] add fabric bot config (#425) --- .github/fabricbot.json | 536 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 536 insertions(+) create mode 100644 .github/fabricbot.json diff --git a/.github/fabricbot.json b/.github/fabricbot.json new file mode 100644 index 00000000..e08753f2 --- /dev/null +++ b/.github/fabricbot.json @@ -0,0 +1,536 @@ +{ + "version": "1.0", + "tasks": [ + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssuesOnlyResponder", + "version": "1.0", + "config": { + "taskName": "Add needs triage label to new issues", + "conditions": { + "operator": "and", + "operands": [ + { + "name": "isAction", + "parameters": { + "action": "opened" + } + }, + { + "operator": "not", + "operands": [ + { + "name": "isPartOfProject", + "parameters": {} + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "isAssignedToSomeone", + "parameters": {} + } + ] + } + ] + }, + "actions": [ + { + "name": "addLabel", + "parameters": { + "label": "Needs: Triage :mag:" + } + } + ], + "eventType": "issue", + "eventNames": [ + "issues", + "project_card" + ] + }, + "id": "TCZqLcGIj" + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssueCommentResponder", + "version": "1.0", + "config": { + "taskName": "Replace needs author feedback label with needs attention label when the author comments on an issue", + "conditions": { + "operator": "and", + "operands": [ + { + "name": "isAction", + "parameters": { + "action": "created" + } + }, + { + "name": "isActivitySender", + "parameters": { + "user": { + "type": "author" + } + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "Needs: Author Feedback" + } + } + ] + }, + "actions": [ + { + "name": "addLabel", + "parameters": { + "label": "Needs: Attention :wave:" + } + }, + { + "name": "removeLabel", + "parameters": { + "label": "Needs: Author Feedback" + } + } + ], + "eventType": "issue", + "eventNames": [ + "issue_comment" + ] + }, + "id": "f8AERPzkGt" + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssuesOnlyResponder", + "version": "1.0", + "config": { + "taskName": "Remove no recent activity label from issues", + "conditions": { + "operator": "and", + "operands": [ + { + "operator": "not", + "operands": [ + { + "name": "isAction", + "parameters": { + "action": "closed" + } + } + ] + }, + { + "name": "hasLabel", + "parameters": { + "label": "no-recent-activity" + } + } + ] + }, + "actions": [ + { + "name": "removeLabel", + "parameters": { + "label": "no-recent-activity" + } + } + ], + "eventType": "issue", + "eventNames": [ + "issues", + "project_card" + ] + }, + "id": "iz3b4ifNMz" + }, + { + "taskType": "scheduled", + "capabilityId": "ScheduledSearch", + "subCapability": "ScheduledSearch", + "version": "1.1", + "config": { + "taskName": "Close stale issues", + "frequency": [ + { + "weekDay": 0, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 1, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 2, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 3, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 4, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 5, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 6, + "hours": [ + 0, + 6, + 12, + 18 + ] + } + ], + "searchTerms": [ + { + "name": "isIssue", + "parameters": {} + }, + { + "name": "isOpen", + "parameters": {} + }, + { + "name": "hasLabel", + "parameters": { + "label": "Needs: Author Feedback" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "no-recent-activity" + } + }, + { + "name": "noActivitySince", + "parameters": { + "days": 3 + } + } + ], + "actions": [ + { + "name": "closeIssue", + "parameters": {} + } + ] + }, + "id": "cnjUEhVUAa" + }, + { + "taskType": "scheduled", + "capabilityId": "ScheduledSearch", + "subCapability": "ScheduledSearch", + "version": "1.1", + "config": { + "taskName": "Add no recent activity label to issues", + "frequency": [ + { + "weekDay": 0, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 1, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 2, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 3, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 4, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 5, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 6, + "hours": [ + 0, + 6, + 12, + 18 + ] + } + ], + "searchTerms": [ + { + "name": "isIssue", + "parameters": {} + }, + { + "name": "isOpen", + "parameters": {} + }, + { + "name": "hasLabel", + "parameters": { + "label": "Needs: Author Feedback" + } + }, + { + "name": "noActivitySince", + "parameters": { + "days": 4 + } + }, + { + "name": "noLabel", + "parameters": { + "label": "no-recent-activity" + } + } + ], + "actions": [ + { + "name": "addLabel", + "parameters": { + "label": "no-recent-activity" + } + }, + { + "name": "addReply", + "parameters": { + "comment": "This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**." + } + } + ] + }, + "id": "53YGS8DptJ" + }, + { + "taskType": "scheduled", + "capabilityId": "ScheduledSearch", + "subCapability": "ScheduledSearch", + "version": "1.1", + "config": { + "taskName": "Close duplicate issues", + "frequency": [ + { + "weekDay": 0, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 1, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 2, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 3, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 4, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 5, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 6, + "hours": [ + 0, + 6, + 12, + 18 + ] + } + ], + "searchTerms": [ + { + "name": "isIssue", + "parameters": {} + }, + { + "name": "isOpen", + "parameters": {} + }, + { + "name": "hasLabel", + "parameters": { + "label": "duplicate" + } + }, + { + "name": "noActivitySince", + "parameters": { + "days": 1 + } + } + ], + "actions": [ + { + "name": "addReply", + "parameters": { + "comment": "This issue has been marked as duplicate and has not had any activity for **1 day**. It will be closed for housekeeping purposes." + } + }, + { + "name": "closeIssue", + "parameters": {} + } + ] + }, + "id": "B3MvNRf8yD" + }, + { + "taskType": "trigger", + "capabilityId": "ReleaseAnnouncement", + "subCapability": "ReleaseAnnouncement", + "version": "1.0", + "id": "eT3hzThQI", + "config": { + "prReply": ":loudspeaker: **${pkgName} ${version}** has been released which incorporates this pull request.\n\n* [Release notes](https://github.com/${owner}/${repo}/releases/tag/${version})\n* [Official nuget.org release](https://www.nuget.org/packages/${pkgName}/${versionNumber})", + "taskName": "Announce a fix has been released", + "issueReply": ":loudspeaker: This issue was addressed in #${prNumber}, which has now been successfully released as **${pkgName} ${version}**.\n\n* [Release notes](https://github.com/${owner}/${repo}/releases/tag/${version})\n* [Official nuget.org release](https://www.nuget.org/packages/${pkgName}/${versionNumber})" + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssueCommentResponder", + "version": "1.0", + "config": { + "eventType": "issue", + "eventNames": [ + "issue_comment" + ], + "conditions": { + "operator": "and", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "no-recent-activity" + } + } + ] + }, + "taskName": "Remove no recent activity label when an issue is commented on", + "actions": [ + { + "name": "removeLabel", + "parameters": { + "label": "no-recent-activity" + } + } + ] + }, + "id": "ciziQmUSW" + } + ], + "userGroups": [] +} \ No newline at end of file From 8b5c1f368bdc30b287841dbbc726b1d11c1d563e Mon Sep 17 00:00:00 2001 From: kogad <44827429+kogad@users.noreply.github.com> Date: Fri, 7 Apr 2023 01:17:08 +0900 Subject: [PATCH 2/3] Remove dupulicated `lambda: ` (#431) --- azure/durable_functions/models/DurableOrchestrationClient.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure/durable_functions/models/DurableOrchestrationClient.py b/azure/durable_functions/models/DurableOrchestrationClient.py index 6b5630a2..6b473c2c 100644 --- a/azure/durable_functions/models/DurableOrchestrationClient.py +++ b/azure/durable_functions/models/DurableOrchestrationClient.py @@ -437,7 +437,7 @@ async def terminate(self, instance_id: str, reason: str) -> None: switch_statement = { 202: lambda: None, # instance in progress 410: lambda: None, # instance failed or terminated - 404: lambda: lambda: f"No instance with ID '{instance_id}' found.", + 404: lambda: f"No instance with ID '{instance_id}' found.", } has_error_message = switch_statement.get( From 00e3a340f8f8e8a7d8d75a40f25235b4bb599a7e Mon Sep 17 00:00:00 2001 From: David Justo Date: Wed, 12 Apr 2023 09:23:07 -0700 Subject: [PATCH 3/3] Add initial blueprint support (#432) --- azure/durable_functions/__init__.py | 3 ++- .../durable_functions/decorators/__init__.py | 5 +++-- .../decorators/durable_app.py | 19 ++++++++++++++++--- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/azure/durable_functions/__init__.py b/azure/durable_functions/__init__.py index a6c4f934..d0946f37 100644 --- a/azure/durable_functions/__init__.py +++ b/azure/durable_functions/__init__.py @@ -74,7 +74,8 @@ def validate_extension_bundles(): try: # disabling linter on this line because it fails to recognize the conditional export - from .decorators import DFApp # noqa + from .decorators import DFApp, BluePrint # noqa __all__.append('DFApp') + __all__.append('BluePrint') except ModuleNotFoundError: pass diff --git a/azure/durable_functions/decorators/__init__.py b/azure/durable_functions/decorators/__init__.py index 87615a51..604e543e 100644 --- a/azure/durable_functions/decorators/__init__.py +++ b/azure/durable_functions/decorators/__init__.py @@ -1,8 +1,9 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """Decorator definitions for Durable Functions.""" -from .durable_app import DFApp +from .durable_app import DFApp, BluePrint __all__ = [ - "DFApp" + "DFApp", + "BluePrint" ] diff --git a/azure/durable_functions/decorators/durable_app.py b/azure/durable_functions/decorators/durable_app.py index 5b57cd8b..5219be39 100644 --- a/azure/durable_functions/decorators/durable_app.py +++ b/azure/durable_functions/decorators/durable_app.py @@ -11,10 +11,14 @@ from functools import wraps -class DFApp(FunctionRegister, TriggerApi, BindingApi): - """Durable Functions (DF) app. +class BluePrint(TriggerApi, BindingApi): + """Durable Functions (DF) blueprint container. + + It allows functions to be declared via trigger and binding decorators, + but does not automatically index/register these functions. - Exports the decorators required to register DF Function-types. + To register these functions, utilize the `register_functions` method from any + :class:`FunctionRegister` subclass, such as `DFApp`. """ def __init__(self, @@ -226,3 +230,12 @@ def decorator(): return decorator() return wrap + + +class DFApp(BluePrint, FunctionRegister): + """Durable Functions (DF) app. + + Exports the decorators required to declare and index DF Function-types. + """ + + pass