-
Notifications
You must be signed in to change notification settings - Fork 308
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
[FEAT] add driver/executor pod in Spark #3016
Open
machichima
wants to merge
7
commits into
flyteorg:master
Choose a base branch
from
machichima:4105-spark-driver-executor-podtemplate
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8cc081d
feat: add driver/executor pod in Spark
machichima 7793398
feat: convert driver/exec podTemplate to k8spod
machichima b21d1e3
feat: pyspark take the primary container only
machichima 00d0c3a
feat: exclude cmd/args from task podTemplate
machichima 1b7c1c9
test: for custom driver/executor podTemplate
machichima 32f6aa9
fix: test and type
machichima 167a390
fix: lint and docs
machichima File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
|
||
from flytekit.exceptions import user as _user_exceptions | ||
from flytekit.models import common as _common | ||
from flytekit.models.task import K8sPod | ||
|
||
|
||
class SparkType(enum.Enum): | ||
|
@@ -27,6 +28,8 @@ def __init__( | |
executor_path: str, | ||
databricks_conf: Optional[Dict[str, Dict[str, Dict]]] = None, | ||
databricks_instance: Optional[str] = None, | ||
driver_pod: Optional[K8sPod] = None, | ||
executor_pod: Optional[K8sPod] = None, | ||
): | ||
""" | ||
This defines a SparkJob target. It will execute the appropriate SparkJob. | ||
|
@@ -47,6 +50,8 @@ def __init__( | |
databricks_conf = {} | ||
self._databricks_conf = databricks_conf | ||
self._databricks_instance = databricks_instance | ||
self._driver_pod = driver_pod | ||
self._executor_pod = executor_pod | ||
|
||
def with_overrides( | ||
self, | ||
|
@@ -71,6 +76,8 @@ def with_overrides( | |
hadoop_conf=new_hadoop_conf, | ||
databricks_conf=new_databricks_conf, | ||
databricks_instance=self.databricks_instance, | ||
driver_pod=self.driver_pod, | ||
executor_pod=self.executor_pod, | ||
Comment on lines
+79
to
+80
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing pod config in overrides method
Consider adding Code suggestionCheck the AI-generated fix before applying
Code Review Run #3c7587 Is this a valid issue, or was it incorrectly flagged by the Agent?
|
||
executor_path=self.executor_path, | ||
) | ||
|
||
|
@@ -139,6 +146,22 @@ def databricks_instance(self) -> str: | |
""" | ||
return self._databricks_instance | ||
|
||
@property | ||
def driver_pod(self) -> K8sPod: | ||
""" | ||
Additional pod specs for driver pod. | ||
:rtype: K8sPod | ||
""" | ||
return self._driver_pod | ||
|
||
@property | ||
def executor_pod(self) -> K8sPod: | ||
""" | ||
Additional pod specs for the worker node pods. | ||
:rtype: K8sPod | ||
""" | ||
return self._executor_pod | ||
|
||
def to_flyte_idl(self): | ||
""" | ||
:rtype: flyteidl.plugins.spark_pb2.SparkJob | ||
|
@@ -167,6 +190,8 @@ def to_flyte_idl(self): | |
hadoopConf=self.hadoop_conf, | ||
databricksConf=databricks_conf, | ||
databricksInstance=self.databricks_instance, | ||
driverPod=self.driver_pod.to_flyte_idl() if self.driver_pod else None, | ||
executorPod=self.executor_pod.to_flyte_idl() if self.executor_pod else None, | ||
) | ||
|
||
@classmethod | ||
|
@@ -193,4 +218,6 @@ def from_flyte_idl(cls, pb2_object): | |
executor_path=pb2_object.executorPath, | ||
databricks_conf=json_format.MessageToDict(pb2_object.databricksConf), | ||
databricks_instance=pb2_object.databricksInstance, | ||
driver_pod=pb2_object.driverPod, | ||
executor_pod=pb2_object.executorPod, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Consider extracting the Spark-specific container command/args logic into a separate helper function to improve code organization and readability. The current nested if condition makes the code harder to follow.
Code suggestion
Code Review Run #27c6ae
Is this a valid issue, or was it incorrectly flagged by the Agent?