dbos-inc / dbos-transact-py

Ultra-Lightweight Durable Execution in Python
https://docs.dbos.dev
MIT License
244 stars 7 forks source link

Lifecycle + Clean interface #71

Closed chuck-dbos closed 2 months ago

chuck-dbos commented 2 months ago

Use 'DBOS.', so files to not know what the dbos instance is. (In fact DBOS. doesn't make a DBOS instance, it sets registration information aside for later.)

New lifecycle is also complete:

You use zero or more @DBOS. to register stuff (perhaps in an import file, no problem there). You say DBOS([config=], [fastapi=]) to configure DBOS. (This seems like it could be optional, but for now you do it.) You can continue to use @DBOS. to register stuff (perhaps in an import file, no problem there). Call DBOS launch(). At this point DBOS can start recovery, pollers/scheduler, etc., since everything is registered. (In a fastapi setting, fastapi starts and calls launch() on DBOS because of an event trigger.) It is now ill-advised to register more workflow functions, because recovery, serving, etc., are already started. (In a fastapi setting this isn't going to happen unless you try something really strange.)

Tests for same.