Skip to content

Promote to master #99

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 278 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
278 commits
Select commit Hold shift + click to select a range
d0f8f39
Docstring cont
scgbear Jan 17, 2020
57ee34e
Docstring cont.
scgbear Jan 17, 2020
86a4236
run flake8 only in azure/folder
Jan 18, 2020
567fbb7
Merge pull request #21 from shervyna/flake8
priyaananthasankar Jan 21, 2020
714ce8a
Merge branch 'dev' of https://github.com/Azure/azure-functions-durabl…
priyaananthasankar Jan 21, 2020
160deca
demo sample for function chaining with docstring and json changes
priyaananthasankar Jan 21, 2020
e8a9a11
pep8 naming
scgbear Jan 21, 2020
947699e
Merge branch 'dev' of github.com:Azure/azure-functions-durable-python…
scgbear Jan 21, 2020
a2e068d
Ignore hardcoded string tests
scgbear Jan 21, 2020
d1ec119
Merge branch 'dev' of github.com:Azure/azure-functions-durable-python…
scgbear Jan 21, 2020
94cd7ce
Work through regression bugs after renaming
scgbear Jan 21, 2020
02e08bd
Remove redundant tests
scgbear Jan 21, 2020
088751f
Merge pull request #25 from scgbear/bug/parsing-issues
priyaananthasankar Jan 21, 2020
6598806
Merge branch 'dev' into priya_samples
priyaananthasankar Jan 21, 2020
aee41a0
Merge pull request #20 from priyaananthasankar/priya_samples
priyaananthasankar Jan 21, 2020
4cd7257
Docstrings for several api level objects
scgbear Jan 21, 2020
96cfced
Package docstrings
scgbear Jan 21, 2020
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
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
9 changes: 9 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[flake8]
# delete D100 for docstring checks, promotes redundant documentation of what's in class docstring
# W503 contradicts with pep8 and will soon be fixed by flake8
ignore = W503, D100
max-line-length = 99
docstring-convention = numpy
exclude =
__pycache__,
azure/durable_functions/grpc/protobuf/
52 changes: 52 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Changelog

All notable changes to this project will be documented in this file.

## 1.0.0b3-b4
- Release to test CD pipeline with push to PyPI

## 1.0.0b2

