-
Notifications
You must be signed in to change notification settings - Fork 14
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
Workflow cancel , restart, resume as admin API #187
Conversation
tests/test_admin_server.py
Outdated
else: | ||
new_wfUuid = output[0].workflowUUID | ||
|
||
print(new_wfUuid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove the prints
@@ -767,13 +777,30 @@ def execute_workflow_id(cls, workflow_id: str) -> WorkflowHandle[Any]: | |||
"""Execute a workflow by ID (for recovery).""" | |||
return execute_workflow_by_id(_get_dbos_instance(), workflow_id) | |||
|
|||
@classmethod | |||
def restart_workflow(cls, workflow_id: str) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these new methods part of the public API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are called from the admin server. Not sure what you mean by public api
dbos/cli.py
Outdated
print(f"Failed to resume workflow {uuid}. Status code: {response.status_code}") | ||
|
||
|
||
@workflow.command(help="Restart a workflow that has been cancelled with a new id") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@workflow.command(help="Restart a workflow that has been cancelled with a new id") | |
@workflow.command(help="Restart a workflow from the beginning with a new workflow ID") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
# /workflows/:workflow_id/cancel | ||
# /workflows/:workflow_id/resume | ||
# /workflows/:workflow_id/restart |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are these comments for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For other engineers to see what the url looks like
dbos/_admin_server.py
Outdated
def _handle_restart(self, workflow_id: str) -> None: | ||
self.dbos.restart_workflow(workflow_id) | ||
print("Restarting workflow", workflow_id) | ||
self.send_response(200) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we return 204? The server doesn't return anything to the client
dbos/_dbos.py
Outdated
|
||
@classmethod | ||
def resume_workflow(cls, workflow_id: str) -> None: | ||
"""Cancel a workflow by ID.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Cancel a workflow by ID.""" | |
"""Resume a workflow by ID.""" |
dbos/_dbos.py
Outdated
@@ -231,9 +233,17 @@ def __new__( | |||
f"DBOS configured multiple times with conflicting information" | |||
) | |||
config = _dbos_global_registry.config | |||
|
|||
print("calling new setting up the global instance") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to call the DBOS logger for all these statements? So they get exported, etc?
No description provided.