Skip to content

Commit

Permalink
Propagate client_kwargs argument and lower extract_images python ve…
Browse files Browse the repository at this point in the history
…rsion (#525)

This PR addresses 2 issues:
- The `client_kwargs` argument was not propagated properly and couldn't
be used
- Python 3.11 leads to very long dependency resolution times with KfP
and aiplatform dependencies

---------

Co-authored-by: Philippe Moussalli <philippe.moussalli95@gmail.com>
  • Loading branch information
RobbeSneyders and PhilippeMoussalli authored Oct 17, 2023
1 parent 4814e2d commit 55847c7
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=linux/amd64 python:3.11-slim as base
FROM --platform=linux/amd64 python:3.10-slim as base

# System dependencies
RUN apt-get update && \
Expand Down
6 changes: 6 additions & 0 deletions src/fondant/component_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,12 @@ def default_arguments(self) -> t.Dict[str, Argument]:
type="str",
default="default",
),
"client_kwargs": Argument(
name="client_kwargs",
description="Keyword arguments to pass to the Dask client",
type="dict",
default={},
),
"metadata": Argument(
name="metadata",
description="Metadata arguments containing the run id and base path",
Expand Down
11 changes: 5 additions & 6 deletions src/fondant/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,11 @@ def __init__(
self.input_partition_rows = input_partition_rows

if cluster_type == "local":
if client_kwargs is None:
client_kwargs = {
"processes": True,
"n_workers": os.cpu_count(),
"threads_per_worker": 1,
}
client_kwargs = client_kwargs or {
"processes": True,
"n_workers": os.cpu_count(),
"threads_per_worker": 1,
}

logger.info(f"Initialize local dask cluster with arguments {client_kwargs}")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# PIPELINE DEFINITION
# Name: testpipeline
# Description: description of the test pipeline
---
components:
comp-first-component:
executorLabel: exec-first-component
Expand All @@ -11,6 +7,10 @@ components:
defaultValue: true
isOptional: true
parameterType: BOOLEAN
client_kwargs:
defaultValue: {}
isOptional: true
parameterType: STRUCT
cluster_type:
defaultValue: default
isOptional: true
Expand All @@ -37,6 +37,10 @@ components:
defaultValue: true
isOptional: true
parameterType: BOOLEAN
client_kwargs:
defaultValue: {}
isOptional: true
parameterType: STRUCT
cluster_type:
defaultValue: default
isOptional: true
Expand All @@ -63,6 +67,10 @@ components:
defaultValue: true
isOptional: true
parameterType: BOOLEAN
client_kwargs:
defaultValue: {}
isOptional: true
parameterType: STRUCT
cluster_type:
defaultValue: default
isOptional: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# PIPELINE DEFINITION
# Name: testpipeline
# Description: description of the test pipeline
components:
comp-first-component:
executorLabel: exec-first-component
Expand All @@ -10,6 +7,10 @@ components:
defaultValue: true
isOptional: true
parameterType: BOOLEAN
client_kwargs:
defaultValue: {}
isOptional: true
parameterType: STRUCT
cluster_type:
defaultValue: default
isOptional: true
Expand All @@ -36,6 +37,10 @@ components:
defaultValue: true
isOptional: true
parameterType: BOOLEAN
client_kwargs:
defaultValue: {}
isOptional: true
parameterType: STRUCT
cluster_type:
defaultValue: default
isOptional: true
Expand All @@ -62,6 +67,10 @@ components:
defaultValue: true
isOptional: true
parameterType: BOOLEAN
client_kwargs:
defaultValue: {}
isOptional: true
parameterType: STRUCT
cluster_type:
defaultValue: default
isOptional: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# PIPELINE DEFINITION
# Name: testpipeline
# Description: description of the test pipeline
---
components:
comp-first-component:
executorLabel: exec-first-component
Expand All @@ -11,6 +7,10 @@ components:
defaultValue: true
isOptional: true
parameterType: BOOLEAN
client_kwargs:
defaultValue: {}
isOptional: true
parameterType: STRUCT
cluster_type:
defaultValue: default
isOptional: true
Expand All @@ -37,6 +37,10 @@ components:
defaultValue: true
isOptional: true
parameterType: BOOLEAN
client_kwargs:
defaultValue: {}
isOptional: true
parameterType: STRUCT
cluster_type:
defaultValue: default
isOptional: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# PIPELINE DEFINITION
# Name: testpipeline
# Description: description of the test pipeline
---
components:
comp-first-component:
executorLabel: exec-first-component
Expand All @@ -11,6 +7,10 @@ components:
defaultValue: true
isOptional: true
parameterType: BOOLEAN
client_kwargs:
defaultValue: {}
isOptional: true
parameterType: STRUCT
cluster_type:
defaultValue: default
isOptional: true
Expand All @@ -37,6 +37,10 @@ components:
defaultValue: true
isOptional: true
parameterType: BOOLEAN
client_kwargs:
defaultValue: {}
isOptional: true
parameterType: STRUCT
cluster_type:
defaultValue: default
isOptional: true
Expand Down
6 changes: 6 additions & 0 deletions tests/example_specs/component_specs/kubeflow_component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ components:
defaultValue: true
description: Set to False to disable caching, True by default.
parameterType: BOOLEAN
client_kwargs:
defaultValue: {}
description: Keyword arguments to pass to the Dask client
parameterType: STRUCT
cluster_type:
defaultValue: default
description: The cluster type to use for the execution
Expand Down Expand Up @@ -55,6 +59,8 @@ root:
parameters:
cache:
componentInputParameter: cache
client_kwargs:
componentInputParameter: client_kwargs
cluster_type:
componentInputParameter: cluster_type
component_spec:
Expand Down

0 comments on commit 55847c7

Please sign in to comment.