Skip to content

Commit 6d9f149

Browse files
committed
Add some initial scaffolding
1 parent 90d5297 commit 6d9f149

10 files changed

Lines changed: 1430 additions & 0 deletions

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "submodules/durabletask-protobuf"]
2+
path = submodules/durabletask-protobuf
3+
url = https://github.com/microsoft/durabletask-protobuf

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ As the maintainer of this project, please make a few updates:
1010
- Understanding the security reporting process in SECURITY.MD
1111
- Remove this section from the README
1212

13+
### Generating protobufs
14+
If the gRPC proto definitions need to be updated, the corresponding source code can be regenerated using the following command from the `src/durabletask` directory:
15+
16+
```bash
17+
python3 -m grpc_tools.protoc --proto_path=../../submodules/durabletask-protobuf/protos --python_out=. --pyi_out=. --grpc_python_out=. orchestrator_service.proto
18+
```
19+
1320
## Contributing
1421

1522
This project welcomes contributions and suggestions. Most contributions require you to agree to a

setup.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from setuptools import setup
2+
3+
setup(
4+
name="durabletask",
5+
version="0.1",
6+
description="A Durable Task SDK for Python",
7+
license="MIT",
8+
author="Microsoft",
9+
python_requires=">=3.8",
10+
packages=["durabletask"],
11+
install_requires=[],
12+
)

src/durabletask/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""Durable Task SDK for Python"""
2+
3+
PACKAGE_NAME="durabletask"

src/durabletask/orchestrator_service_pb2.py

Lines changed: 155 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/durabletask/orchestrator_service_pb2.pyi

Lines changed: 595 additions & 0 deletions
Large diffs are not rendered by default.

src/durabletask/orchestrator_service_pb2_grpc.py

Lines changed: 609 additions & 0 deletions
Large diffs are not rendered by default.

src/durabletask/task.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from abc import ABC, abstractmethod
2+
from typing import TypeVar, Generic
3+
4+
T = TypeVar('T')
5+
6+
class Task(ABC, Generic[T]):
7+
"""Abstract base class for asynchronous tasks in a durable orchestration."""
8+
9+
def __init__(self) -> None:
10+
super().__init__()
11+
pass
12+
13+
@abstractmethod
14+
def is_complete(self) -> bool:
15+
pass
16+
17+
@abstractmethod
18+
def get_result(self) -> T:
19+
pass

src/durabletask/task_hub_client.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import grpc
2+
import orchestrator_service_pb2
3+
import orchestrator_service_pb2_grpc
4+
5+
class TaskHubGrpcClient:
6+
7+
async def schedule_new_orchestration(self):
8+
pass
9+
10+
async def wait_for_orchestration_start(self):
11+
pass
12+
13+
async def wait_for_orchestration_completion(self):
14+
pass
15+
16+
async def terminate_orchestration(self):
17+
pass
18+
19+
async def suspend_orchestration(self):
20+
pass
21+
22+
async def resume_orchestration(self):
23+
pass
24+
25+
async def raise_orchestration_event(self):
26+
pass

submodules/durabletask-protobuf

Submodule durabletask-protobuf added at 7d68268

0 commit comments

Comments
 (0)