You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/02/29 21:55:46 UTC
[GitHub] [airflow] BasPH opened a new pull request #7598: [AIRFLOW-6884]
Make SageMakerTrainingOperator idempotent
BasPH opened a new pull request #7598: [AIRFLOW-6884] Make SageMakerTrainingOperator idempotent
URL: https://github.com/apache/airflow/pull/7598
The SageMakerTrainingOperator is currently not idempotent. AWS requires training jobs to have unique names, and training jobs cannot be deleted/updated. Rerunning a SageMakerTrainingOperator will currently raise an exception because it cannot create a training job with the same name.
Therefore I suggest to add an argument `action_if_job_exists`, which determines the behaviour in case the training job name already exists. Possible options are `increment` (default) and `fail`, where increment lists all training jobs prefixed with the given name and suffixes the name with length+1:
Rerunning will result in training job names:
mytrainingjob
mytrainingjob-2
mytrainingjob-3
....
(the training job name is returned - and thus in an XCom, so users can fetch the updated training job name in a successive task)
The `fail` mode will simply fail if a training job with the same name is encountered.
Additionally, this PR implements a generic method `_list_request` on the SageMakerHook, for performing list operations on boto3. All boto3 `list_*` methods follow the same structure and `_list_request` provides an easy interface to iteratively fetch all results (since AWS returns results in batches).
---
Issue link: WILL BE INSERTED BY [boring-cyborg](https://github.com/kaxil/boring-cyborg)
Make sure to mark the boxes below before creating PR: [x]
- [ ] Description above provides context of the change
- [ ] Commit message/PR title starts with `[AIRFLOW-NNNN]`. AIRFLOW-NNNN = JIRA ID<sup>*</sup>
- [ ] Unit tests coverage for changes (not needed for documentation changes)
- [ ] Commits follow "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)"
- [ ] Relevant documentation is updated including usage instructions.
- [ ] I will engage committers as explained in [Contribution Workflow Example](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#contribution-workflow-example).
<sup>*</sup> For document-only changes commit message can start with `[AIRFLOW-XXXX]`.
---
In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
Read the [Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines) for more information.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] codecov-io commented on issue #7598: [AIRFLOW-6884] Make
SageMakerTrainingOperator idempotent
Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #7598: [AIRFLOW-6884] Make SageMakerTrainingOperator idempotent
URL: https://github.com/apache/airflow/pull/7598#issuecomment-593001915
# [Codecov](https://codecov.io/gh/apache/airflow/pull/7598?src=pr&el=h1) Report
> Merging [#7598](https://codecov.io/gh/apache/airflow/pull/7598?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/61a8bb65818521ccbb846e647103535b3e36b26d?src=pr&el=desc) will **decrease** coverage by `0.28%`.
> The diff coverage is `81.63%`.
[](https://codecov.io/gh/apache/airflow/pull/7598?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #7598 +/- ##
==========================================
- Coverage 86.82% 86.53% -0.29%
==========================================
Files 891 896 +5
Lines 42095 42740 +645
==========================================
+ Hits 36549 36986 +437
- Misses 5546 5754 +208
```
| [Impacted Files](https://codecov.io/gh/apache/airflow/pull/7598?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [airflow/providers/amazon/aws/hooks/sagemaker.py](https://codecov.io/gh/apache/airflow/pull/7598/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYW1hem9uL2F3cy9ob29rcy9zYWdlbWFrZXIucHk=) | `85.96% <76.47%> (-1.29%)` | :arrow_down: |
| [...oviders/amazon/aws/operators/sagemaker\_training.py](https://codecov.io/gh/apache/airflow/pull/7598/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYW1hem9uL2F3cy9vcGVyYXRvcnMvc2FnZW1ha2VyX3RyYWluaW5nLnB5) | `97.29% <93.33%> (-2.71%)` | :arrow_down: |
| [airflow/kubernetes/volume\_mount.py](https://codecov.io/gh/apache/airflow/pull/7598/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZV9tb3VudC5weQ==) | `44.44% <0%> (-55.56%)` | :arrow_down: |
| [airflow/kubernetes/volume.py](https://codecov.io/gh/apache/airflow/pull/7598/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZS5weQ==) | `52.94% <0%> (-47.06%)` | :arrow_down: |
| [airflow/kubernetes/pod\_launcher.py](https://codecov.io/gh/apache/airflow/pull/7598/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3BvZF9sYXVuY2hlci5weQ==) | `47.18% <0%> (-45.08%)` | :arrow_down: |
| [...viders/cncf/kubernetes/operators/kubernetes\_pod.py](https://codecov.io/gh/apache/airflow/pull/7598/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvY25jZi9rdWJlcm5ldGVzL29wZXJhdG9ycy9rdWJlcm5ldGVzX3BvZC5weQ==) | `69.69% <0%> (-25.21%)` | :arrow_down: |
| [airflow/kubernetes/refresh\_config.py](https://codecov.io/gh/apache/airflow/pull/7598/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3JlZnJlc2hfY29uZmlnLnB5) | `50.98% <0%> (-23.53%)` | :arrow_down: |
| [airflow/utils/helpers.py](https://codecov.io/gh/apache/airflow/pull/7598/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy9oZWxwZXJzLnB5) | `71.31% <0%> (-11.19%)` | :arrow_down: |
| [airflow/\_\_init\_\_.py](https://codecov.io/gh/apache/airflow/pull/7598/diff?src=pr&el=tree#diff-YWlyZmxvdy9fX2luaXRfXy5weQ==) | `92% <0%> (-8%)` | :arrow_down: |
| [airflow/providers/google/cloud/operators/dlp.py](https://codecov.io/gh/apache/airflow/pull/7598/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2Nsb3VkL29wZXJhdG9ycy9kbHAucHk=) | `96.25% <0%> (-3.75%)` | :arrow_down: |
| ... and [48 more](https://codecov.io/gh/apache/airflow/pull/7598/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/7598?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/7598?src=pr&el=footer). Last update [61a8bb6...05b51ce](https://codecov.io/gh/apache/airflow/pull/7598?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] kaxil merged pull request #7598: [AIRFLOW-6884] Make
SageMakerTrainingOperator idempotent
Posted by GitBox <gi...@apache.org>.
kaxil merged pull request #7598: [AIRFLOW-6884] Make SageMakerTrainingOperator idempotent
URL: https://github.com/apache/airflow/pull/7598
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services