-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
Conversation
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.
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)
|
There was a problem hiding this 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.
if isinstance(self.application_file, str): | ||
body = _load_body_to_dict(self.application_file) | ||
else: | ||
body = self.application_file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discuss previously this changes also required:
There was a problem hiding this 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) |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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.)
application_file
failure when parsing dictionary in SparkKubernetesOperator
@xs2tarunkukreja can you adress the comments please? |
Fixed in #35848 |
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.