Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,31 @@ Migrated are:
| airflow.contrib.hooks.aws_sns_hook.AwsSnsHook | airflow.providers.amazon.aws.hooks.sns.AwsSnsHook |
| airflow.contrib.operators.aws_athena_operator.AWSAthenaOperator | airflow.providers.amazon.aws.operators.athena.AWSAthenaOperator |
| airflow.contrib.operators.awsbatch.AWSBatchOperator | airflow.providers.amazon.aws.operators.batch.AwsBatchOperator |
| airflow.contrib.operators.awsbatch.BatchProtocol | airflow.providers.amazon.aws.hooks.batch_client.AwsBatchProtocol |
| private attrs and methods on AWSBatchOperator | airflow.providers.amazon.aws.hooks.batch_client.AwsBatchClient |
| n/a | airflow.providers.amazon.aws.hooks.batch_waiters.AwsBatchWaiters |
| airflow.contrib.operators.aws_sqs_publish_operator.SQSPublishOperator | airflow.providers.amazon.aws.operators.sqs.SQSPublishOperator |
| airflow.contrib.operators.aws_sns_publish_operator.SnsPublishOperator | airflow.providers.amazon.aws.operators.sns.SnsPublishOperator |
| airflow.contrib.sensors.aws_athena_sensor.AthenaSensor | airflow.providers.amazon.aws.sensors.athena.AthenaSensor |
| airflow.contrib.sensors.aws_sqs_sensor.SQSSensor | airflow.providers.amazon.aws.sensors.sqs.SQSSensor |

### AWS Batch Operator

The `AwsBatchOperator` was refactored to extract an `AwsBatchClient` (and inherit from it). The
changes are mostly backwards compatible and clarify the public API for these classes; some
private methods on `AwsBatchOperator` for polling a job status were relocated and renamed
to surface new public methods on `AwsBatchClient` (and via inheritance on `AwsBatchOperator`). A
couple of job attributes are renamed on an instance of `AwsBatchOperator`; these were mostly
used like private attributes but they were surfaced in the public API, so any use of them needs
to be updated as follows:
- `AwsBatchOperator().jobId` -> `AwsBatchOperator().job_id`
- `AwsBatchOperator().jobName` -> `AwsBatchOperator().job_name`

The `AwsBatchOperator` gets a new option to define a custom model for waiting on job status changes.
The `AwsBatchOperator` can use a new `waiters` parameter, an instance of `AwsBatchWaiters`, to
specify that custom job waiters will be used to monitor a batch job. See the latest API
documentation for details.

### Additional arguments passed to BaseOperator cause an exception

Previous versions of Airflow took additional arguments and displayed a message on the console. When the
Expand Down
32 changes: 30 additions & 2 deletions airflow/contrib/operators/awsbatch_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,25 @@
# under the License.
#

"""This module is deprecated. Please use `airflow.providers.amazon.aws.operators.batch`."""
"""This module is deprecated. Please use:

- `airflow.providers.amazon.aws.operators.batch`
- `airflow.providers.amazon.aws.hooks.batch_client`
- `airflow.providers.amazon.aws.hooks.batch_waiters`
"""

import warnings

from typing_extensions import Protocol, runtime_checkable

from airflow.providers.amazon.aws.hooks.batch_client import AwsBatchProtocol
from airflow.providers.amazon.aws.operators.batch import AwsBatchOperator

warnings.warn(
"This module is deprecated. Please use `airflow.providers.amazon.aws.operators.batch`.",
"This module is deprecated. "
"Please use `airflow.providers.amazon.aws.operators.batch`, "
"`airflow.providers.amazon.aws.hooks.batch_client`, and "
"`airflow.providers.amazon.aws.hooks.batch_waiters`",
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -44,3 +55,20 @@ def __init__(self, *args, **kwargs):
stacklevel=2,
)
super().__init__(*args, **kwargs)


@runtime_checkable
class BatchProtocol(AwsBatchProtocol, Protocol):
"""
This class is deprecated. Please use `airflow.providers.amazon.aws.hooks.batch_client.AwsBatchProtocol`.
"""

# A Protocol cannot be instantiated

def __new__(cls, *args, **kwargs):
warnings.warn(
"""This class is deprecated.
Please use `airflow.providers.amazon.aws.hooks.batch_client.AwsBatchProtocol`.""",
DeprecationWarning,
stacklevel=2,
)
Loading