argo-kedro 0.1.5__py3-none-any.whl → 0.1.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- argo_kedro/framework/cli/cli.py +196 -38
- argo_kedro/framework/hooks/argo_hook.py +66 -0
- argo_kedro/pipeline/__init__.py +2 -1
- argo_kedro/pipeline/fused_pipeline.py +9 -4
- argo_kedro/pipeline/node.py +26 -0
- argo_kedro/templates/argo.yml +9 -0
- argo_kedro/templates/argo_wf_spec.tmpl +25 -1
- {argo_kedro-0.1.5.dist-info → argo_kedro-0.1.7.dist-info}/METADATA +2 -1
- argo_kedro-0.1.7.dist-info/RECORD +17 -0
- {argo_kedro-0.1.5.dist-info → argo_kedro-0.1.7.dist-info}/WHEEL +1 -1
- {argo_kedro-0.1.5.dist-info → argo_kedro-0.1.7.dist-info}/entry_points.txt +3 -0
- argo_kedro-0.1.5.dist-info/RECORD +0 -14
- {argo_kedro-0.1.5.dist-info → argo_kedro-0.1.7.dist-info}/licenses/LICENSE +0 -0
- {argo_kedro-0.1.5.dist-info → argo_kedro-0.1.7.dist-info}/top_level.txt +0 -0
argo_kedro/framework/cli/cli.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import re
|
|
2
2
|
from pathlib import Path
|
|
3
|
-
from typing import Any, Dict, List, Iterable
|
|
3
|
+
from typing import Any, Dict, List, Iterable, Union
|
|
4
4
|
from logging import getLogger
|
|
5
5
|
|
|
6
6
|
import click
|
|
@@ -9,7 +9,10 @@ from kubernetes import config
|
|
|
9
9
|
from kubernetes.dynamic import DynamicClient
|
|
10
10
|
from jinja2 import Environment, FileSystemLoader
|
|
11
11
|
from kedro.framework.cli.utils import CONTEXT_SETTINGS, KedroCliError
|
|
12
|
+
from kedro.framework.project import pipelines, settings
|
|
12
13
|
from kedro.framework.session import KedroSession
|
|
14
|
+
from kedro.framework.startup import bootstrap_project
|
|
15
|
+
from kedro.utils import find_kedro_project, is_kedro_project
|
|
13
16
|
from kedro.framework.cli.project import (
|
|
14
17
|
ASYNC_ARG_HELP,
|
|
15
18
|
CONF_SOURCE_HELP,
|
|
@@ -30,11 +33,48 @@ from kedro.pipeline import Pipeline
|
|
|
30
33
|
from kedro.pipeline.node import Node
|
|
31
34
|
from kedro.runner.sequential_runner import SequentialRunner
|
|
32
35
|
from argo_kedro.runners.fuse_runner import FusedRunner
|
|
36
|
+
from argo_kedro.framework.hooks.argo_hook import MachineType
|
|
37
|
+
from argo_kedro.pipeline.node import ArgoNode
|
|
33
38
|
|
|
34
39
|
LOGGER = getLogger(__name__)
|
|
35
40
|
ARGO_TEMPLATES_DIR_PATH = Path(__file__).parent.parent.parent / "templates"
|
|
36
41
|
|
|
37
42
|
|
|
43
|
+
def render_jinja_template(
|
|
44
|
+
src: Union[str, Path], **kwargs
|
|
45
|
+
) -> str:
|
|
46
|
+
"""This functions enable to copy a file and render the
|
|
47
|
+
tags (identified by {{ my_tag }}) with the values provided in kwargs.
|
|
48
|
+
|
|
49
|
+
Arguments:
|
|
50
|
+
src {Union[str, Path]} -- The path to the template which should be rendered
|
|
51
|
+
|
|
52
|
+
Returns:
|
|
53
|
+
str -- A string that contains all the files with replaced tags.
|
|
54
|
+
"""
|
|
55
|
+
src = Path(src)
|
|
56
|
+
template_loader = FileSystemLoader(searchpath=src.parent.as_posix())
|
|
57
|
+
template_env = Environment(loader=template_loader, keep_trailing_newline=True)
|
|
58
|
+
template = template_env.get_template(src.name)
|
|
59
|
+
return template.render(**kwargs)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def write_jinja_template(
|
|
63
|
+
src: Union[str, Path], dst: Union[str, Path], **kwargs
|
|
64
|
+
) -> None:
|
|
65
|
+
"""Write a template file and replace tis jinja's tags
|
|
66
|
+
(identified by {{ my_tag }}) with the values provided in kwargs.
|
|
67
|
+
|
|
68
|
+
Arguments:
|
|
69
|
+
src {Union[str, Path]} -- Path to the template which should be rendered
|
|
70
|
+
dst {Union[str, Path]} -- Path where the rendered template should be saved
|
|
71
|
+
"""
|
|
72
|
+
dst = Path(dst)
|
|
73
|
+
parsed_template = render_jinja_template(src, **kwargs)
|
|
74
|
+
with open(dst, "w") as file_handler:
|
|
75
|
+
file_handler.write(parsed_template)
|
|
76
|
+
|
|
77
|
+
|
|
38
78
|
@click.group(context_settings=CONTEXT_SETTINGS)
|
|
39
79
|
def cli():
|
|
40
80
|
pass
|
|
@@ -101,21 +141,108 @@ def _run_command_impl(
|
|
|
101
141
|
namespaces=namespaces,
|
|
102
142
|
)
|
|
103
143
|
|
|
144
|
+
class KedroClickGroup(click.Group):
|
|
145
|
+
def reset_commands(self):
|
|
146
|
+
self.commands = {}
|
|
147
|
+
|
|
148
|
+
# add commands on the fly based on conditions
|
|
149
|
+
if is_kedro_project(find_kedro_project(Path.cwd())):
|
|
150
|
+
self.add_command(init)
|
|
151
|
+
self.add_command(submit)
|
|
152
|
+
|
|
153
|
+
def list_commands(self, ctx):
|
|
154
|
+
self.reset_commands()
|
|
155
|
+
commands_list = sorted(self.commands)
|
|
156
|
+
return commands_list
|
|
157
|
+
|
|
158
|
+
def get_command(self, ctx, cmd_name):
|
|
159
|
+
self.reset_commands()
|
|
160
|
+
return self.commands.get(cmd_name)
|
|
161
|
+
|
|
104
162
|
@click.group(name="argo")
|
|
105
163
|
def commands():
|
|
106
164
|
pass
|
|
107
165
|
|
|
108
|
-
@commands.command(name="
|
|
166
|
+
@commands.command(name="argo", cls=KedroClickGroup)
|
|
167
|
+
def argo_commands():
|
|
168
|
+
"""Use mlflow-specific commands inside kedro project."""
|
|
169
|
+
pass # pragma: no cover
|
|
170
|
+
|
|
171
|
+
@argo_commands.command()
|
|
172
|
+
@click.option(
|
|
173
|
+
"--env",
|
|
174
|
+
"-e",
|
|
175
|
+
default="base",
|
|
176
|
+
help="The name of the kedro environment where the 'argo.yml' should be created. Default to 'base'",
|
|
177
|
+
)
|
|
178
|
+
@click.option(
|
|
179
|
+
"--force",
|
|
180
|
+
"-f",
|
|
181
|
+
is_flag=True,
|
|
182
|
+
default=False,
|
|
183
|
+
help="Update the template without any checks.",
|
|
184
|
+
)
|
|
185
|
+
@click.option(
|
|
186
|
+
"--silent",
|
|
187
|
+
"-s",
|
|
188
|
+
is_flag=True,
|
|
189
|
+
default=False,
|
|
190
|
+
help="Should message be logged when files are modified?",
|
|
191
|
+
)
|
|
192
|
+
def init(env: str, force: bool, silent: bool):
|
|
193
|
+
"""Updates the template of a kedro project.
|
|
194
|
+
Running this command is mandatory to use argo-kedro.
|
|
195
|
+
This adds "conf/base/argo.yml": This is a configuration file
|
|
196
|
+
used for run parametrization when calling "kedro run" command.
|
|
197
|
+
"""
|
|
198
|
+
|
|
199
|
+
# get constants
|
|
200
|
+
argo_yml = "argo.yml"
|
|
201
|
+
project_path = find_kedro_project(Path.cwd()) or Path.cwd()
|
|
202
|
+
project_metadata = bootstrap_project(project_path)
|
|
203
|
+
argo_yml_path = project_path / settings.CONF_SOURCE / env / argo_yml
|
|
204
|
+
|
|
205
|
+
# mlflow.yml is just a static file,
|
|
206
|
+
# but the name of the experiment is set to be the same as the project
|
|
207
|
+
if argo_yml_path.is_file() and not force:
|
|
208
|
+
click.secho(
|
|
209
|
+
click.style(
|
|
210
|
+
f"A 'argo.yml' already exists at '{argo_yml_path}' You can use the ``--force`` option to override it.",
|
|
211
|
+
fg="red",
|
|
212
|
+
)
|
|
213
|
+
)
|
|
214
|
+
else:
|
|
215
|
+
try:
|
|
216
|
+
write_jinja_template(
|
|
217
|
+
src=ARGO_TEMPLATES_DIR_PATH / argo_yml,
|
|
218
|
+
is_cookiecutter=False,
|
|
219
|
+
dst=argo_yml_path,
|
|
220
|
+
python_package=project_metadata.package_name,
|
|
221
|
+
)
|
|
222
|
+
if not silent:
|
|
223
|
+
click.secho(
|
|
224
|
+
click.style(
|
|
225
|
+
f"'{settings.CONF_SOURCE}/{env}/{argo_yml}' successfully updated.",
|
|
226
|
+
fg="green",
|
|
227
|
+
)
|
|
228
|
+
)
|
|
229
|
+
except FileNotFoundError:
|
|
230
|
+
click.secho(
|
|
231
|
+
click.style(
|
|
232
|
+
f"No env '{env}' found. Please check this folder exists inside '{settings.CONF_SOURCE}' folder.",
|
|
233
|
+
fg="red",
|
|
234
|
+
)
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
@argo_commands.command(name="submit")
|
|
109
238
|
@click.option("--pipeline", "-p", type=str, default="__default__", help="Specify which pipeline to execute")
|
|
110
239
|
@click.option("--environment", "-e", type=str, default="base", help="Kedro environment to execute in")
|
|
111
240
|
@click.option("--image", type=str, required=True, help="Image to execute")
|
|
112
|
-
@click.option("--namespace", "-n", type=str, required=True, help="Namespace to execute in")
|
|
113
241
|
@click.pass_obj
|
|
114
242
|
def submit(
|
|
115
243
|
ctx,
|
|
116
244
|
pipeline: str,
|
|
117
245
|
image: str,
|
|
118
|
-
namespace: str,
|
|
119
246
|
environment: str
|
|
120
247
|
):
|
|
121
248
|
"""Submit the pipeline to Argo."""
|
|
@@ -125,43 +252,61 @@ def submit(
|
|
|
125
252
|
template_env = Environment(loader=loader, trim_blocks=True, lstrip_blocks=True)
|
|
126
253
|
template = template_env.get_template("argo_wf_spec.tmpl")
|
|
127
254
|
|
|
128
|
-
pipeline_tasks = get_argo_dag(kedro_pipelines[pipeline])
|
|
129
|
-
|
|
130
255
|
LOGGER.info("Rendering Argo spec...")
|
|
131
256
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
257
|
+
project_path = find_kedro_project(Path.cwd()) or Path.cwd()
|
|
258
|
+
bootstrap_project(project_path)
|
|
259
|
+
with KedroSession.create(
|
|
260
|
+
project_path=project_path,
|
|
261
|
+
env=environment,
|
|
262
|
+
) as session:
|
|
263
|
+
context = session.load_context()
|
|
264
|
+
pipeline_tasks = get_argo_dag(
|
|
265
|
+
kedro_pipelines[pipeline],
|
|
266
|
+
machine_types=context.argo.machine_types,
|
|
267
|
+
default_machine_type=context.argo.default_machine_type
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
# Render the template
|
|
271
|
+
rendered_template = template.render(
|
|
272
|
+
pipeline_tasks=[task.to_dict() for task in pipeline_tasks.values()],
|
|
273
|
+
pipeline_name=pipeline,
|
|
274
|
+
image=image,
|
|
275
|
+
namespace=context.argo.namespace,
|
|
276
|
+
environment=environment
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
# Load as yaml
|
|
280
|
+
yaml_data = yaml.safe_load(rendered_template)
|
|
281
|
+
yaml_without_anchors = yaml.dump(yaml_data, sort_keys=False, default_flow_style=False)
|
|
282
|
+
save_argo_template(
|
|
283
|
+
yaml_without_anchors,
|
|
284
|
+
)
|
|
285
|
+
|
|
286
|
+
# Use kubeconfig to submit to kubernetes
|
|
287
|
+
config.load_kube_config()
|
|
288
|
+
client = DynamicClient(config.new_client_from_config())
|
|
289
|
+
|
|
290
|
+
resource = client.resources.get(
|
|
291
|
+
api_version=yaml_data["apiVersion"],
|
|
292
|
+
kind=yaml_data["kind"],
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
response = resource.create(
|
|
296
|
+
body=yaml_data,
|
|
297
|
+
namespace=context.argo.namespace
|
|
298
|
+
)
|
|
299
|
+
|
|
300
|
+
workflow_name = response.metadata.name
|
|
301
|
+
LOGGER.info(f"Workflow submitted successfully: {workflow_name}")
|
|
302
|
+
LOGGER.info(f"View workflow at: https://argo.ai-platform.dev.everycure.org/workflows/{context.argo.namespace}/{workflow_name}")
|
|
303
|
+
|
|
304
|
+
return workflow_name
|
|
161
305
|
|
|
162
306
|
|
|
163
307
|
def save_argo_template(argo_template: str) -> str:
|
|
164
308
|
file_path = Path("templates") / "argo-workflow-template.yml"
|
|
309
|
+
file_path.parent.mkdir(parents=True, exist_ok=True)
|
|
165
310
|
with open(file_path, "w") as f:
|
|
166
311
|
f.write(argo_template)
|
|
167
312
|
return str(file_path)
|
|
@@ -173,9 +318,10 @@ class ArgoTask:
|
|
|
173
318
|
Argo's operating model slightly differs from Kedro's, i.e., while Kedro uses dataset
|
|
174
319
|
dependecies to model relationships, Argo uses task dependencies."""
|
|
175
320
|
|
|
176
|
-
def __init__(self, node: Node):
|
|
321
|
+
def __init__(self, node: Node, machine_type: MachineType):
|
|
177
322
|
self._node = node
|
|
178
323
|
self._parents = []
|
|
324
|
+
self._machine_type = machine_type
|
|
179
325
|
|
|
180
326
|
@property
|
|
181
327
|
def node(self):
|
|
@@ -189,10 +335,17 @@ class ArgoTask:
|
|
|
189
335
|
"name": clean_name(self._node.name),
|
|
190
336
|
"nodes": self._node.name,
|
|
191
337
|
"deps": [clean_name(parent.name) for parent in sorted(self._parents)],
|
|
338
|
+
"mem": self._machine_type.mem,
|
|
339
|
+
"cpu": self._machine_type.cpu,
|
|
340
|
+
"num_gpu": self._machine_type.num_gpu,
|
|
192
341
|
}
|
|
193
342
|
|
|
194
343
|
|
|
195
|
-
def get_argo_dag(
|
|
344
|
+
def get_argo_dag(
|
|
345
|
+
pipeline: Pipeline,
|
|
346
|
+
machine_types: dict[str, MachineType],
|
|
347
|
+
default_machine_type: str,
|
|
348
|
+
) -> List[Dict[str, Any]]:
|
|
196
349
|
"""Function to convert the Kedro pipeline into Argo Tasks. The function
|
|
197
350
|
iterates the nodes of the pipeline and generates Argo tasks with dependencies.
|
|
198
351
|
These dependencies are inferred based on the input and output datasets for
|
|
@@ -208,7 +361,12 @@ def get_argo_dag(pipeline: Pipeline) -> List[Dict[str, Any]]:
|
|
|
208
361
|
# allowing us to easily translate the Kedro DAG to an Argo WF.
|
|
209
362
|
for group in pipeline.grouped_nodes:
|
|
210
363
|
for target_node in group:
|
|
211
|
-
|
|
364
|
+
try:
|
|
365
|
+
task = ArgoTask(target_node, machine_types[target_node.machine_type] if isinstance(target_node, ArgoNode) and target_node.machine_type is not None else machine_types[default_machine_type])
|
|
366
|
+
except KeyError as e:
|
|
367
|
+
LOGGER.error(f"Machine type not found for node `{target_node.name}`")
|
|
368
|
+
raise KeyError(f"Machine type `{target_node.machine_type}` not found for node `{target_node.name}`")
|
|
369
|
+
|
|
212
370
|
task.add_parents(
|
|
213
371
|
[
|
|
214
372
|
parent.node
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
|
|
2
|
+
import os
|
|
3
|
+
import re
|
|
4
|
+
from logging import Logger, getLogger
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from tempfile import TemporaryDirectory
|
|
7
|
+
from typing import Any, Union
|
|
8
|
+
|
|
9
|
+
from kedro.config import MissingConfigException
|
|
10
|
+
from kedro.framework.context import KedroContext
|
|
11
|
+
from kedro.framework.hooks import hook_impl
|
|
12
|
+
from kedro.framework.startup import _get_project_metadata
|
|
13
|
+
from kedro.io import CatalogProtocol, DataCatalog
|
|
14
|
+
from kedro.pipeline import Pipeline
|
|
15
|
+
from kedro.pipeline.node import Node
|
|
16
|
+
from omegaconf import OmegaConf
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
from pydantic import BaseModel
|
|
20
|
+
|
|
21
|
+
class MachineType(BaseModel):
|
|
22
|
+
mem: int
|
|
23
|
+
cpu: int
|
|
24
|
+
num_gpu: int
|
|
25
|
+
|
|
26
|
+
class ArgoConfig(BaseModel):
|
|
27
|
+
namespace: str
|
|
28
|
+
machine_types: dict[str, MachineType]
|
|
29
|
+
default_machine_type: str
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class ArgoHook:
|
|
33
|
+
@property
|
|
34
|
+
def _logger(self) -> Logger:
|
|
35
|
+
return getLogger(__name__)
|
|
36
|
+
|
|
37
|
+
@hook_impl
|
|
38
|
+
def after_context_created(
|
|
39
|
+
self,
|
|
40
|
+
context: KedroContext,
|
|
41
|
+
) -> None:
|
|
42
|
+
"""Hooks to be invoked after a `KedroContext` is created. This is the earliest
|
|
43
|
+
hook triggered within a Kedro run. The `KedroContext` stores useful information
|
|
44
|
+
such as `credentials`, `config_loader` and `env`.
|
|
45
|
+
Args:
|
|
46
|
+
context: The context that was created.
|
|
47
|
+
"""
|
|
48
|
+
try:
|
|
49
|
+
if "argo" not in context.config_loader.config_patterns.keys():
|
|
50
|
+
context.config_loader.config_patterns.update(
|
|
51
|
+
{"argo": ["argo*", "argo*/**", "**/argo*"]}
|
|
52
|
+
)
|
|
53
|
+
conf_argo_yml = context.config_loader["argo"]
|
|
54
|
+
except MissingConfigException:
|
|
55
|
+
self._logger.warning(
|
|
56
|
+
"No 'argo.yml' config file found in environment. Default configuration will be used. Use ``kedro argo init`` command in CLI to customize the configuration."
|
|
57
|
+
)
|
|
58
|
+
# we create an empty dict to have the same behaviour when the argo.yml
|
|
59
|
+
# is commented out. In this situation there is no MissingConfigException
|
|
60
|
+
# but we got an empty dict
|
|
61
|
+
conf_argo_yml = {}
|
|
62
|
+
|
|
63
|
+
conf_argo_yml = ArgoConfig.model_validate(conf_argo_yml)
|
|
64
|
+
context.__setattr__("argo", conf_argo_yml)
|
|
65
|
+
|
|
66
|
+
argo_hook = ArgoHook()
|
argo_kedro/pipeline/__init__.py
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
from typing import Iterable, List
|
|
2
|
-
from kedro.pipeline import Pipeline
|
|
2
|
+
from kedro.pipeline import Pipeline
|
|
3
3
|
from functools import cached_property
|
|
4
|
+
from argo_kedro.pipeline.node import ArgoNode
|
|
5
|
+
from kedro.pipeline.node import Node
|
|
4
6
|
|
|
5
|
-
class FusedNode(
|
|
7
|
+
class FusedNode(ArgoNode):
|
|
6
8
|
"""FusedNode is an extension of Kedro's internal node. The FusedNode
|
|
7
9
|
wraps a set of nodes, and correctly sets it's `inputs` and `outputs`
|
|
8
10
|
allowing it to act as a single unit for execution.
|
|
9
11
|
"""
|
|
10
12
|
|
|
11
|
-
def __init__(self, nodes: List[Node], name: str):
|
|
13
|
+
def __init__(self, nodes: List[Node], name: str, machine_type: str | None = None):
|
|
12
14
|
self._nodes = nodes
|
|
13
15
|
self._name = name
|
|
14
16
|
self._namespace = None
|
|
@@ -17,6 +19,7 @@ class FusedNode(Node):
|
|
|
17
19
|
self._confirms = []
|
|
18
20
|
self._func = lambda: None
|
|
19
21
|
self._tags = []
|
|
22
|
+
self._machine_type = machine_type
|
|
20
23
|
|
|
21
24
|
for node in nodes:
|
|
22
25
|
self._inputs.extend(node.inputs)
|
|
@@ -49,10 +52,12 @@ class FusedPipeline(Pipeline):
|
|
|
49
52
|
name: str,
|
|
50
53
|
*,
|
|
51
54
|
tags: str | Iterable[str] | None = None,
|
|
55
|
+
machine_type: str | None = None,
|
|
52
56
|
):
|
|
53
57
|
self._name = name
|
|
58
|
+
self._machine_type = machine_type
|
|
54
59
|
super().__init__(nodes, tags=tags)
|
|
55
60
|
|
|
56
61
|
@property
|
|
57
62
|
def nodes(self) -> list[Node]:
|
|
58
|
-
return [FusedNode(self._nodes, name=self._name)]
|
|
63
|
+
return [FusedNode(self._nodes, name=self._name, machine_type=self._machine_type)]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from kedro.pipeline import Node
|
|
2
|
+
from typing import Callable, Iterable
|
|
3
|
+
|
|
4
|
+
class ArgoNode(Node):
|
|
5
|
+
"""ArgoNode is an extension of the Kedro node class, aimed at allowing
|
|
6
|
+
the node to be allocated to a specific machine type.
|
|
7
|
+
"""
|
|
8
|
+
def __init__(
|
|
9
|
+
self,
|
|
10
|
+
func: Callable,
|
|
11
|
+
inputs: str | list[str] | dict[str, str] | None,
|
|
12
|
+
outputs: str | list[str] | dict[str, str] | None,
|
|
13
|
+
*,
|
|
14
|
+
name: str | None = None,
|
|
15
|
+
machine_type: str | None = None,
|
|
16
|
+
tags: str | Iterable[str] | None = None,
|
|
17
|
+
confirms: str | list[str] | None = None,
|
|
18
|
+
namespace: str | None = None,
|
|
19
|
+
):
|
|
20
|
+
|
|
21
|
+
super().__init__(func, inputs, outputs, name=name, tags=tags, confirms=confirms, namespace=namespace)
|
|
22
|
+
self._machine_type = machine_type
|
|
23
|
+
|
|
24
|
+
@property
|
|
25
|
+
def machine_type(self) -> str:
|
|
26
|
+
return self._machine_type
|
|
@@ -18,6 +18,25 @@ spec:
|
|
|
18
18
|
parameters:
|
|
19
19
|
- name: pipeline
|
|
20
20
|
- name: kedro_nodes
|
|
21
|
+
podSpecPatch: |
|
|
22
|
+
containers:
|
|
23
|
+
- name: main
|
|
24
|
+
# Add tolerations for large memory nodes and GPU nodes
|
|
25
|
+
resources:
|
|
26
|
+
requests:
|
|
27
|
+
memory: {% raw %} "{{inputs.parameters.mem}}Gi"
|
|
28
|
+
{% endraw %}
|
|
29
|
+
cpu: {% raw %} "{{inputs.parameters.cpu}}"
|
|
30
|
+
{% endraw %}
|
|
31
|
+
nvidia.com/gpu: {% raw %} "{{inputs.parameters.num_gpu}}"
|
|
32
|
+
{% endraw %}
|
|
33
|
+
limits:
|
|
34
|
+
memory: {% raw %} "{{inputs.parameters.mem}}Gi"
|
|
35
|
+
{% endraw %}
|
|
36
|
+
cpu: {% raw %} "{{inputs.parameters.cpu}}"
|
|
37
|
+
{% endraw %}
|
|
38
|
+
nvidia.com/gpu: {% raw %} "{{inputs.parameters.num_gpu}}"
|
|
39
|
+
{% endraw %}
|
|
21
40
|
container:
|
|
22
41
|
image: {{ image }}
|
|
23
42
|
command: ["kedro"]
|
|
@@ -49,5 +68,10 @@ spec:
|
|
|
49
68
|
value: {{ pipeline_name }}
|
|
50
69
|
- name: kedro_nodes
|
|
51
70
|
value: {{ task.nodes }}
|
|
52
|
-
|
|
71
|
+
- name: num_gpu
|
|
72
|
+
value: {{ task.num_gpu }}
|
|
73
|
+
- name: mem
|
|
74
|
+
value: {{ task.mem }}
|
|
75
|
+
- name: cpu
|
|
76
|
+
value: {{ task.cpu }}
|
|
53
77
|
{% endfor %}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: argo-kedro
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
4
4
|
Summary: Kedro plugin for running pipelines on Argo Workflows
|
|
5
5
|
Author-email: Laurens Vijnck <laurens@everycure.org>, Nelson Alfonso <nelson@everycure.org>
|
|
6
6
|
License: MIT
|
|
@@ -26,6 +26,7 @@ Requires-Dist: kedro
|
|
|
26
26
|
Requires-Dist: pyyaml>=6.0.2
|
|
27
27
|
Requires-Dist: jinja2>=3.0.0
|
|
28
28
|
Requires-Dist: kubernetes>=35.0.0
|
|
29
|
+
Requires-Dist: pydantic>=2.0.0
|
|
29
30
|
Dynamic: license-file
|
|
30
31
|
|
|
31
32
|
# argo-kedro
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
argo_kedro/framework/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
argo_kedro/framework/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
argo_kedro/framework/cli/cli.py,sha256=3w-bdPbFtLobI3dtlHBKZECnG90nKwinDWc2vY84zxM,14071
|
|
4
|
+
argo_kedro/framework/hooks/argo_hook.py,sha256=aBbq_u8CskwJDIZaV2Eb7DvR-yLR_1ywKl38PxPdtO0,2183
|
|
5
|
+
argo_kedro/pipeline/__init__.py,sha256=OcViNwRwYyMCIYPPRHTGIiOH3UfkZzgXXn-g5vgRzgE,109
|
|
6
|
+
argo_kedro/pipeline/fused_pipeline.py,sha256=Z28PI0ACincyKjqIuaBw4FaBwQx6r1MUc7_kDopYN2c,2116
|
|
7
|
+
argo_kedro/pipeline/node.py,sha256=zhV_KNZIAg3xpRxoZCCbayK9tpD5crXllGE_9S-ovn8,868
|
|
8
|
+
argo_kedro/runners/__init__.py,sha256=AfU9FbRebpfTYnliocXtdwALpfVlh19WXcrEBh4Wb78,63
|
|
9
|
+
argo_kedro/runners/fuse_runner.py,sha256=K-OmciE8hLicMNiaLe5SjR4GwBH4Ud3mtNDknvzhTFA,3177
|
|
10
|
+
argo_kedro/templates/argo.yml,sha256=YJ1tyEw7X8npRj0PPu-C8QGxCTsPHQMXvQnqvLdzKjI,121
|
|
11
|
+
argo_kedro/templates/argo_wf_spec.tmpl,sha256=-2diQNjd4y3LqcQJ5br_fEU2ZG4aIT8M5CiEN1TseVw,2122
|
|
12
|
+
argo_kedro-0.1.7.dist-info/licenses/LICENSE,sha256=deLLtAUKpK9aD3f3sgr6-FP6M1K5Mh9ai0-EBBUZMqA,1080
|
|
13
|
+
argo_kedro-0.1.7.dist-info/METADATA,sha256=aV0fUpLwBxDV-yMwFdUPx7wp7jR6kzlqWdGXwV0j_Iw,3337
|
|
14
|
+
argo_kedro-0.1.7.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
15
|
+
argo_kedro-0.1.7.dist-info/entry_points.txt,sha256=YAR67HB3IjHmg3cSXSx9WFpRct41kS2M9Y9JPbAZgSg,208
|
|
16
|
+
argo_kedro-0.1.7.dist-info/top_level.txt,sha256=bkDBnht8zOdNxOcy4MwQU2MoRz5-eOww8MVzW2CLEdE,11
|
|
17
|
+
argo_kedro-0.1.7.dist-info/RECORD,,
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
argo_kedro/framework/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
argo_kedro/framework/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
argo_kedro/framework/cli/cli.py,sha256=x1wZfDJ3-GyxhUDnmdSzcmpVLrQu1SowZH9Wnjl0mz0,8176
|
|
4
|
-
argo_kedro/pipeline/__init__.py,sha256=eADPWCo5qxWr3nWXJJK7yugfJ37-zGYdY7frE-8dLcs,72
|
|
5
|
-
argo_kedro/pipeline/fused_pipeline.py,sha256=FHK5ZMQi21dHYGGewU-4QN31JwtiWbhtPiGrnC9QtpE,1844
|
|
6
|
-
argo_kedro/runners/__init__.py,sha256=AfU9FbRebpfTYnliocXtdwALpfVlh19WXcrEBh4Wb78,63
|
|
7
|
-
argo_kedro/runners/fuse_runner.py,sha256=K-OmciE8hLicMNiaLe5SjR4GwBH4Ud3mtNDknvzhTFA,3177
|
|
8
|
-
argo_kedro/templates/argo_wf_spec.tmpl,sha256=7gLBGnA_d8bwhwOAMGgU_IgWIjpD8atDEGidrG5BNKU,1218
|
|
9
|
-
argo_kedro-0.1.5.dist-info/licenses/LICENSE,sha256=deLLtAUKpK9aD3f3sgr6-FP6M1K5Mh9ai0-EBBUZMqA,1080
|
|
10
|
-
argo_kedro-0.1.5.dist-info/METADATA,sha256=VwFG8P4SJEwE0VVz81RfTvVyS88DUr_FF7RT-VsoeKg,3306
|
|
11
|
-
argo_kedro-0.1.5.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
12
|
-
argo_kedro-0.1.5.dist-info/entry_points.txt,sha256=czlBy9HPiG00bIpokpPOaE2EFr9YlWRSDhWPbLDcEYU,134
|
|
13
|
-
argo_kedro-0.1.5.dist-info/top_level.txt,sha256=bkDBnht8zOdNxOcy4MwQU2MoRz5-eOww8MVzW2CLEdE,11
|
|
14
|
-
argo_kedro-0.1.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|