dbos 0.26.0a10__tar.gz → 0.26.0a11__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-0.26.0a10 → dbos-0.26.0a11}/PKG-INFO +1 -1
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_dbos.py +3 -3
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_sys_db.py +4 -2
- {dbos-0.26.0a10 → dbos-0.26.0a11}/pyproject.toml +1 -1
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_workflow_introspection.py +36 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/LICENSE +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/README.md +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/__init__.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/__main__.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_admin_server.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_app_db.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_classproperty.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_client.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_conductor/conductor.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_conductor/protocol.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_context.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_core.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_croniter.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_dbos_config.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_debug.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_docker_pg_helper.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_error.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_fastapi.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_flask.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_kafka.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_kafka_message.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_logger.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_migrations/env.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_migrations/script.py.mako +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_migrations/versions/04ca4f231047_workflow_queues_executor_id.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_migrations/versions/50f3227f0b4b_fix_job_queue.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_migrations/versions/5c361fc04708_added_system_tables.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_migrations/versions/a3b18ad34abe_added_triggers.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_migrations/versions/d76646551a6b_job_queue_limiter.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_migrations/versions/d76646551a6c_workflow_queue.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_migrations/versions/eab0cc1d9a14_job_queue.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_migrations/versions/f4b9b32ba814_functionname_childid_op_outputs.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_outcome.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_queue.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_recovery.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_registrations.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_request.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_roles.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_scheduler.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_schemas/__init__.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_schemas/application_database.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_schemas/system_database.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_serialization.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_templates/dbos-db-starter/README.md +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_templates/dbos-db-starter/__package/__init__.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_templates/dbos-db-starter/__package/main.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_templates/dbos-db-starter/__package/schema.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_templates/dbos-db-starter/alembic.ini +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_templates/dbos-db-starter/dbos-config.yaml.dbos +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_templates/dbos-db-starter/migrations/env.py.dbos +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_templates/dbos-db-starter/migrations/script.py.mako +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_templates/dbos-db-starter/migrations/versions/2024_07_31_180642_init.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_templates/dbos-db-starter/start_postgres_docker.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_tracer.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_utils.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_workflow_commands.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/cli/_github_init.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/cli/_template_init.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/cli/cli.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/dbos-config.schema.json +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/py.typed +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/__init__.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/atexit_no_ctor.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/atexit_no_launch.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/classdefs.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/client_collateral.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/client_worker.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/conftest.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/more_classdefs.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/queuedworkflow.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_admin_server.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_async.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_classdecorators.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_client.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_concurrency.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_config.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_croniter.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_dbos.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_debug.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_docker_secrets.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_failures.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_fastapi.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_fastapi_roles.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_flask.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_kafka.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_outcome.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_package.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_queue.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_scheduler.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_schema_migration.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_singleton.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_spans.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_sqlalchemy.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/tests/test_workflow_management.py +0 -0
- {dbos-0.26.0a10 → dbos-0.26.0a11}/version/__init__.py +0 -0
@@ -1061,11 +1061,11 @@ class DBOS:
|
|
1061
1061
|
|
1062
1062
|
@classproperty
|
1063
1063
|
def step_id(cls) -> int:
|
1064
|
-
"""Return the step ID for the
|
1064
|
+
"""Return the step ID for the currently executing step. This is a unique identifier of the current step within the workflow."""
|
1065
1065
|
ctx = assert_current_dbos_context()
|
1066
1066
|
assert (
|
1067
|
-
ctx.
|
1068
|
-
), "step_id is only available within a DBOS
|
1067
|
+
ctx.is_step() or ctx.is_transaction()
|
1068
|
+
), "step_id is only available within a DBOS step."
|
1069
1069
|
return ctx.function_id
|
1070
1070
|
|
1071
1071
|
@classproperty
|
@@ -1569,7 +1569,9 @@ class SystemDatabase:
|
|
1569
1569
|
|
1570
1570
|
def call_function_as_step(self, fn: Callable[[], T], function_name: str) -> T:
|
1571
1571
|
ctx = get_local_dbos_context()
|
1572
|
-
if ctx and ctx.
|
1572
|
+
if ctx and ctx.is_transaction():
|
1573
|
+
raise Exception(f"Invalid call to `{function_name}` inside a transaction")
|
1574
|
+
if ctx and ctx.is_workflow():
|
1573
1575
|
ctx.function_id += 1
|
1574
1576
|
res = self.check_operation_execution(
|
1575
1577
|
ctx.workflow_id, ctx.function_id, function_name
|
@@ -1587,7 +1589,7 @@ class SystemDatabase:
|
|
1587
1589
|
f"Recorded output and error are both None for {function_name}"
|
1588
1590
|
)
|
1589
1591
|
result = fn()
|
1590
|
-
if ctx and ctx.
|
1592
|
+
if ctx and ctx.is_workflow():
|
1591
1593
|
self.record_operation_result(
|
1592
1594
|
{
|
1593
1595
|
"workflow_uuid": ctx.workflow_id,
|
@@ -990,3 +990,39 @@ def test_list_workflows_as_step(dbos: DBOS) -> None:
|
|
990
990
|
workflow_event.set()
|
991
991
|
assert handle.get_result() == 1
|
992
992
|
assert handle_two.get_result() == 1
|
993
|
+
|
994
|
+
|
995
|
+
def test_call_as_step_within_step(
|
996
|
+
dbos: DBOS, sys_db: SystemDatabase, app_db: ApplicationDatabase
|
997
|
+
) -> None:
|
998
|
+
# If we call any util functions within a step, it should be called directly without checkpointing
|
999
|
+
|
1000
|
+
@DBOS.step()
|
1001
|
+
def getStatus(workflow_id: str) -> str:
|
1002
|
+
status = DBOS.get_workflow_status(workflow_id)
|
1003
|
+
assert status is not None
|
1004
|
+
return status.status
|
1005
|
+
|
1006
|
+
@DBOS.workflow()
|
1007
|
+
def getStatusWorkflow() -> str:
|
1008
|
+
return getStatus(DBOS.workflow_id)
|
1009
|
+
|
1010
|
+
@DBOS.transaction()
|
1011
|
+
def transactionStatus() -> None:
|
1012
|
+
DBOS.get_workflow_status(DBOS.workflow_id)
|
1013
|
+
|
1014
|
+
wfid = str(uuid.uuid4())
|
1015
|
+
with SetWorkflowID(wfid):
|
1016
|
+
status = getStatusWorkflow()
|
1017
|
+
assert status == WorkflowStatusString.PENDING.value
|
1018
|
+
|
1019
|
+
steps = _workflow_commands.list_workflow_steps(sys_db, app_db, wfid)
|
1020
|
+
|
1021
|
+
assert len(steps) == 1
|
1022
|
+
assert steps[0]["function_name"] == getStatus.__qualname__
|
1023
|
+
|
1024
|
+
with pytest.raises(Exception) as exc_info:
|
1025
|
+
transactionStatus()
|
1026
|
+
assert "Invalid call to `DBOS.getStatus` inside a transaction" in str(
|
1027
|
+
exc_info.value
|
1028
|
+
)
|
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-0.26.0a10 → dbos-0.26.0a11}/dbos/_migrations/versions/5c361fc04708_added_system_tables.py
RENAMED
File without changes
|
File without changes
|
{dbos-0.26.0a10 → dbos-0.26.0a11}/dbos/_migrations/versions/d76646551a6b_job_queue_limiter.py
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
|
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
|