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

refactor loopblock value #1381

Merged
merged 2 commits into from
Dec 12, 2024
Merged

refactor loopblock value #1381

merged 2 commits into from
Dec 12, 2024

Conversation

LawyZheng
Copy link
Collaborator

@LawyZheng LawyZheng commented Dec 12, 2024

Important

Refactor loop block value handling by introducing loop_variable_reference and updating related logic in ForLoopBlock, YAML, and service components.

  • Exceptions:
    • Add FailedToFormatJinjaStyleParameter and NoIterableValueFound in exceptions.py.
  • ForLoopBlock:
    • Add loop_variable_reference attribute in block.py.
    • Modify get_loop_over_parameter_values() to handle loop_variable_reference and raise NoIterableValueFound if no iterable is found.
    • Update execute() to handle exceptions from get_loop_over_parameter_values().
  • YAML and Service:
    • Add loop_variable_reference to ForLoopBlockYAML in yaml.py.
    • Update block_yaml_to_block() in service.py to handle loop_variable_reference and ensure backward compatibility.

This description was created by Ellipsis for 588ec58. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to 588ec58 in 56 seconds

More details
  • Looked at 199 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. skyvern/forge/sdk/workflow/models/block.py:663
  • Draft comment:
    Consider handling the ValueError exception when source_parameter_value is not a dictionary to prevent unexpected termination of the program.
  • Reason this comment was not posted:
    Comment was on unchanged code.
2. skyvern/forge/sdk/workflow/service.py:1336
  • Draft comment:
    The check for block_yaml.loop_variable_reference is redundant after checking block_yaml.loop_over_parameter_key. Consider simplifying this logic for better readability.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The block_yaml_to_block function in service.py has a redundant check for block_yaml.loop_variable_reference after already checking block_yaml.loop_over_parameter_key. This can be simplified to improve readability.

Workflow ID: wflow_exWtK3xAR4wkMumj


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

loop_over_values = self.get_loop_over_parameter_values(workflow_run_context)
try:
loop_over_values = self.get_loop_over_parameter_values(workflow_run_context)
except Exception as e:
Copy link
Contributor

Choose a reason for hiding this comment

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

Catching a generic Exception is not recommended. Consider catching specific exceptions that are expected to occur when calling get_loop_over_parameter_values.

@LawyZheng LawyZheng merged commit f028b48 into main Dec 12, 2024
2 checks passed
@LawyZheng LawyZheng deleted the lawy/refactor-loopblock-value branch December 12, 2024 18:37
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.

1 participant