Skip to content

Conversation

@Piatachock
Copy link
Contributor

New features for YandexCloud Provider:

  • Support User-Agent header parametrization via environent variable
  • Store Service Account ID from Connection in Hook; use it as default in DataprocClusterCreateOperator

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better make it as a part of Provider Configuration?

@Piatachock Piatachock force-pushed the yandex_dataproc_deduce_default_service_account_id branch from 9d393da to 1d44ec6 Compare October 19, 2023 18:06
@eladkal
Copy link
Contributor

eladkal commented Oct 22, 2023

Static checks are failing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
conf.get("yandex", "sdk_user_agent_prefix"),
conf.get("yandex", "sdk_user_agent_prefix", fallback=""),

@Piatachock
Copy link
Contributor Author

Static checks are failing

Sorry, forgot to mark this PR as WIP.
I'm actually trying to build provider package locally to check it in our Managed Airflow installation end-to-end.
Do you, by any chance, know where should I look for any info on the subject? I've found dev folder and relevant scripts, but still struggling atm.

@Taragolis
Copy link
Contributor

it in our Managed Airflow

BTW, you or some one from the Yandex also could add link to Yandex Managed Service for Apache Airflow into Airflow Ecosystem, this placed into another repo, however changes could be done by simple click on Suggest a change on this page and make PR changes into the Github Editor

The only one thing that I found that International Link to Yandex's managed service https://cloud.yandex.com/en/services/managed-airflow right now return 404

@Taragolis
Copy link
Contributor

I'm actually trying to build provider package locally to check it in our Managed Airflow installation end-to-end.
Do you, by any chance, know where should I look for any info on the subject? I've found dev folder and relevant scripts, but still struggling atm.

You could run this breeze command

breeze release-management prepare-provider-packages yandex --version-suffix-for-pypi dev0 --package-format both

This would create two distribution (wheel, source) in dist directory

Good version of Docker: 24.0.6.
Good version of docker-compose: 2.22.0

...

Prepared provider package yandex in format both
===================================================================================

Summary of prepared packages:

    Prepared:
yandex

===================================================================================
apache-airflow-providers-yandex-3.5.0.dev0.tar.gz
apache_airflow_providers_yandex-3.5.0.dev0-py3-none-any.whl
===================================================================================

All good! Airflow packages are prepared in dist folder

@Piatachock Piatachock force-pushed the yandex_dataproc_deduce_default_service_account_id branch from 1d44ec6 to c1e8f4f Compare October 31, 2023 08:49
@Piatachock Piatachock force-pushed the yandex_dataproc_deduce_default_service_account_id branch from c1e8f4f to a716ec5 Compare October 31, 2023 10:48
@Piatachock
Copy link
Contributor Author

Piatachock commented Oct 31, 2023

Thanks! Managed to build provider locally and test it on our managed solution. Works as expected
This PR is ready for review

@Piatachock Piatachock force-pushed the yandex_dataproc_deduce_default_service_account_id branch 2 times, most recently from 31ebfbc to 3dd271c Compare November 1, 2023 07:52
@Taragolis
Copy link
Contributor

Need to add test for this changes.

For validate configuration, you might use conf_vars - context manager / decorator. Some samples:

@conf_vars(
{
(
"secrets",
"backend",
): "airflow.secrets.local_filesystem.LocalFilesystemBackend",
("secrets", "backend_kwargs"): '{"variables_file_path": "var.env"}',
}
)
def test_load_secret_backend_LocalFilesystemBackend(self):
with mock_local_file("KEY_A=VAL_A"):
backends = ensure_secrets_loaded()
backend_classes = [backend.__class__.__name__ for backend in backends]
assert "LocalFilesystemBackend" in backend_classes
assert Variable.get("KEY_A") == "VAL_A"

@pytest.mark.parametrize(
"job_runner, job_type,job_heartbeat_sec",
[(SchedulerJobRunner, "scheduler", "11"), (TriggererJobRunner, "triggerer", "9")],
)
def test_heart_rate_via_constructor_persists(self, job_runner, job_type, job_heartbeat_sec):
"""Ensure heartrate passed via constructor is set correctly"""
with conf_vars({(job_type.lower(), "job_heartbeat_sec"): job_heartbeat_sec}):
job = Job(heartrate=12)
job_runner(job)
# heartrate should be 12 since we passed that to the constructor directly
assert job.heartrate == 12

@Piatachock Piatachock force-pushed the yandex_dataproc_deduce_default_service_account_id branch from 3dd271c to 2eddb69 Compare November 1, 2023 13:27
@Piatachock
Copy link
Contributor Author

Piatachock commented Nov 3, 2023

Andrey, thanks for your approval! Is there anything else that should be done prior to merge this PR?

@potiuk
Copy link
Member

potiuk commented Nov 3, 2023

Nope. It looks cool.

@potiuk potiuk merged commit 0b850a9 into apache:main Nov 3, 2023
@potiuk
Copy link
Member

potiuk commented Nov 3, 2023

Good to see this "per-provider" configuration feature... But that reminds me that we need a bit more "discovery"

Look at "docs/apache-airflow-providers-celery" - there is configurtions-ref.rst which you have to add to yandex and you will have to also add configuration to index.rst @Piatachock also you should add link to https://github.com/apache/airflow/blob/main/docs/apache-airflow/configurations-ref.rst

That reminds me that we should add pre-commit and automation - this all should happen semi-automatically or at least should be verified by pre-commit (but it does not yet).

potiuk added a commit to potiuk/airflow that referenced this pull request Nov 3, 2023
The change apache#35059 missed configuration docs but it did not fail
the test suite. We need to improve it in the future, but for now
just adding missing configuration documentations should fix
doc build failures.
potiuk added a commit that referenced this pull request Nov 3, 2023
The change #35059 missed configuration docs but it did not fail
the test suite. We need to improve it in the future, but for now
just adding missing configuration documentations should fix
doc build failures.
romsharon98 pushed a commit to romsharon98/airflow that referenced this pull request Nov 10, 2023

---------

Co-authored-by: Petr Reznikov <prez@yandex-team.ru>
romsharon98 pushed a commit to romsharon98/airflow that referenced this pull request Nov 10, 2023
The change apache#35059 missed configuration docs but it did not fail
the test suite. We need to improve it in the future, but for now
just adding missing configuration documentations should fix
doc build failures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants