Skip to content

Promote to master #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 295 commits into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
295 commits
Select commit Hold shift + click to select a range
6c3cf13
task_utility docstrings
scgbear Jan 21, 2020
1ad001c
ActivityType docstrings
scgbear Jan 21, 2020
c822292
Doc strings for Actions
scgbear Jan 21, 2020
5110546
Doc Strings History
scgbear Jan 21, 2020
a2fa8a2
Final docstring bits
scgbear Jan 21, 2020
e1eaa44
Merge branch 'dev' of github.com:Azure/azure-functions-durable-python…
scgbear Jan 21, 2020
ab6bf56
add waitforexternalevent basic files
Jan 22, 2020
d40dae3
fix bugs to make waitForExternalEvent working
Jan 22, 2020
5b129d6
add waitforexternalevent samples
Jan 22, 2020
4857676
remove explicit binding_info imp
scgbear Jan 22, 2020
2f46197
Merge pull request #26 from scgbear/features/function-chaining
priyaananthasankar Jan 22, 2020
d36ba81
demo sample for function chaining with docstring and json changes
priyaananthasankar Jan 22, 2020
d4363e3
Merge branch 'priya_samples' of https://github.com/priyaananthasankar…
priyaananthasankar Jan 22, 2020
f88745e
demo sample for function chaining with docstring and json changes
priyaananthasankar Jan 22, 2020
713f220
Merge branch 'dev' into priya_samples
priyaananthasankar Jan 22, 2020
a48385f
added dev pipeline status in README
priyaananthasankar Jan 22, 2020
b680bf4
Merge branch 'dev' into readme_blurb
priyaananthasankar Jan 22, 2020
e83553f
Merge pull request #32 from priyaananthasankar/readme_blurb
priyaananthasankar Jan 22, 2020
637ac75
minor fixes(variable name, delete comment)
Jan 25, 2020
f17824c
flake8 fixes
Jan 25, 2020
92b44a3
merge dev
Jan 25, 2020
458080e
add docstrings
Jan 25, 2020
18ff4a9
implement task_any function
Jan 25, 2020
45e4320
change pip install library and add docstrings to samples
priyaananthasankar Jan 26, 2020
642cd17
Merge branch 'priya_samples' of https://github.com/priyaananthasankar…
priyaananthasankar Jan 26, 2020
54ce47f
Merge branch 'dev' into priya_samples
priyaananthasankar Jan 26, 2020
14f6808
change pip install library and add docstrings to samples
priyaananthasankar Jan 26, 2020
4fb3b01
Merge branch 'priya_samples' of https://github.com/priyaananthasankar…
priyaananthasankar Jan 26, 2020
b6ce069
Merge pull request #31 from priyaananthasankar/priya_samples
priyaananthasankar Jan 26, 2020
a770cbd
unittest for waitforexternalevents
Jan 27, 2020
1c017c2
fix bugs after merging dev
Jan 27, 2020
6adca1b
fix flake8
Jan 27, 2020
633ba0b
Base implementation of tests
scgbear Jan 27, 2020
9b8c142
parrot values success
scgbear Jan 27, 2020
bffaf51
test full complete flow
scgbear Jan 27, 2020
c742b94
test failed scenario
scgbear Jan 27, 2020
80181a5
docstring to numpy format
Jan 28, 2020
bcfe725
minor changes (rename, remove logging)
Jan 28, 2020
c943314
unittest for task_any, added tasks_test_utils
Jan 28, 2020
fd56235
add class __eq__ function for Waitforexternalevent actions
Jan 28, 2020
d5ccb54
add samples readme doc
Jan 28, 2020
4dd7632
fix flake8
Jan 28, 2020
d36bbd0
Refactoring HistoryEvent
scgbear Jan 28, 2020
48de0a2
add docstrings for HistoryEvent class
scgbear Jan 28, 2020
472eb76
Refactor json conversion
scgbear Jan 28, 2020
6d9ffe4
simple Fan out fan in sample
scgbear Jan 28, 2020
68453cd
Fix flake errors
scgbear Jan 28, 2020
b4f88fc
Remove local debugging bits
scgbear Jan 28, 2020
19e7fcc
remove state in task_any
Jan 29, 2020
1ed87ba
add handle faulted task_any case +unittest
Jan 29, 2020
fb46614
Undo De Morgan's Law
scgbear Jan 29, 2020
f449f62
replace filters with list comprehension
scgbear Jan 29, 2020
cea9b8c
Add documentation for tracking API implementation
scgbear Jan 29, 2020
5008b3b
move datetime format string to azure package
scgbear Jan 29, 2020
e5b1400
replace filter with list comprehension
scgbear Jan 30, 2020
49c80c6
remove extra zimezone from format
scgbear Jan 30, 2020
b3098a9
Push context initialization our of handle method
scgbear Jan 30, 2020
57203eb
Merge pull request #38 from scgbear/documentation/api-implementation-…
priyaananthasankar Jan 31, 2020
e172f6e
able to pass in tasksets to task_any and task_all
Feb 3, 2020
48fe9ff
Merge branch 'dev' into issue/27/waitForExternalEvent
Feb 3, 2020
5a4e3c4
update unittest for adding timestamp to taskset, add unittest for pas…
Feb 3, 2020
d271bd0
fix bugs in task_all(when all tasks fail), and fix unittest for that …
Feb 3, 2020
6ae0d95
fix flake8
Feb 3, 2020
00e8918
test from orchestrator level(draft)
Feb 4, 2020
8ac85af
Merge branch 'dev' of github.com:Azure/azure-functions-durable-python…
scgbear Feb 5, 2020
9fb5102
Remove IFunctionContext abstraction
scgbear Feb 5, 2020
1fa68ac
Starting of schema validation bits
scgbear Feb 6, 2020
01c24df
createCheckStatusResponse()
Feb 6, 2020
50d1bbe
wire up schema validation into the orchestrator tests
scgbear Feb 6, 2020
1c4fe49
Test commit
scgbear Feb 7, 2020
56a566a
fix flake 8 issues
scgbear Feb 7, 2020
4de893c
Merge pull request #45 from scgbear/dev
priyaananthasankar Feb 7, 2020
e244a73
merge dev
Feb 7, 2020
48a081b
fix pytest, remove task_any_tests from orchestrator level
Feb 7, 2020
7e1f61c
fix flake8
Feb 7, 2020
0862e00
implement raise_event api, fix docstring
Feb 10, 2020
325219e
Merge pull request #29 from shervyna/issue/27/waitForExternalEvent
priyaananthasankar Feb 11, 2020
40ca24c
add unittest, create separate methods, fix naming style, handle place…
Feb 11, 2020
c87c252
Fan Out Fan In sample
scgbear Feb 11, 2020
92a2090
fix flake8
Feb 12, 2020
4183093
merge dev
Feb 12, 2020
c25eecc
add aiohttp to requirement.txt and setup.py
Feb 12, 2020
d5e28c7
add async await to start_new and raise_event api, flake8
Feb 12, 2020
fd638b3
update api_implementation_status
Feb 12, 2020
ce5f4ee
fix variable naming style in docstring
Feb 12, 2020
8fc7f55
update sample for external events, update readme in sample/external_e…
Feb 12, 2020
bfe9827
Refactoring and docstrings
scgbear Feb 12, 2020
ead107f
Continue as new implementation
scgbear Feb 12, 2020
bb43dd7
new_guid implementation
scgbear Feb 12, 2020
62ad2c5
Fix flake8 issues
scgbear Feb 12, 2020
eea874d
update sample to simple version
Feb 13, 2020
85db5e2
add func.httpresponse in durableorchestratorClient.py
Feb 13, 2020
104f859
update docstring for createcheckstatusresponse api
Feb 13, 2020
27bf076
fix flake8
Feb 13, 2020
93145d4
update sample for create_check_status_response fixes
Feb 13, 2020
64b5f1c
update pytest for the changes in createcheckstatusresponse api, add a…
Feb 13, 2020
b2eace1
Implementation of call_http
scgbear Feb 13, 2020
5f68ba3
Remove traceback print statement
scgbear Feb 13, 2020
5eff795
remove url validator
Feb 14, 2020
6608f34
Updates from demo feedback
scgbear Feb 14, 2020
3230d63
Fix flake8
scgbear Feb 14, 2020
9f27e1f
copy paste error
scgbear Feb 14, 2020
89e3464
remove abcd from sample
Feb 14, 2020
69016eb
Update API_IMPLEMENTATION_STATUS.md
priyaananthasankar Feb 14, 2020
cbcb47d
Merge pull request #51 from Azure/priyaananthasankar-patch-1
priyaananthasankar Feb 14, 2020
60a42fb
Merge branch 'dev' into samples/high-cpu-fan-out
priyaananthasankar Feb 15, 2020
eae53c4
Merge pull request #46 from scgbear/samples/high-cpu-fan-out
priyaananthasankar Feb 15, 2020
6689767
Merge branch 'dev' of github.com:Azure/azure-functions-durable-python…
scgbear Feb 15, 2020
7df1ef7
Merge pull request #50 from scgbear/features/orchestrator-api
priyaananthasankar Feb 15, 2020
2365832
Unit tests for call_http
scgbear Feb 15, 2020
71eddbc
merged shervyna changes
priyaananthasankar Feb 16, 2020
4343d1e
Merge branch 'dev' into shervyna_changes
priyaananthasankar Feb 16, 2020
48ae802
Merge pull request #53 from priyaananthasankar/shervyna_changes
scgbear Feb 18, 2020
812237a
Merge branch 'dev' of github.com:Azure/azure-functions-durable-python…
scgbear Feb 18, 2020
558d551
Merge pull request #52 from scgbear/tests/call_http
scgbear Feb 18, 2020
9d2e480
Fix the squiggles
scgbear Feb 19, 2020
90f6691
Move iAction
scgbear Feb 19, 2020
dab93a8
Update actions to implement action base class
scgbear Feb 19, 2020
5926a7e
remove the squiggles
scgbear Feb 19, 2020
42eef99
Fix format of docstring
scgbear Feb 19, 2020
d381f3b
update to use rpc_base_url for start new and raise event urls
scgbear Feb 19, 2020
f5f2c74
minor updates
scgbear Feb 19, 2020
2852c80
flake8 bits
scgbear Feb 19, 2020
d6db7da
Add action_type property of base class
scgbear Feb 19, 2020
516ff60
update docstrings per convention
scgbear Feb 19, 2020
03ee5e3
docstring convention updates
scgbear Feb 19, 2020
12a30cb
Base class implementations for get_status
scgbear Feb 20, 2020
2754dbf
refactor massive string into a Dict[str, Any] object
scgbear Feb 20, 2020
3b598b5
Move duplicate test rpc url constants to centralized location
scgbear Feb 20, 2020
8e22e7b
adding updated contributing and getting started guides
asedighi Feb 20, 2020
17d254c
get_status implementation
scgbear Feb 21, 2020
f1460c3
Merge pull request #55 from scgbear/features/client-api
scgbear Feb 21, 2020
3e71ce2
Merge branch 'dev' of github.com:Azure/azure-functions-durable-python…
scgbear Feb 21, 2020
13fae66
test for DurableOrchestrationStatus parsing
scgbear Feb 21, 2020
1424ba4
Add non ok message tests
scgbear Feb 21, 2020
a7b18be
add raises exception test
scgbear Feb 21, 2020
0a110a1
get_status_by and get_status_all implementation
scgbear Feb 21, 2020
05e2602
flake8 fixes
scgbear Feb 21, 2020
3ff041e
fix docstring for get_status_by parameters
scgbear Feb 21, 2020
2288eec
addig nox to the project - updated requirements file
asedighi Feb 21, 2020
d65575c
Updated noxfile to include flake, move getting started to investigations
asedighi Feb 21, 2020
e0b1fa1
typo in the commit from Jscript to python
asedighi Feb 24, 2020
49baa84
PR recommendations
scgbear Feb 25, 2020
45e5f28
add docstrings for new public functions
scgbear Feb 25, 2020
671cae3
Continued Client API implementation
scgbear Feb 25, 2020
d76764a
bug fixed for retry function.
asedighi Feb 25, 2020
4e19ac5
refactor tests
scgbear Feb 26, 2020
c04154c
unit tests for purge history and terminate
scgbear Feb 26, 2020
03ba160
unit tests for wait or create check response
scgbear Feb 26, 2020
95b67f1
update implementation status with features included in branch
scgbear Feb 26, 2020
43e6cd1
update name match the name of the class under test
scgbear Feb 26, 2020
c7748d7
change to use asynio sleep
scgbear Feb 27, 2020
9628393
Use azure-functions>=1.2.0
anthonychu Mar 1, 2020
8d32b82
Make DurableOrchestrationContext available for import
anthonychu Mar 1, 2020
344f540
Update start_new type hints to return str
anthonychu Mar 1, 2020
f3ff50f
Add get_input to DurableOrchestrationContext
anthonychu Mar 1, 2020
7165442
Allow passing OrchestrationContext to create
anthonychu Mar 1, 2020
966e3cc
Change str to Awaitable[str]
anthonychu Mar 2, 2020
d620a20
Add get_input tests, get_input always returns str
anthonychu Mar 3, 2020
68cd452
Fix flake8 errors
anthonychu Mar 3, 2020
de04569
Merge pull request #60 from anthonychu/anthony-20200301
anthonychu Mar 3, 2020
c659f93
add furl to setup.py
scgbear Mar 4, 2020
7c2d7dc
Merge branch 'dev' of github.com:Azure/azure-functions-durable-python…
scgbear Mar 4, 2020
66b12cd
Fix merge error
scgbear Mar 4, 2020
61fac3b
# This is a combination of 3 commits. (#58)
Hazhzeng Mar 4, 2020
1d1a079
Merge branch 'dev' into features/client-api
scgbear Mar 5, 2020
3f4a34c
Replace badge with the new Azure Functions Python pipeline
Mar 5, 2020
06f6482
Merge pull request #61 from Azure/hazeng/new-pipeline
scgbear Mar 6, 2020
8ce1a42
Merge branch 'dev' of github.com:Azure/azure-functions-durable-python…
scgbear Mar 6, 2020
4b9169b
Merge pull request #56 from scgbear/features/client-api
priyaananthasankar Mar 9, 2020
6b5151b
edited contributor guide
priyaananthasankar Mar 11, 2020
3ded407
Merge branch 'art_2' into dev
asedighi Mar 11, 2020
c4c9bf6
resolved conflict for requirements.txt
asedighi Mar 11, 2020
4398525
furl is required for this project - added it to the requirements.doc
asedighi Mar 11, 2020
8cfe2c2
Merge pull request #64 from asedighi/dev
priyaananthasankar Mar 11, 2020
42471d3
Merge branch 'dev' into pr57
priyaananthasankar Mar 11, 2020
5e0f3b1
Merge pull request #63 from priyaananthasankar/pr57
priyaananthasankar Mar 11, 2020
1e9eb23
fixed pytest-asyncio in requirements.txt
priyaananthasankar Mar 11, 2020
c8dbba2
fixed pytest-asyncio in requirements.txt
priyaananthasankar Mar 12, 2020
c7468e7
fixed pytest-asyncio in requirements.txt
priyaananthasankar Mar 12, 2020
452cebd
Merge pull request #66 from priyaananthasankar/priya_pytest_asyncio
priyaananthasankar Mar 12, 2020
2c6b2f3
Remove static method tag (#72)
scgbear Mar 13, 2020
eb0b696
Remove furl from RpcManagementOptions
scgbear Mar 13, 2020
4a1c89d
release artifacts
priyaananthasankar Mar 13, 2020
e4229da
Merge pull request #74 from scgbear/refactor/remove-furl
priyaananthasankar Mar 13, 2020
7b0e38a
Merge branch 'dev' into priya_release_branch
priyaananthasankar Mar 13, 2020
5777d7d
Merge pull request #75 from priyaananthasankar/priya_release_branch
priyaananthasankar Mar 13, 2020
148c10c
Added DateUtil and Furl to install_requires
priyaananthasankar Mar 13, 2020
92c4035
Merge pull request #76 from priyaananthasankar/priya_release_branch
priyaananthasankar Mar 13, 2020
e64b260
changelog and setup.py changes
priyaananthasankar Mar 13, 2020
fcdb726
Merge pull request #79 from priyaananthasankar/priya_release_branch
priyaananthasankar Mar 14, 2020
0a21906
Update azure-pipelines.yml for Azure Pipelines
asedighi Mar 17, 2020
1485284
Update azure-pipelines.yml for Azure Pipelines
asedighi Mar 17, 2020
ecff33a
Update azure-pipelines.yml for Azure Pipelines
asedighi Mar 17, 2020
3041f5d
Update azure-pipelines.yml for Azure Pipelines
asedighi Mar 17, 2020
385125c
Update azure-pipelines.yml for Azure Pipelines
asedighi Mar 17, 2020
995dae3
Update azure-pipelines.yml for Azure Pipelines
asedighi Mar 17, 2020
081bab4
Update azure-pipelines.yml for Azure Pipelines
asedighi Mar 17, 2020
a18dc60
Update azure-pipelines.yml for Azure Pipelines
asedighi Mar 17, 2020
6db87e8
tested version of pipeline yaml
asedighi Mar 17, 2020
23c850f
Update azure-pipelines.yml for Azure Pipelines
asedighi Mar 18, 2020
7461265
Update azure-pipelines.yml for Azure Pipelines
asedighi Mar 18, 2020
5942d49
Update azure-pipelines.yml for Azure Pipelines
asedighi Mar 18, 2020
7241037
Update azure-pipelines.yml for Azure Pipeline
asedighi Mar 19, 2020
333a2cb
Update azure-pipelines.yml for Azure Pipelines
asedighi Mar 19, 2020
5a2082c
Update azure-pipelines.yml for Azure Pipelines
asedighi Mar 19, 2020
7cfda0e
Update azure-pipelines.yml for Azure Pipelines
asedighi Mar 19, 2020
de4a6d1
Update azure-pipelines.yml for Azure Pipelines
asedighi Mar 19, 2020
5975b4d
Update azure-pipelines.yml for Azure Pipelines
asedighi Mar 19, 2020
65c1afa
Update azure-pipelines.yml for Azure Pipelines
asedighi Mar 19, 2020
71686a7
Merge pull request #81 from Azure/art-testing-azure-pipelines
priyaananthasankar Mar 19, 2020
cd0d988
setup.py CD testing
priyaananthasankar Mar 19, 2020
ddc2282
setup.py CD testing
priyaananthasankar Mar 19, 2020
e6c5dcb
Merge branch 'dev' into pipeline_test
priyaananthasankar Mar 19, 2020
88e7c6b
Merge pull request #83 from priyaananthasankar/pipeline_test
priyaananthasankar Mar 19, 2020
5b110d4
PyPI testing
priyaananthasankar Mar 19, 2020
d345ec5
Merge pull request #84 from priyaananthasankar/pipeline_test
priyaananthasankar Mar 19, 2020
fb65791
added info logging to the external event sample
asedighi Mar 24, 2020
4cc93fa
Merge pull request #88 from asedighi/logging-telemetary-addition
priyaananthasankar Mar 24, 2020
d01677a
Correctness and documentation of the samples (#85)
davidmrdavid Mar 25, 2020
121f3a2
Fixed Contributor Guide Issues
priyaananthasankar Mar 26, 2020
9e0f4aa
Fixed Contributor Guide Issues
priyaananthasankar Mar 27, 2020
bc6e44f
Merge branch 'dev' into priya_contribguide_issues
priyaananthasankar Mar 27, 2020
366aab0
Input value not required for start_new
davidmrdavid Mar 27, 2020
54368cb
Merge branch 'dev' into priya_contribguide_issues
priyaananthasankar Mar 27, 2020
77bca2d
Merge pull request #92 from priyaananthasankar/priya_contribguide_issues
priyaananthasankar Mar 27, 2020
c440e95
Add limitations, link to quickstart, update samples
anthonychu Mar 29, 2020
fe24892
Update example
anthonychu Mar 29, 2020
ec87389
Add link
anthonychu Mar 29, 2020
a2de756
Update words
anthonychu Mar 29, 2020
7ad7af3
Add versions
anthonychu Mar 29, 2020
15ca68d
Update links
anthonychu Mar 30, 2020
6814730
Merge pull request #97 from anthonychu/20200328-update-readme-devcont…
priyaananthasankar Mar 30, 2020
6592177
versioning-via-tags is enabled (#101)
davidmrdavid Mar 30, 2020
1f16145
updated readme for external events (#103)
asedighi Apr 1, 2020
d271980
Readme file for FanOutFanIn (#104)
priyaananthasankar Apr 4, 2020
fcac54e
Add activity trigger return type sample (#105)
Hazhzeng Apr 10, 2020
4639b78
misc contributions (#108)
davidmrdavid Apr 14, 2020
bc0b459
Set Custom Status (#110)
priyaananthasankar Apr 27, 2020
5c81db9
Enabled nox to recognize docstring formatting errors (#122)
davidmrdavid Jun 10, 2020
5893abe
enables trivial orchestrators (#121)
davidmrdavid Jun 10, 2020
53be9b6
removed grpc folder (#120)
davidmrdavid Jun 10, 2020
57c57da
[WIP] Semi-automatic type-serialization (#109)
davidmrdavid Jun 10, 2020
c7c710b
Promote to master (#99) (#126)
davidmrdavid Jun 10, 2020
87fb580
Promote to master (#99) (#127)
davidmrdavid Jun 10, 2020
3dcbc08
Merge branch 'master' into dev
davidmrdavid Jun 10, 2020
ceba652
Monitoring Feature (#119)
priyaananthasankar Jun 18, 2020
e2f1041
updated CHANGELOG (#128)
davidmrdavid Jun 18, 2020
9e560c7
Changelog includes links (#129)
davidmrdavid Jun 18, 2020
be50bbe
merged master
davidmrdavid Jun 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactoring HistoryEvent
Get rid of all of those hardcoded property value references
  • Loading branch information
scgbear committed Jan 28, 2020
commit d36bbd0b0aec5b0514486a21e45a32c03c0de4c4
8 changes: 0 additions & 8 deletions azure/durable_functions/interfaces/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +0,0 @@
"""Interfaces for durable functions."""
from .IAction import IAction
from .IFunctionContext import IFunctionContext

__all__ = [
'IAction',
'IFunctionContext'
]
9 changes: 3 additions & 6 deletions azure/durable_functions/models/DurableOrchestrationContext.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import json
import logging
import datetime
from typing import List, Any, Dict

from dateutil.parser import parse as dt_parse

from . import (RetryOptions)
from .history import HistoryEvent, HistoryEventType
from ..interfaces import IAction
Expand All @@ -22,7 +19,7 @@ class DurableOrchestrationContext:
def __init__(self,
context_string: str):
context: Dict[str, Any] = json.loads(context_string)
self._histories: List[HistoryEvent] = context.get("history")
self._histories: List[HistoryEvent] = [HistoryEvent(**he) for he in context.get("history")]
self._instance_id = context.get("instanceId")
self._is_replaying = context.get("isReplaying")
self._parent_instance_id = context.get("parentInstanceId")
Expand All @@ -38,10 +35,10 @@ def __init__(self,
input_=i)
self.task_all = lambda t: task_all(tasks=t)
self.decision_started_event: HistoryEvent = list(filter(
lambda e_: e_["EventType"] == HistoryEventType.ORCHESTRATOR_STARTED,
lambda e_: e_.event_type == HistoryEventType.ORCHESTRATOR_STARTED,
self.histories))[0]
self._current_utc_datetime = \
dt_parse(self.decision_started_event["Timestamp"])
self.decision_started_event.timestamp
self.new_guid_counter = 0
self.actions: List[List[IAction]] = []

Expand Down
5 changes: 3 additions & 2 deletions azure/durable_functions/models/OrchestratorState.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import List, Any, Dict

from .utils.json_utils import add_attrib
from ..interfaces.IAction import IAction


class OrchestratorState:
Expand All @@ -13,7 +14,7 @@ class OrchestratorState:

def __init__(self,
is_done: bool,
actions: List[List[Any]],
actions: List[List[IAction]],
output: Any,
error: str = None,
custom_status: Any = None):
Expand All @@ -24,7 +25,7 @@ def __init__(self,
self._custom_status: Any = custom_status

@property
def actions(self) -> List[List[Any]]:
def actions(self) -> List[List[IAction]]:
"""Get the ordered list of async actions the orchestrator function should perform.

This list is append-only; it must contain all scheduled async actions up to the latest
Expand Down
5 changes: 5 additions & 0 deletions azure/durable_functions/models/Task.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from datetime import datetime

from tests.test_utils.constants import DATETIME_STRING_FORMAT
from ..interfaces import IAction


Expand Down Expand Up @@ -56,6 +58,9 @@ def timestamp(self) -> datetime:
"""Get the timestamp of the task."""
return self._timestamp

def timestamp_as_string(self):
return self._timestamp.strftime(DATETIME_STRING_FORMAT)

@property
def id(self):
"""Get the ID number of the task.
Expand Down
4 changes: 2 additions & 2 deletions azure/durable_functions/models/TaskSet.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import List
from ..interfaces import IAction
from ..interfaces.IAction import IAction


class TaskSet:
Expand Down Expand Up @@ -36,7 +36,7 @@ def is_faulted(self) -> bool:
return self._is_faulted

@property
def actions(self) -> IAction:
def actions(self) -> List[IAction]:
"""Get the scheduled action represented by the task.

_Internal use only._
Expand Down
49 changes: 43 additions & 6 deletions azure/durable_functions/models/history/HistoryEvent.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,49 @@
import datetime
from dateutil.parser import parse as dt_parse
from .HistoryEventType import HistoryEventType


class HistoryEvent:
"""Used to communicate state relevant information from the durable extension to the client."""

def __init__(self):
self.EventType: HistoryEventType
self.EventId: int
self.IsPlayed: bool
self.Timestamp: str
self.IsProcessed: bool = False
# noinspection PyPep8Naming
def __init__(self, EventType: HistoryEventType, EventId: int, IsPlayed: bool, Timestamp: str,
**kwargs):
self._event_type: HistoryEventType = EventType
self._event_id: int = EventId
self._is_played: bool = IsPlayed
self._timestamp: datetime = dt_parse(Timestamp)
self._is_processed: bool = False
if kwargs is not None:
[self.__setattr__(key, value) for key, value in kwargs.items()]

@property
def event_type(self) -> HistoryEventType:
"""Get the history event type

Returns
----------
HistoryEventType: The type of history event

"""
return self._event_type

@property
def event_id(self) -> int:
return self._event_id

@property
def is_played(self) -> bool:
return self._is_played

@property
def is_processed(self) -> bool:
return self._is_processed

@is_processed.setter
def is_processed(self, value: bool):
self._is_processed = value

@property
def timestamp(self) -> datetime:
return self._timestamp
38 changes: 30 additions & 8 deletions azure/durable_functions/models/utils/json_utils.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,54 @@
from typing import Dict, Any

from tests.test_utils.constants import DATETIME_STRING_FORMAT


def add_attrib(json_dict: Dict[str, Any], object_,
attribute_name: str, alt_name: str = None):
"""Add the value of the attribute from the object to the dictionary.

Used to dynamically add the value of the attribute if the value is present.

:param json_dict: The dictionary to add the attribute to
:param object_: The object to look for the attribute on
:param attribute_name: The name of the attribute to look for
:param alt_name: An alternate name to provide to the attribute in the in the dictionary
Parameters
----------
json_dict: The dictionary to add the attribute to
object_: The object to look for the attribute on
attribute_name: The name of the attribute to look for
alt_name: An alternate name to provide to the attribute in the in the dictionary
"""
if hasattr(object_, attribute_name):
json_dict[alt_name or attribute_name] = \
getattr(object_, attribute_name)


def add_datetime_attrib(json_dict: Dict[str, Any], object_,
attribute_name: str, alt_name: str = None):
"""Add the value of the attribute from the object to the dictionary converted into a string.

Parameters
----------
json_dict: The dictionary to add the attribute to
object_: The object to look for the attribute on
attribute_name: The name of the attribute to look for
alt_name: An alternate name to provide to the attribute in the in the dictionary
"""
if hasattr(object_, attribute_name):
json_dict[alt_name or attribute_name] = \
getattr(object_, attribute_name).strftime(DATETIME_STRING_FORMAT)


def add_json_attrib(json_dict: Dict[str, Any], object_,
attribute_name: str, alt_name: str = None):
"""Add the results of the to_json() function call of the attribute from the object to the dict.

Used to dynamically add the JSON converted value of the attribute if the value is present.

:param json_dict: The dictionary to add the attribute to
:param object_: The object to look for the attribute on
:param attribute_name: The name of the attribute to look for
:param alt_name: An alternate name to provide to the attribute in the in the dictionary
Parameters
----------
json_dict: The dictionary to add the attribute to
object_: The object to look for the attribute on
attribute_name: The name of the attribute to look for
alt_name: An alternate name to provide to the attribute in the in the dictionary
"""
if hasattr(object_, attribute_name):
json_dict[alt_name or attribute_name] = getattr(object_, attribute_name).to_json()
21 changes: 7 additions & 14 deletions azure/durable_functions/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@
Responsible for orchestrating the execution of the user defined generator
function.
"""
import logging
import traceback
from typing import Callable, Iterator, Any

from dateutil.parser import parse as dt_parse

from .interfaces import IFunctionContext
from .interfaces.IFunctionContext import IFunctionContext
from .models import (
DurableOrchestrationContext,
Task,
Expand Down Expand Up @@ -37,7 +33,7 @@ def __init__(self,
self.fn: Callable[[IFunctionContext], Iterator[Any]] = activity_func
self.customStatus: Any = None

# noinspection PyAttributeOutsideInit
# noinspection PyAttributeOutsideInit,PyUnboundLocalVariable
def handle(self, context_string: str):
"""Handle the orchestration of the user defined generator function.

Expand Down Expand Up @@ -86,8 +82,6 @@ def handle(self, context_string: str):
actions=self.durable_context.actions,
custom_status=self.customStatus)
except Exception as e:
e_string = traceback.format_exc()
logging.warning(f"!!!Generator Termination Exception {e_string}")
orchestration_state = OrchestratorState(
is_done=False,
output=None, # Should have no output, after generation range
Expand All @@ -113,20 +107,19 @@ def _add_to_actions(self, generation_state):
self.durable_context.actions.append(generation_state.actions)

def _reset_timestamp(self):
last_timestamp = dt_parse(
self.durable_context.decision_started_event['Timestamp'])
last_timestamp = self.durable_context.decision_started_event.timestamp
decision_started_events = list(
filter(lambda e_: (
e_["EventType"] == HistoryEventType.ORCHESTRATOR_STARTED
and dt_parse(e_["Timestamp"]) > last_timestamp),
e_.event_type == HistoryEventType.ORCHESTRATOR_STARTED
and e_.timestamp > last_timestamp),
self.durable_context.histories))
if len(decision_started_events) == 0:
self.durable_context.current_utc_datetime = None
else:
self.durable_context.decision_started_event = \
decision_started_events[0]
self.durable_context.current_utc_datetime = dt_parse(
self.durable_context.decision_started_event['Timestamp'])
self.durable_context.current_utc_datetime = \
self.durable_context.decision_started_event.timestamp

@classmethod
def create(cls, fn):
Expand Down
12 changes: 6 additions & 6 deletions azure/durable_functions/tasks/call_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ def call_activity_task(
is_faulted=False,
action=new_action,
result=parse_history_event(task_completed),
timestamp=task_completed["Timestamp"],
id_=task_completed["TaskScheduledId"])
timestamp=task_completed.timestamp,
id_=task_completed.TaskScheduledId)

if task_failed is not None:
return Task(
is_completed=True,
is_faulted=True,
action=new_action,
result=task_failed["Reason"],
timestamp=task_failed["Timestamp"],
id_=task_failed["TaskScheduledId"],
result=task_failed.Reason,
timestamp=task_failed.timestamp,
id_=task_failed.TaskScheduledId,
exc=Exception(
f"{task_failed['Reason']} \n {task_failed['Details']}")
f"{task_failed.Reason} \n {task_failed.Details}")
)

return Task(is_completed=False, is_faulted=False, action=new_action)
11 changes: 5 additions & 6 deletions azure/durable_functions/tasks/call_activity_with_retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,19 @@ def call_activity_with_retry_task(
is_faulted=False,
action=new_action,
result=parse_history_event(task_completed),
timestamp=task_completed["Timestamp"],
id_=task_completed["TaskScheduledId"])
timestamp=task_completed.timestamp,
id_=task_completed.TaskScheduledId)

if task_failed and task_retry_timer and attempt + 1 >= \
retry_options.max_number_of_attempts:
return Task(
is_completed=True,
is_faulted=True,
action=new_action,
result=task_failed["Reason"],
timestamp=task_failed["Timestamp"],
id_=task_failed["TaskScheduledId"],
timestamp=task_failed.timestamp,
id_=task_failed.TaskScheduledId,
exc=Exception(
f"{task_failed['Reason']} \n {task_failed['Details']}")
f"{task_failed.Reason} \n {task_failed.Details}")
)

return Task(is_completed=False, is_faulted=False, action=new_action)
Loading