### Fixed
- [Remove staticmethod definitions](https://github.com/Azure/azure-functions-durable-python/issues/65)

## 1.0.0b1

### Added

The following orchestration patterns are added:

- Function Chaining
- Fan In Fan Out
- Async HTTP APIs
- Human Interaction

#### API Parity
- CallActivity
- CallActivityWithRetry
- Task.all
- Task.any
- waitForExternalEvent
- continueAsNew
- callHttp
- currentUtcDateTime
- newUuid
- createCheckStatusResponse
- getStatus
- getStatusAll
- getStatusBy
- purgeInstanceHistory
- purgeInstanceHistoryBy
- raiseEvent
- startNew
- terminate
- waitForCompletionOrCreateCheckStatusResponse

### Changed
N/A

### Fixed
N/A

### Removed
N/A
173 changes: 173 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# Contributor Onboarding
Thank you for taking the time to contribute to Durable Functions in [Python](https://www.python.org/)

## Table of Contents

- [What should I know before I get started?](#what-should-i-know-before-i-get-started)
- [Pre-requisites](#pre-requisites)
- [Pull Request Change Flow](#pull-request-change-flow)
- [Development Setup](#development-setup)
- [Pre Commit Tasks](#pre-commit-tasks)
- [Continuous Integration Guidelines & Conventions](#continuous-integration-guidelines-&-conventions)
- [Getting Help](#getting-help)

## What should I know before I get started
- [Durable Functions Overview](https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-overview)
- [Durable Functions Application Patterns](https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-overview?tabs=csharp#application-patterns)
- [Azure Functions Python Overview](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-azure-function-azure-cli?tabs=bash%2Cbrowser&pivots=programming-language-python)

## Pre-requisites

- OS
- MacOS (or) Windows10 Ubuntu WSL
- Language Runtimes
- .NET Core 2.0
- \>= Python 3.6.x

Note: Some ML libraries may not be compatible with newer Python versions. Make sure the library is compatible with the Python version.

- Editor
- Visual Studio Code
- Python 3 Tools (pip install)
- [pytest](https://docs.pytest.org/en/latest/)
- [nox](https://nox.thea.codes/en/stable/)
- Azure Tools
- [Azure Storage Emulator](https://docs.microsoft.com/en-us/azure/storage/common/storage-use-emulator) (or) [Create a storage account in Azure](https://docs.microsoft.com/en-us/azure/storage/common/storage-account-create?tabs=azure-portal)
- [Azure Functions Core Tools](https://github.com/Azure/azure-functions-core-tools) v2.7.x and above.
- [Azure Storage Explorer](https://azure.microsoft.com/en-us/features/storage-explorer/)


## Pull Request Change flow

The general flow for making a change to the library is:

1. 🍴 Fork the repo (add the fork via `git remote add me <clone url here>`
2. 🌳 Create a branch for your change (generally branch from dev) (`git checkout -b my-change`)
3. 🛠 Make your change
4. ✔️ Test your change
5. ⬆️ Push your changes to your fork (`git push me my-change`)
6. 💌 Open a PR to the dev branch
7. 📢 Address feedback and make sure tests pass (yes even if it's an "unrelated" test failure)
8. 📦 [Rebase](https://git-scm.com/docs/git-rebase) your changes into meaningful commits (`git rebase -i HEAD~N` where `N` is commits you want to squash)
9. :shipit: Rebase and merge (This will be done for you if you don't have contributor access)
10. ✂️ Delete your branch (optional)

## Development Setup

### Visual Studio Code Extensions

The following extensions should be installed if using Visual Studio Code for debugging:

- Python support for Visual Studio Code (Python for VSCode extension)
- Azure Functions Extensions for Visual Studio Code v0.19.1 and above.
- autoDocString to generate documentation strings for Python API definitions.

### Python Virtual Environment

- Make sure a Python virtual environment is setup. If you are using VS Code, the Azure Functions Extension project will set one up for you. Alternately, you can set it up through command line as well.
Note: Conda based environments are not yet supported in Azure Functions.

### Setting up durable-py debugging


1. Git clone your fork and use any starter sample from this [folder] in your fork (https://github.com/Azure/azure-functions-durable-python/tree/dev/samples/) and open this folder in your VS Code editor.

2. Initialize this folder as an Azure Functions project using the VS Code Extension using these [instructions](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-vs-code?pivots=programming-language-python). This step will create a Python virtual environment if one doesn't exist already.

3. Add a local.settings.json file

```
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "<your connection string>",
"FUNCTIONS_WORKER_RUNTIME": "python"
}
}
```

4. Add a host.json file that looks like this

```
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[1.*, 2.0.0)"
}
}
```

5. Optionally, if you want to specify a custom task hub name, say MyTaskHub, you can add that in the host.json file like this:

```
{
"version": "2.0",
"extensions": {
"durableTask": {
"hubName": "MyTaskHub"
}
},
"extensionBundle": {
...
}
}
```

6. For debugging, install the code using an editable pip install like this, in the VS Code Terminal:

```
pip install -e $REPOSITORY_ROOT/
```
where REPOSITORY_ROOT is the root folder of the azure-functions-durable-python repository

7. Set breakpoints and click Run -> Start Debugging in VS Code. This should internally start the Azure Function using `func host start` command.

### Debugging end-to-end

If you want to debug into the Durable Task or any of the .NET bits, follow instructions below:

1. Open the Azure Storage Explorer and connect to the local storage emulator or the storage account you are using.
2. Make sure the Durable Python debugging is setup already and the debugger has started the `func` process.
3. In the VSCode editor for DurableTask, click Debug -> .NET Core Attach Process and search for `func host start` process and attach to it.
4. Add a breakpoint in both editors and continue debugging.

## Testing changes locally (Windows)

Follow all the steps above, use the Azure Storage Emulator for windows to simulate the storage account, and use Visual Studio to debug the .NET Durable Extension.

## Pre Commit Tasks

This library uses nox tooling for running unit tests and linting.

Make sure nox is pre-installed:
`pip install nox`

### Running unit tests

1. Add your unit tests under ./tests folder
2. Run: `nox --sessions tests`

### Running flake8 and flake8-docstring

Run: `nox --sessions lint`

This library uses [numpy docstring convention](https://numpydoc.readthedocs.io/en/latest/format.html) for code documentation.


## Continuous Integration Guidelines & Conventions

This project uses a combination of Azure DevOps and GitHub Actions for CI/CD.

- For each PR request/merge, a continuous integration pipeline will run internally that performs linting and running unit tests on your PR/merge.
- A GitHub Action will also perform CI tasks against your PR/merge. This is designed to provide more control to the contributor.
- Releases into PyPI will be curated and performed by a CD pipeline internally. See the Getting Help Section to request a release.

## Getting help

- Leave comments on your PR and @username for attention

### Requesting a release
- If you need a release into PyPI, request it by raising an issue and tagging @anthonychu or @davidmrdavid


91 changes: 32 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
|Branch|Status|
|---|---|
|master|[![Build Status](https://csefy19.visualstudio.com/Durable%20Functions%20Python%20OSS/_apis/build/status/Azure.azure-functions-durable-python?branchName=master)](https://csefy19.visualstudio.com/Durable%20Functions%20Python%20OSS/_build/latest?definitionId=39&branchName=master)|
|master|[![Build Status](https://azfunc.visualstudio.com/Azure%20Functions%20Python/_apis/build/status/Azure%20Functions%20Durable%20Python?branchName=master)](https://azfunc.visualstudio.com/Azure%20Functions%20Python/_build/latest?definitionId=44&branchName=master)|
|dev|[![Build Status](https://azfunc.visualstudio.com/Azure%20Functions%20Python/_apis/build/status/Azure%20Functions%20Durable%20Python?branchName=dev)](https://azfunc.visualstudio.com/Azure%20Functions%20Python/_build/latest?definitionId=44&branchName=dev)|

# Durable Functions for Python

The `azure-functions-durable` [pip](https://pypi.org/project/azure-functions-durable/) package allows you to write [Durable Functions](https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-overview) for Python(https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-python). Durable Functions is an extension of [Azure Functions](https://docs.microsoft.com/en-us/azure/azure-functions/functions-overview) that lets you write stateful functions and workflows in a serverless environment. The extension manages state, checkpoints, and restarts for you. Durable Functions' advantages include:
The `azure-functions-durable` [pip](https://pypi.org/project/azure-functions-durable/) package allows you to write [Durable Functions](https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-overview) for [Python](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-python). Durable Functions is an extension of [Azure Functions](https://docs.microsoft.com/en-us/azure/azure-functions/functions-overview) that lets you write stateful functions and workflows in a serverless environment. The extension manages state, checkpoints, and restarts for you. Durable Functions' advantages include:

* Define workflows in code. No JSON schemas or designers are needed.
* Call other functions synchronously and asynchronously. Output from called functions can be saved to local variables.
Expand All @@ -24,81 +25,53 @@ A durable function, or _orchestration_, is a solution made up of different types

Durable Functions' function types and features are documented in-depth [here.](https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-types-features-overview)

## Getting Started

You can follow the instructions below to get started with a function chaining example, or follow the general checklist below:
## Current limitations

1. Install prerequisites:
- [Azure Functions Core Tools version 2.x](https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local#install-the-azure-functions-core-tools)
- [Azure Storage Emulator](https://docs.microsoft.com/en-us/azure/storage/common/storage-use-emulator) (Windows) or an actual Azure storage account (Mac or Linux)
- Python 3.6 or later
We're actively working on Python support for Durable Functions and we expect a Public Preview announcement in Q2 CY2020. The following are the current known limitations.

2. [Create an Azure Functions app.](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-python)
### Functionality

3. Install the Durable Functions extension
* `DurableOrchestrationContext.create_timer()` is not yet supported (coming soon [#35](https://github.com/Azure/azure-functions-durable-python/issues/35))
* Sub-orchestrations are not yet supported (planned [#62](https://github.com/Azure/azure-functions-durable-python/issues/62))
* Durable Entities are not yet supported (not yet planned [#96](https://github.com/Azure/azure-functions-durable-python/issues/96))

Run this command from the root folder of your Azure Functions app:
```bash
func extensions install -p Microsoft.Azure.WebJobs.Extensions.DurableTask -v 1.8.3
```
### Tooling

**durable-functions requires Microsoft.Azure.WebJobs.Extensions.DurableTask 1.7.0 or greater.**
* Python Durable Functions requires updated versions of Azure Functions Core Tools that includes Python worker [1.1.0](https://github.com/Azure/azure-functions-python-worker/releases/tag/1.1.0), templates ([bundle-1.2.0](https://github.com/Azure/azure-functions-templates/releases/tag/bundle-1.2.0)), and extension bundles ([1.2.0](https://github.com/Azure/azure-functions-extension-bundles/releases/tag/1.2.0)) that are not yet released (ETA May 2020). Use the VS Code dev container in the [Getting Started](#getting-started) section to access a development environment with the required versions of the tools installed.

4. Install the `azure-durable-functions` pip package at the root of your function app:
### Deployment

Create and activate virtual environment
```
python3 -m venv env
source env/bin/activate
```
* Python Durable Functions requires an updated version of the Azure Functions Python language worker ([1.1.0](https://github.com/Azure/azure-functions-python-worker/releases/tag/1.1.0)) that is not yet available in Azure. Deploy your Python Durable Functions apps in containers (requires Premium or App Service plans). (Linux consumption plan support ETA May 2020)

```bash
pip install azure-durable-functions
```

5. Write an activity function ([see sample](./samples/python_durable_bindings/DurableActivity)):
```python
def main(name: str) -> str:
logging.info(f"Activity Triggered: {name}")
# your code here
```
## Getting Started

6. Write an orchestrator function ([see sample](./samples/python_durable_bindings/DurableOrchestrationTrigger)):
Follow these instructions to get started with Durable Functions in Python:

```python
def main(context: str):
orchestrate = df.Orchestrator.create(generator_function)
result = orchestrate(context)
return result
```
**🚀 [Python Durable Functions quickstart](https://aka.ms/pythondurable)**

**Note:** Orchestrator functions must follow certain [code constraints.](https://docs.microsoft.com/en-us/azure/azure-functions/durable-functions-checkpointing-and-replay#orchestrator-code-constraints)
## Samples

7. Write your client function ([see sample](./samples/DurableOrchestrationClient/)):
Take a look at this project's [samples directory](./samples/):

TBD
* [Function Chaining](./samples/function_chaining)
* [Fan-out/Fan-in - Simple](./samples/fan_out_fan_in)
* [Fan-out/Fan-in - TensorFlow](./samples/fan_out_fan_in_tensorflow)
* [External Events - Human Interaction & Timeouts](./samples/external_events)

**Note:** Client functions are started by a trigger binding available in the Azure Functions 2.x major version. [Read more about trigger bindings and 2.x-supported bindings.](https://docs.microsoft.com/en-us/azure/azure-functions/functions-triggers-bindings#overview)
### Orchestrator example

## Samples
```python
import azure.durable_functions as df

The [Durable Functions samples](https://docs.microsoft.com/en-us/azure/azure-functions/durable-functions-install) demonstrate several common use cases. They are located in the [samples directory.](./samples/) Descriptive documentation is also available:

* [Function Chaining - Hello Sequence](https://docs.microsoft.com/en-us/azure/azure-functions/durable-functions-sequence)
* [Fan-out/Fan-in - Cloud Backup](https://docs.microsoft.com/en-us/azure/azure-functions/durable-functions-cloud-backup)
* [Monitors - Weather Watcher](https://docs.microsoft.com/en-us/azure/azure-functions/durable-functions-monitor)
* [Human Interaction & Timeouts - Phone Verification](https://docs.microsoft.com/en-us/azure/azure-functions/durable-functions-phone-verification)
def orchestrator_function(context: df.DurableOrchestrationContext):
task1 = yield context.call_activity("DurableActivity", "One")
task2 = yield context.call_activity("DurableActivity", "Two")
task3 = yield context.call_activity("DurableActivity", "Three")

```python
def generator_function(context):
outputs = []
task1 = yield context.df.callActivity("DurableActivity", "One")
task2 = yield context.df.callActivity("DurableActivity", "Two")
task3 = yield context.df.callActivity("DurableActivity", "Three")
outputs = [task1, task2, task3]
return outputs

outputs.append(task1)
outputs.append(task2)
outputs.append(task3)

return outputs
main = df.Orchestrator.create(orchestrator_function)
```
Loading