-
Notifications
You must be signed in to change notification settings - Fork 310
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
don't override timeout on with_overrides if not specified #3097
base: master
Are you sure you want to change the base?
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 | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -302,18 +302,42 @@ def my_wf(a: typing.List[str]) -> typing.List[str]: | |||||||||||||||||||||
] | ||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
preset_timeout = datetime.timedelta(seconds=100) | ||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
@pytest.mark.parametrize( | ||||||||||||||||||||||
"timeout,expected", | ||||||||||||||||||||||
[(None, datetime.timedelta()), (10, datetime.timedelta(seconds=10))], | ||||||||||||||||||||||
"timeout,t1_expected_timeout_overridden, t1_expected_timeout_unset, t2_expected_timeout_overridden, " | ||||||||||||||||||||||
"t2_expected_timeout_unset", | ||||||||||||||||||||||
[ | ||||||||||||||||||||||
(None, 0, 0, 0, preset_timeout), | ||||||||||||||||||||||
(10, datetime.timedelta(seconds=10), 0, | ||||||||||||||||||||||
datetime.timedelta(seconds=10), preset_timeout) | ||||||||||||||||||||||
], | ||||||||||||||||||||||
) | ||||||||||||||||||||||
def test_timeout_override(timeout, expected): | ||||||||||||||||||||||
def test_timeout_override( | ||||||||||||||||||||||
timeout, | ||||||||||||||||||||||
t1_expected_timeout_overridden, | ||||||||||||||||||||||
t1_expected_timeout_unset, | ||||||||||||||||||||||
t2_expected_timeout_overridden, | ||||||||||||||||||||||
t2_expected_timeout_unset, | ||||||||||||||||||||||
): | ||||||||||||||||||||||
Comment on lines
+319
to
+323
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. Consider more descriptive parameter names
Consider using more descriptive parameter names. The current names Code suggestionCheck the AI-generated fix before applying
Suggested change
Code Review Run #01a35d Is this a valid issue, or was it incorrectly flagged by the Agent?
|
||||||||||||||||||||||
@task | ||||||||||||||||||||||
def t1(a: str) -> str: | ||||||||||||||||||||||
return f"*~*~*~{a}*~*~*~" | ||||||||||||||||||||||
|
||||||||||||||||||||||
@task( | ||||||||||||||||||||||
timeout=preset_timeout | ||||||||||||||||||||||
) | ||||||||||||||||||||||
def t2(a: str) -> str: | ||||||||||||||||||||||
return f"*~*~*~{a}*~*~*~" | ||||||||||||||||||||||
|
||||||||||||||||||||||
@workflow | ||||||||||||||||||||||
def my_wf(a: str) -> str: | ||||||||||||||||||||||
return t1(a=a).with_overrides(timeout=timeout) | ||||||||||||||||||||||
s = t1(a=a).with_overrides(timeout=timeout) | ||||||||||||||||||||||
s1 = t1(a=s).with_overrides() | ||||||||||||||||||||||
s2 = t2(a=s1).with_overrides(timeout=timeout) | ||||||||||||||||||||||
s3 = t2(a=s2).with_overrides() | ||||||||||||||||||||||
return s3 | ||||||||||||||||||||||
|
||||||||||||||||||||||
serialization_settings = flytekit.configuration.SerializationSettings( | ||||||||||||||||||||||
project="test_proj", | ||||||||||||||||||||||
|
@@ -323,8 +347,11 @@ def my_wf(a: str) -> str: | |||||||||||||||||||||
env={}, | ||||||||||||||||||||||
) | ||||||||||||||||||||||
wf_spec = get_serializable(OrderedDict(), serialization_settings, my_wf) | ||||||||||||||||||||||
assert len(wf_spec.template.nodes) == 1 | ||||||||||||||||||||||
assert wf_spec.template.nodes[0].metadata.timeout == expected | ||||||||||||||||||||||
assert len(wf_spec.template.nodes) == 4 | ||||||||||||||||||||||
assert wf_spec.template.nodes[0].metadata.timeout == t1_expected_timeout_overridden | ||||||||||||||||||||||
assert wf_spec.template.nodes[1].metadata.timeout == t1_expected_timeout_unset | ||||||||||||||||||||||
assert wf_spec.template.nodes[2].metadata.timeout == t2_expected_timeout_overridden | ||||||||||||||||||||||
assert wf_spec.template.nodes[3].metadata.timeout == t2_expected_timeout_unset | ||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
def test_timeout_override_invalid_value(): | ||||||||||||||||||||||
|
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.
Consider using
datetime.timedelta()
instead of0
for timeout value to maintain consistency with the type system and other code paths.Code suggestion
Code Review Run #01a35d
Is this a valid issue, or was it incorrectly flagged by the Agent?
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.
@pvditt For typing, I think this needs to be a timedelta object.