-
Notifications
You must be signed in to change notification settings - Fork 6
Tmp am/raas #93
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
Tmp am/raas #93
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -155,8 +155,8 @@ async def submit_workflow(self, workflow_file: str) -> dict: | |
| self._workflows[wf_id] = wf | ||
|
|
||
| # Notify submission | ||
| if self._notify: | ||
| self._notify( | ||
| if self._plugin: | ||
| self._plugin._dispatch_notify( | ||
| "workflow_state", | ||
| {"wf_id": wf_id, "state": "SUBMITTED", "workflow_file": workflow_file}, | ||
| ) | ||
|
|
@@ -203,8 +203,8 @@ def _on_done(fut): | |
| excerpt = next((line.strip() for line in raw.splitlines() if line.strip()), "")[ | ||
| :120 | ||
| ] | ||
| if self._notify: | ||
| self._notify( | ||
| if self._plugin: | ||
| self._plugin._dispatch_notify( | ||
| "task_event", | ||
| {"wf_id": wf_id, "task_id": tid, "ok": is_ok, "excerpt": excerpt}, | ||
| ) | ||
|
|
@@ -257,8 +257,8 @@ def on_iteration(state): | |
| # | ||
| def _notify_state(self, wf: Workflow): | ||
| """Send workflow state notification.""" | ||
| if self._notify: | ||
| self._notify( | ||
| if self._plugin: | ||
| self._plugin._dispatch_notify( | ||
| "workflow_state", | ||
| {"wf_id": wf.wf_id, "state": wf.state.value, "stats": wf.stats, "error": wf.error}, | ||
| ) | ||
|
Comment on lines
+260
to
264
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of manually constructing a dictionary with a subset of fields, consider using if self._plugin:
self._plugin._dispatch_notify("workflow_state", wf.to_dict()) |
||
|
|
||
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.
The notification logic here is redundant with the
_notify_statemethod. Reusingself._notify_state(wf)would simplify the code, ensure consistency in the notification payload, and centralize the logic for dispatching workflow state updates.