durabletask 0.2.0__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of durabletask might be problematic. Click here for more details.
- {durabletask-0.2.0 → durabletask-0.2.1}/PKG-INFO +5 -2
- {durabletask-0.2.0 → durabletask-0.2.1}/durabletask.egg-info/PKG-INFO +5 -2
- {durabletask-0.2.0 → durabletask-0.2.1}/durabletask.egg-info/SOURCES.txt +1 -5
- durabletask-0.2.1/durabletask.egg-info/requires.txt +2 -0
- {durabletask-0.2.0 → durabletask-0.2.1}/pyproject.toml +3 -5
- durabletask-0.2.0/durabletask.egg-info/requires.txt +0 -1
- durabletask-0.2.0/tests/test_activity_executor.py +0 -57
- durabletask-0.2.0/tests/test_client.py +0 -88
- durabletask-0.2.0/tests/test_orchestration_e2e.py +0 -469
- durabletask-0.2.0/tests/test_orchestration_executor.py +0 -1190
- {durabletask-0.2.0 → durabletask-0.2.1}/LICENSE +0 -0
- {durabletask-0.2.0 → durabletask-0.2.1}/README.md +0 -0
- {durabletask-0.2.0 → durabletask-0.2.1}/durabletask/__init__.py +0 -0
- {durabletask-0.2.0 → durabletask-0.2.1}/durabletask/client.py +0 -0
- {durabletask-0.2.0 → durabletask-0.2.1}/durabletask/internal/grpc_interceptor.py +0 -0
- {durabletask-0.2.0 → durabletask-0.2.1}/durabletask/internal/helpers.py +0 -0
- {durabletask-0.2.0 → durabletask-0.2.1}/durabletask/internal/orchestrator_service_pb2.py +0 -0
- {durabletask-0.2.0 → durabletask-0.2.1}/durabletask/internal/orchestrator_service_pb2.pyi +0 -0
- {durabletask-0.2.0 → durabletask-0.2.1}/durabletask/internal/orchestrator_service_pb2_grpc.py +0 -0
- {durabletask-0.2.0 → durabletask-0.2.1}/durabletask/internal/shared.py +0 -0
- {durabletask-0.2.0 → durabletask-0.2.1}/durabletask/task.py +0 -0
- {durabletask-0.2.0 → durabletask-0.2.1}/durabletask/worker.py +0 -0
- {durabletask-0.2.0 → durabletask-0.2.1}/durabletask.egg-info/dependency_links.txt +0 -0
- {durabletask-0.2.0 → durabletask-0.2.1}/durabletask.egg-info/top_level.txt +0 -0
- {durabletask-0.2.0 → durabletask-0.2.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: durabletask
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: A Durable Task Client SDK for Python
|
|
5
5
|
License: MIT License
|
|
6
6
|
|
|
@@ -32,7 +32,10 @@ Classifier: Programming Language :: Python :: 3
|
|
|
32
32
|
Classifier: License :: OSI Approved :: MIT License
|
|
33
33
|
Requires-Python: >=3.9
|
|
34
34
|
Description-Content-Type: text/markdown
|
|
35
|
+
License-File: LICENSE
|
|
35
36
|
Requires-Dist: grpcio
|
|
37
|
+
Requires-Dist: protobuf
|
|
38
|
+
Dynamic: license-file
|
|
36
39
|
|
|
37
40
|
# Durable Task SDK for Python
|
|
38
41
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: durabletask
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: A Durable Task Client SDK for Python
|
|
5
5
|
License: MIT License
|
|
6
6
|
|
|
@@ -32,7 +32,10 @@ Classifier: Programming Language :: Python :: 3
|
|
|
32
32
|
Classifier: License :: OSI Approved :: MIT License
|
|
33
33
|
Requires-Python: >=3.9
|
|
34
34
|
Description-Content-Type: text/markdown
|
|
35
|
+
License-File: LICENSE
|
|
35
36
|
Requires-Dist: grpcio
|
|
37
|
+
Requires-Dist: protobuf
|
|
38
|
+
Dynamic: license-file
|
|
36
39
|
|
|
37
40
|
# Durable Task SDK for Python
|
|
38
41
|
|
|
@@ -15,8 +15,4 @@ durabletask/internal/helpers.py
|
|
|
15
15
|
durabletask/internal/orchestrator_service_pb2.py
|
|
16
16
|
durabletask/internal/orchestrator_service_pb2.pyi
|
|
17
17
|
durabletask/internal/orchestrator_service_pb2_grpc.py
|
|
18
|
-
durabletask/internal/shared.py
|
|
19
|
-
tests/test_activity_executor.py
|
|
20
|
-
tests/test_client.py
|
|
21
|
-
tests/test_orchestration_e2e.py
|
|
22
|
-
tests/test_orchestration_executor.py
|
|
18
|
+
durabletask/internal/shared.py
|
|
@@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
|
|
|
9
9
|
|
|
10
10
|
[project]
|
|
11
11
|
name = "durabletask"
|
|
12
|
-
version = "0.2.
|
|
12
|
+
version = "0.2.1"
|
|
13
13
|
description = "A Durable Task Client SDK for Python"
|
|
14
14
|
keywords = [
|
|
15
15
|
"durable",
|
|
@@ -22,10 +22,11 @@ classifiers = [
|
|
|
22
22
|
"License :: OSI Approved :: MIT License",
|
|
23
23
|
]
|
|
24
24
|
requires-python = ">=3.9"
|
|
25
|
-
license = {
|
|
25
|
+
license = {file = "LICENSE"}
|
|
26
26
|
readme = "README.md"
|
|
27
27
|
dependencies = [
|
|
28
28
|
"grpcio",
|
|
29
|
+
"protobuf"
|
|
29
30
|
]
|
|
30
31
|
|
|
31
32
|
[project.urls]
|
|
@@ -35,9 +36,6 @@ changelog = "https://github.com/microsoft/durabletask-python/blob/main/CHANGELOG
|
|
|
35
36
|
[tool.setuptools.packages.find]
|
|
36
37
|
include = ["durabletask", "durabletask.*"]
|
|
37
38
|
|
|
38
|
-
[tool.setuptools]
|
|
39
|
-
license-files = []
|
|
40
|
-
|
|
41
39
|
[tool.pytest.ini_options]
|
|
42
40
|
minversion = "6.0"
|
|
43
41
|
testpaths = ["tests"]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
grpcio
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# Copyright (c) Microsoft Corporation.
|
|
2
|
-
# Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import json
|
|
5
|
-
import logging
|
|
6
|
-
from typing import Any, Optional, Tuple
|
|
7
|
-
|
|
8
|
-
from durabletask import task, worker
|
|
9
|
-
|
|
10
|
-
logging.basicConfig(
|
|
11
|
-
format='%(asctime)s.%(msecs)03d %(name)s %(levelname)s: %(message)s',
|
|
12
|
-
datefmt='%Y-%m-%d %H:%M:%S',
|
|
13
|
-
level=logging.DEBUG)
|
|
14
|
-
TEST_LOGGER = logging.getLogger("tests")
|
|
15
|
-
TEST_INSTANCE_ID = 'abc123'
|
|
16
|
-
TEST_TASK_ID = 42
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def test_activity_inputs():
|
|
20
|
-
"""Validates activity function input population"""
|
|
21
|
-
def test_activity(ctx: task.ActivityContext, test_input: Any):
|
|
22
|
-
# return all activity inputs back as the output
|
|
23
|
-
return test_input, ctx.orchestration_id, ctx.task_id
|
|
24
|
-
|
|
25
|
-
activity_input = "Hello, 世界!"
|
|
26
|
-
executor, name = _get_activity_executor(test_activity)
|
|
27
|
-
result = executor.execute(TEST_INSTANCE_ID, name, TEST_TASK_ID, json.dumps(activity_input))
|
|
28
|
-
assert result is not None
|
|
29
|
-
|
|
30
|
-
result_input, result_orchestration_id, result_task_id = json.loads(result)
|
|
31
|
-
assert activity_input == result_input
|
|
32
|
-
assert TEST_INSTANCE_ID == result_orchestration_id
|
|
33
|
-
assert TEST_TASK_ID == result_task_id
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
def test_activity_not_registered():
|
|
37
|
-
|
|
38
|
-
def test_activity(ctx: task.ActivityContext, _):
|
|
39
|
-
pass # not used
|
|
40
|
-
|
|
41
|
-
executor, _ = _get_activity_executor(test_activity)
|
|
42
|
-
|
|
43
|
-
caught_exception: Optional[Exception] = None
|
|
44
|
-
try:
|
|
45
|
-
executor.execute(TEST_INSTANCE_ID, "Bogus", TEST_TASK_ID, None)
|
|
46
|
-
except Exception as ex:
|
|
47
|
-
caught_exception = ex
|
|
48
|
-
|
|
49
|
-
assert type(caught_exception) is worker.ActivityNotRegisteredError
|
|
50
|
-
assert "Bogus" in str(caught_exception)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
def _get_activity_executor(fn: task.Activity) -> Tuple[worker._ActivityExecutor, str]:
|
|
54
|
-
registry = worker._Registry()
|
|
55
|
-
name = registry.add_activity(fn)
|
|
56
|
-
executor = worker._ActivityExecutor(registry, TEST_LOGGER)
|
|
57
|
-
return executor, name
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
from unittest.mock import patch, ANY
|
|
2
|
-
|
|
3
|
-
from durabletask.internal.shared import (get_default_host_address,
|
|
4
|
-
get_grpc_channel)
|
|
5
|
-
from durabletask.internal.grpc_interceptor import DefaultClientInterceptorImpl
|
|
6
|
-
|
|
7
|
-
HOST_ADDRESS = 'localhost:50051'
|
|
8
|
-
METADATA = [('key1', 'value1'), ('key2', 'value2')]
|
|
9
|
-
INTERCEPTORS = [DefaultClientInterceptorImpl(METADATA)]
|
|
10
|
-
|
|
11
|
-
def test_get_grpc_channel_insecure():
|
|
12
|
-
with patch('grpc.insecure_channel') as mock_channel:
|
|
13
|
-
get_grpc_channel(HOST_ADDRESS, False, interceptors=INTERCEPTORS)
|
|
14
|
-
mock_channel.assert_called_once_with(HOST_ADDRESS)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def test_get_grpc_channel_secure():
|
|
18
|
-
with patch('grpc.secure_channel') as mock_channel, patch(
|
|
19
|
-
'grpc.ssl_channel_credentials') as mock_credentials:
|
|
20
|
-
get_grpc_channel(HOST_ADDRESS, True, interceptors=INTERCEPTORS)
|
|
21
|
-
mock_channel.assert_called_once_with(HOST_ADDRESS, mock_credentials.return_value)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def test_get_grpc_channel_default_host_address():
|
|
25
|
-
with patch('grpc.insecure_channel') as mock_channel:
|
|
26
|
-
get_grpc_channel(None, False, interceptors=INTERCEPTORS)
|
|
27
|
-
mock_channel.assert_called_once_with(get_default_host_address())
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def test_get_grpc_channel_with_metadata():
|
|
31
|
-
with patch('grpc.insecure_channel') as mock_channel, patch(
|
|
32
|
-
'grpc.intercept_channel') as mock_intercept_channel:
|
|
33
|
-
get_grpc_channel(HOST_ADDRESS, False, interceptors=INTERCEPTORS)
|
|
34
|
-
mock_channel.assert_called_once_with(HOST_ADDRESS)
|
|
35
|
-
mock_intercept_channel.assert_called_once()
|
|
36
|
-
|
|
37
|
-
# Capture and check the arguments passed to intercept_channel()
|
|
38
|
-
args, kwargs = mock_intercept_channel.call_args
|
|
39
|
-
assert args[0] == mock_channel.return_value
|
|
40
|
-
assert isinstance(args[1], DefaultClientInterceptorImpl)
|
|
41
|
-
assert args[1]._metadata == METADATA
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def test_grpc_channel_with_host_name_protocol_stripping():
|
|
45
|
-
with patch('grpc.insecure_channel') as mock_insecure_channel, patch(
|
|
46
|
-
'grpc.secure_channel') as mock_secure_channel:
|
|
47
|
-
|
|
48
|
-
host_name = "myserver.com:1234"
|
|
49
|
-
|
|
50
|
-
prefix = "grpc://"
|
|
51
|
-
get_grpc_channel(prefix + host_name, interceptors=INTERCEPTORS)
|
|
52
|
-
mock_insecure_channel.assert_called_with(host_name)
|
|
53
|
-
|
|
54
|
-
prefix = "http://"
|
|
55
|
-
get_grpc_channel(prefix + host_name, interceptors=INTERCEPTORS)
|
|
56
|
-
mock_insecure_channel.assert_called_with(host_name)
|
|
57
|
-
|
|
58
|
-
prefix = "HTTP://"
|
|
59
|
-
get_grpc_channel(prefix + host_name, interceptors=INTERCEPTORS)
|
|
60
|
-
mock_insecure_channel.assert_called_with(host_name)
|
|
61
|
-
|
|
62
|
-
prefix = "GRPC://"
|
|
63
|
-
get_grpc_channel(prefix + host_name, interceptors=INTERCEPTORS)
|
|
64
|
-
mock_insecure_channel.assert_called_with(host_name)
|
|
65
|
-
|
|
66
|
-
prefix = ""
|
|
67
|
-
get_grpc_channel(prefix + host_name, interceptors=INTERCEPTORS)
|
|
68
|
-
mock_insecure_channel.assert_called_with(host_name)
|
|
69
|
-
|
|
70
|
-
prefix = "grpcs://"
|
|
71
|
-
get_grpc_channel(prefix + host_name, interceptors=INTERCEPTORS)
|
|
72
|
-
mock_secure_channel.assert_called_with(host_name, ANY)
|
|
73
|
-
|
|
74
|
-
prefix = "https://"
|
|
75
|
-
get_grpc_channel(prefix + host_name, interceptors=INTERCEPTORS)
|
|
76
|
-
mock_secure_channel.assert_called_with(host_name, ANY)
|
|
77
|
-
|
|
78
|
-
prefix = "HTTPS://"
|
|
79
|
-
get_grpc_channel(prefix + host_name, interceptors=INTERCEPTORS)
|
|
80
|
-
mock_secure_channel.assert_called_with(host_name, ANY)
|
|
81
|
-
|
|
82
|
-
prefix = "GRPCS://"
|
|
83
|
-
get_grpc_channel(prefix + host_name, interceptors=INTERCEPTORS)
|
|
84
|
-
mock_secure_channel.assert_called_with(host_name, ANY)
|
|
85
|
-
|
|
86
|
-
prefix = ""
|
|
87
|
-
get_grpc_channel(prefix + host_name, True, interceptors=INTERCEPTORS)
|
|
88
|
-
mock_secure_channel.assert_called_with(host_name, ANY)
|