dbos 2.2.0a3__tar.gz → 2.3.0a1__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.
- {dbos-2.2.0a3 → dbos-2.3.0a1}/PKG-INFO +1 -1
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_client.py +12 -2
- {dbos-2.2.0a3 → dbos-2.3.0a1}/pyproject.toml +1 -1
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_client.py +32 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/LICENSE +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/README.md +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/__init__.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/__main__.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_admin_server.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_app_db.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_classproperty.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_conductor/conductor.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_conductor/protocol.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_context.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_core.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_croniter.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_dbos.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_dbos_config.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_debouncer.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_debug.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_docker_pg_helper.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_error.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_event_loop.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_fastapi.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_flask.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_kafka.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_kafka_message.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_logger.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_migration.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_outcome.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_queue.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_recovery.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_registrations.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_roles.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_scheduler.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_schemas/__init__.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_schemas/application_database.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_schemas/system_database.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_serialization.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_sys_db.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_sys_db_postgres.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_sys_db_sqlite.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_templates/dbos-db-starter/README.md +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_templates/dbos-db-starter/__package/__init__.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_templates/dbos-db-starter/__package/main.py.dbos +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_templates/dbos-db-starter/__package/schema.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_templates/dbos-db-starter/dbos-config.yaml.dbos +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_templates/dbos-db-starter/migrations/create_table.py.dbos +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_templates/dbos-db-starter/start_postgres_docker.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_tracer.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_utils.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_workflow_commands.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/cli/_github_init.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/cli/_template_init.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/cli/cli.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/cli/migration.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/dbos-config.schema.json +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/py.typed +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/__init__.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/atexit_no_ctor.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/atexit_no_launch.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/classdefs.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/client_collateral.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/client_worker.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/conftest.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/dupname_classdefs1.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/dupname_classdefsa.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/more_classdefs.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/queuedworkflow.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/script_without_fastapi.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_admin_server.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_async.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_async_workflow_management.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_classdecorators.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_cli.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_concurrency.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_config.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_croniter.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_dbos.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_debouncer.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_debug.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_docker_secrets.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_failures.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_fastapi.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_fastapi_roles.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_flask.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_kafka.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_outcome.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_package.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_queue.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_scheduler.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_schema_migration.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_singleton.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_spans.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_sqlalchemy.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_streaming.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_workflow_introspection.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/tests/test_workflow_management.py +0 -0
- {dbos-2.2.0a3 → dbos-2.3.0a1}/version/__init__.py +0 -0
@@ -1,4 +1,5 @@
|
|
1
1
|
import asyncio
|
2
|
+
import json
|
2
3
|
import time
|
3
4
|
import uuid
|
4
5
|
from typing import (
|
@@ -63,6 +64,8 @@ class EnqueueOptions(_EnqueueOptionsRequired, total=False):
|
|
63
64
|
priority: int
|
64
65
|
max_recovery_attempts: int
|
65
66
|
queue_partition_key: str
|
67
|
+
authenticated_user: str
|
68
|
+
authenticated_roles: list[str]
|
66
69
|
|
67
70
|
|
68
71
|
def validate_enqueue_options(options: EnqueueOptions) -> None:
|
@@ -189,6 +192,13 @@ class DBOSClient:
|
|
189
192
|
"queue_partition_key": options.get("queue_partition_key"),
|
190
193
|
}
|
191
194
|
|
195
|
+
authenticated_user = options.get("authenticated_user")
|
196
|
+
authenticated_roles = (
|
197
|
+
json.dumps(options.get("authenticated_roles"))
|
198
|
+
if options.get("authenticated_roles")
|
199
|
+
else None
|
200
|
+
)
|
201
|
+
|
192
202
|
inputs: WorkflowInputs = {
|
193
203
|
"args": args,
|
194
204
|
"kwargs": kwargs,
|
@@ -202,9 +212,9 @@ class DBOSClient:
|
|
202
212
|
"queue_name": queue_name,
|
203
213
|
"app_version": enqueue_options_internal["app_version"],
|
204
214
|
"config_name": None,
|
205
|
-
"authenticated_user":
|
215
|
+
"authenticated_user": authenticated_user,
|
206
216
|
"assumed_role": None,
|
207
|
-
"authenticated_roles":
|
217
|
+
"authenticated_roles": authenticated_roles,
|
208
218
|
"output": None,
|
209
219
|
"error": None,
|
210
220
|
"created_at": None,
|
@@ -593,3 +593,35 @@ def test_enqueue_with_priority(dbos: DBOS, client: DBOSClient) -> None:
|
|
593
593
|
def test_client_bad_url() -> None:
|
594
594
|
with pytest.raises(DBAPIError) as exc_info:
|
595
595
|
DBOSClient("postgresql://postgres:fakepassword@localhost:5433/fake_database")
|
596
|
+
|
597
|
+
|
598
|
+
def test_client_auth(dbos: DBOS, client: DBOSClient) -> None:
|
599
|
+
run_client_collateral()
|
600
|
+
|
601
|
+
johnDoe: Person = {"first": "John", "last": "Doe", "age": 30}
|
602
|
+
wfid = str(uuid.uuid4())
|
603
|
+
|
604
|
+
user = "testuser"
|
605
|
+
roles = ["role1", "role2"]
|
606
|
+
|
607
|
+
options: EnqueueOptions = {
|
608
|
+
"queue_name": "test_queue",
|
609
|
+
"workflow_name": "enqueue_test",
|
610
|
+
"workflow_id": wfid,
|
611
|
+
"authenticated_user": user,
|
612
|
+
"authenticated_roles": roles,
|
613
|
+
}
|
614
|
+
|
615
|
+
handle: WorkflowHandle[str] = client.enqueue(options, 42, "test", johnDoe)
|
616
|
+
result = handle.get_result()
|
617
|
+
assert result == '42-test-{"first": "John", "last": "Doe", "age": 30}'
|
618
|
+
|
619
|
+
list_results = client.list_workflows()
|
620
|
+
assert len(list_results) == 1
|
621
|
+
assert list_results[0].workflow_id == wfid
|
622
|
+
assert list_results[0].status == "SUCCESS"
|
623
|
+
assert list_results[0].output == result
|
624
|
+
assert list_results[0].input is not None
|
625
|
+
assert list_results[0].authenticated_user == user
|
626
|
+
assert list_results[0].authenticated_roles == roles
|
627
|
+
assert list_results[0].assumed_role is None
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{dbos-2.2.0a3 → dbos-2.3.0a1}/dbos/_templates/dbos-db-starter/migrations/create_table.py.dbos
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|