Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2 API touchups #681

Merged
merged 5 commits into from
Dec 16, 2024
Merged

v2 API touchups #681

merged 5 commits into from
Dec 16, 2024

Conversation

chuck-dbos
Copy link
Collaborator

These were found during conversion of demo apps to v2:

  • setAppConfig - used in unit tests (was provided by testingRuntime as setConfig)
  • Calling v1 transaction/step functions using DBOS.invoke(), from outside of workflows
  • Using DBOS.logger before launch

@chuck-dbos chuck-dbos requested review from kraftp and qianl15 December 16, 2024 16:52
@@ -1,6 +1,8 @@
import { DBOS, WorkflowQueue } from '../src';
import { generateDBOSTestConfig, setUpDBOSTestDb, TestKvTable } from './helpers';

DBOS.logger.info("This should not cause a kaboom.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha what?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -565,6 +573,42 @@ export class DBOS {
static invoke<T extends ConfiguredInstance>(targetCfg: T): InvokeFuncsInst<T>;
static invoke<T extends object>(targetClass: T): InvokeFuncs<T>;
static invoke<T extends object>(object: T | ConfiguredInstance): InvokeFuncs<T> | InvokeFuncsInst<T> {
if (!DBOS.isWithinWorkflow()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if you call a step normally outside a workflow, not using invoke? Does it work the same as in Python?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that was true for a long time. This is about running a v1 step/transaction function without a HandlerContext.

Copy link
Member

@kraftp kraftp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@chuck-dbos chuck-dbos merged commit dfc0064 into main Dec 16, 2024
6 checks passed
@chuck-dbos chuck-dbos deleted the chuck/setconf branch December 16, 2024 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants