-
Notifications
You must be signed in to change notification settings - Fork 3
IWF-836: SDK expects stateWaitUntilFailed flag instead stateStartApiSucceeded #112
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
Changes from all commits
4384216
27aabca
c8592b3
ba6caa9
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 |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #! /usr/bin/env bash | ||
|
|
||
| # This script ensures that the poetry.lock file does not contain references to the internal Indeed Nexus PyPI repository. | ||
| # It is used as a git hook to automatically remove the [package.source] section for Nexus from poetry.lock. | ||
| # This is necessary to ensure the lock file is portable and open-source friendly. | ||
| # The script uses gsed to remove the Nexus source block and any resulting empty lines, then checks if any changes were made. | ||
| # If Nexus references are found and removed, the script exits with 1 to prevent the commit, so we can stage the changes made by the script before committing again. | ||
|
|
||
| gsed -i'' \ | ||
| -e '/./{H;$!d}' \ | ||
| -e 'x' \ | ||
| -e 's|\[package.source\]\ntype\s*=\s*\"legacy\"\nurl\s*=\s*\"https://nexus.corp.indeed.com/repository/pypi/simple\"\nreference\s*=\s*\"nexus\"||' \ | ||
| poetry.lock | ||
|
|
||
| gsed -i'' \ | ||
| -e '1{/^\s*$/d}' \ | ||
| poetry.lock | ||
|
|
||
| gsed -i'' \ | ||
| -e '/^\s*$/N;/^\s*\n$/D' \ | ||
| poetry.lock | ||
|
|
||
| CHANGES=$(git diff --exit-code poetry.lock | grep -Pzo '\-\[package.source\]\n\-type = "legacy"\n\-url = "https://nexus.corp.indeed.com/repository/pypi/simple"\n\-reference = "nexus"\n' | wc -c) | ||
|
|
||
| if [[ $CHANGES -eq 0 ]]; then | ||
| exit 0 | ||
| fi | ||
|
|
||
| exit 1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import typing | ||
| from dataclasses import dataclass | ||
| from typing import Any, Union | ||
| from typing import Any, Union, Optional | ||
|
|
||
| from iwf.errors import WorkflowDefinitionError, NotRegisteredError | ||
| from iwf.iwf_api.models import ( | ||
|
|
@@ -40,6 +40,7 @@ class CommandResults: | |
| timer_commands: list[TimerCommandResult] | ||
| internal_channel_commands: list[InternalChannelCommandResult] | ||
| signal_channel_commands: list[SignalChannelCommandResult] | ||
| wait_until_api_succeeded: Optional[bool] = None | ||
|
Member
Author
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. I added this to match the properties in the And to be able to also implement the same exact logic using |
||
|
|
||
|
|
||
| def from_idl_command_results( | ||
|
|
@@ -48,9 +49,10 @@ def from_idl_command_results( | |
| signal_channel_types: dict[str, typing.Optional[type]], | ||
| object_encoder: ObjectEncoder, | ||
| ) -> CommandResults: | ||
| results = CommandResults(list(), list(), list()) | ||
| results = CommandResults(list(), list(), list(), None) | ||
| if isinstance(idl_results, Unset): | ||
| return results | ||
|
|
||
| if not isinstance(idl_results.timer_results, Unset): | ||
| for timer in idl_results.timer_results: | ||
| results.timer_commands.append( | ||
|
|
@@ -91,4 +93,10 @@ def from_idl_command_results( | |
| sig.command_id, | ||
| ) | ||
| ) | ||
|
|
||
| if not isinstance(idl_results.state_wait_until_failed, Unset): | ||
| # The server will set state_wait_until_failed to true if the waitUntil API failed. | ||
| # Hence, flag inversion is needed here to indicate that the waitUntil API succeeded. | ||
| results.wait_until_api_succeeded = not idl_results.state_wait_until_failed | ||
|
|
||
| return results | ||
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.
@N-give I did have to use
gsedin the end here. The output of the script locally was different than the one in the CI,gsedfixes that: https://github.com/indeedeng/iwf-python-sdk/actions/runs/15640692181/job/44067031610I'll create a quick PR to update it in the samples repo too
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.
I can't follow the functions so I used LLM to explain them
could you add a comment at the top of the file to explain why we need it and what it is doing?
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.
Added now: