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

fixed len_output method does not support handler-defined logic issue #26

Merged
merged 2 commits into from
Jan 28, 2025

Conversation

koussayinsat12
Copy link
Contributor

@koussayinsat12 koussayinsat12 commented Jan 25, 2025

This pull request refactors the len_output method in the workflow implementation to address inconsistencies in how output lengths are calculated. Previously, the method directly computed the length of self.current_output, ignoring handler-defined logic. This caused issues when custom handlers redefined the logic for determining output length.

The updated implementation now leverages the corresponding handler to calculate the length of the output, ensuring consistency across workflows.

Key Changes:

1.Delegation to Handlers:

  • The method now retrieves the appropriate handler using self.workflow.handlers and delegates the length calculation to handler.len_output(output).

2.Flexible Output Selection:

  • Added an output parameter (default: -1) to specify which output to evaluate, making the method more versatile for workflows with multiple outputs.

3.Improved Readability and Maintenance:

  • Introduced type hints (int | None) and a detailed docstring for better code clarity and usability.

@zeddo123 zeddo123 added the enhancement New feature or request label Jan 26, 2025
Copy link
Member

@zeddo123 zeddo123 left a comment

Choose a reason for hiding this comment

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

Thank you @koussayinsat12 for your contribution! There's a single think to take care of and then we'll merge this PR.

octopipes/workflow.py Outdated Show resolved Hide resolved
@zeddo123 zeddo123 linked an issue Jan 26, 2025 that may be closed by this pull request
Copy link
Member

@zeddo123 zeddo123 left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @koussayinsat12

@zeddo123 zeddo123 merged commit d1b03ae into Octomiro:master Jan 28, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

len_output Method Does Not Use Handler-Defined Logic
2 participants