Skip to content
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

Allow importing the aws executors with a shorter path #39093

Merged
merged 5 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
9 changes: 9 additions & 0 deletions airflow/providers/amazon/aws/executors/batch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,12 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from __future__ import annotations # Added by precommit hooks

# from airflow.providers.amazon.aws.executors.batch.batch_executor import AwsBatchExecutor
from airflow.providers.amazon.aws.executors.batch import batch_executor

# precommit hooks (rust as of the time of commit) throws F401 - "Module imported but unused"
# One of the solutions it suggests is using a "redundant alias". This is used below instead of doing a #no-qa
# type ignore of the issue.
AwsBatchExecutor = batch_executor.AwsBatchExecutor
o-nikolas marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 8 additions & 0 deletions airflow/providers/amazon/aws/executors/ecs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from __future__ import annotations # Added by precommit hooks

from airflow.providers.amazon.aws.executors.ecs import ecs_executor

# precommit hooks (rust as of the time of commit) throws F401 - "Module imported but unused"
# One of the solutions it suggests is using a "redundant alias". This is used below instead of doing a #no-qa
# type ignore of the issue.
AwsEcsExecutor = ecs_executor.AwsEcsExecutor
Original file line number Diff line number Diff line change
Expand Up @@ -834,3 +834,8 @@ def test_submit_job_kwargs_exec_config_overrides(
final_run_task_kwargs = executor._submit_job_kwargs(mock_ti_key, command, "queue", exec_config)

assert final_run_task_kwargs == expected_result

def test_short_import_path(self):
from airflow.providers.amazon.aws.executors.batch import AwsBatchExecutor as AwsBatchExecutorShortPath

assert AwsBatchExecutor is AwsBatchExecutorShortPath
Original file line number Diff line number Diff line change
Expand Up @@ -1703,3 +1703,8 @@ def test_run_task_kwargs_exec_config_overrides(
final_run_task_kwargs = executor._run_task_kwargs(mock_ti_key, command, "queue", exec_config)

assert final_run_task_kwargs == expected_result

def test_short_import_path(self):
from airflow.providers.amazon.aws.executors.ecs import AwsEcsExecutor as AwsEcsExecutorShortPath

assert AwsEcsExecutor is AwsEcsExecutorShortPath