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

Fix application_file failure when parsing dictionary in SparkKubernetesOperator #34996

Closed
wants to merge 1 commit into from

Conversation

xs2tarunkukreja
Copy link

As per documentation, it should also accept YAML and JSON directly. The operator is working fine when we pass the file path. But fails when we pass the YAML or JSON as dictionary.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

As per documentation, it should also accept YAML and JSON directly. The operator is working fine when we pass the file path. But fails when we pass the YAML or JSON as dictionary.
@boring-cyborg
Copy link

boring-cyborg bot commented Oct 17, 2023

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: [email protected]
    Slack: https://s.apache.org/airflow-slack

Copy link
Contributor

@Taragolis Taragolis left a comment

Choose a reason for hiding this comment

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

Could you also change PR name to more detailed.
If this changes will merge it become a part of changelog and commit history.

By this description it would be hard to guess what is going on here.

Comment on lines +114 to +117
if isinstance(self.application_file, str):
body = _load_body_to_dict(self.application_file)
else:
body = self.application_file
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

@hussein-awala hussein-awala left a comment

Choose a reason for hiding this comment

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

Could you add a test for this change?

body = _load_body_to_dict(self.application_file)
else:
body = self.application_file

body = _load_body_to_dict(self.application_file)
Copy link
Member

Choose a reason for hiding this comment

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

I think this line should be removed, no?

@@ -111,6 +111,11 @@ def _get_namespace_event_stream(self, namespace, query_kwargs=None):
raise

def execute(self, context: Context):
if isinstance(self.application_file, str):
Copy link
Member

Choose a reason for hiding this comment

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

    def __init__(
        self,
        *,
        application_file: str,
        namespace: str | None = None,

The current type is string, if you want to support other types, you need to update the type of this parameter (and its doc.)

@eladkal eladkal changed the title It is failing when we are passing the dictionary. Fix application_file failure when parsing dictionary in SparkKubernetesOperator Nov 3, 2023
@eladkal
Copy link
Contributor

eladkal commented Nov 6, 2023

@xs2tarunkukreja can you adress the comments please?

@eladkal
Copy link
Contributor

eladkal commented Nov 25, 2023

Fixed in #35848

@eladkal eladkal closed this Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers provider:cncf-kubernetes Kubernetes provider related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants