-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
Support timeout
in BatchOperator
#45619
Closed
nrobinson-intelycare
wants to merge
7
commits into
apache:main
from
Intelycare-Data-Science:feat/batch-timeout
Closed
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
80413d3
Support timeout in BatchOperator
nrobinson-intelycare dfc139f
Merge branch 'main' into feat/batch-timeout
nrobinson-intelycare 28e7388
Add timeout to other tests
nrobinson-intelycare 5cf9c72
Rename to boto3_timeout
nrobinson-intelycare c04a35a
Update docstring
nrobinson-intelycare 6c37e9e
Fix test
nrobinson-intelycare e167cbf
Fix test_batch.py (ran tests locally)
nrobinson-intelycare File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,7 @@ def setup_method(self, _, get_client_type_mock): | |
aws_conn_id="airflow_test", | ||
region_name="eu-west-1", | ||
tags={}, | ||
timeout={"attemptDurationSeconds": 3600}, | ||
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. @vincbeck Should I be adding 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. Yes please |
||
) | ||
self.client_mock = self.get_client_type_mock.return_value | ||
# We're mocking all actual AWS calls and don't need a connection. This | ||
|
@@ -109,6 +110,7 @@ def test_init(self): | |
assert self.batch.hook.client == self.client_mock | ||
assert self.batch.tags == {} | ||
assert self.batch.wait_for_completion is True | ||
assert self.batch.timeout == {"attemptDurationSeconds": 3600} | ||
|
||
self.get_client_type_mock.assert_called_once_with(region_name="eu-west-1") | ||
|
||
|
@@ -141,6 +143,7 @@ def test_init_defaults(self): | |
assert issubclass(type(batch_job.hook.client), botocore.client.BaseClient) | ||
assert batch_job.tags == {} | ||
assert batch_job.wait_for_completion is True | ||
assert batch_job.timeout is None | ||
|
||
def test_template_fields_overrides(self): | ||
assert self.batch.template_fields == ( | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This can be mistakenly confused with Airflow task timeout
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.
Would
batch_job_timeout
be better?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 think keeping same/similar name as boto3 interface is simpler
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.
Please lets not use
timeout
.You can use the same name as boto3 or choose something else but not names that can cause confusion with BaseOperator parameters.
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.
boto3_timeout
would make sense I think?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'm open to
boto3_timeout
,batch_job_timeout
,job_timeout
etc, whatever is acceptable.