Skip to content

Commit f760198

Browse files
authored
feat: conditional node
* feat: conditional node * feat: working argo conditional * feat: conditional node refactored * feat: conditional node refactored * feat: argo execution of the conditional * feat: argo execution of the conditional
1 parent aeefaa8 commit f760198

File tree

15 files changed

+459
-465
lines changed

15 files changed

+459
-465
lines changed

Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
# Python 3.8 Image without Dependecies
2-
FROM ubuntu:24.04
2+
FROM python:3.10.16-slim
33

44
LABEL maintainer="[email protected]"
55

6-
6+
ENV http_proxy=http://azpse.astrazeneca.net:9480
7+
ENV https_proxy=http://azpse.astrazeneca.net:9480
78
RUN apt-get update && apt-get install -y --no-install-recommends \
89
git \
910
ca-certificates \
1011
curl \
1112
&& rm -rf /var/lib/apt/lists/*
1213

14+
1315
ADD https://astral.sh/uv/0.5.12/install.sh /uv-installer.sh
1416
RUN sh /uv-installer.sh && rm /uv-installer.sh
1517
ENV PATH="/root/.local/bin/:$PATH"
1618

1719
COPY . /app
1820
WORKDIR /app
1921

20-
RUN uv python install && \
21-
uv sync --index https://artifactory.astrazeneca.net/api/pypi/pypi-virtual/simple/ --all-extras --frozen
22+
ENV http_proxy=
23+
ENV https_proxy=
24+
25+
RUN uv sync --index https://artifactory.astrazeneca.net/api/pypi/pypi-virtual/simple/ --frozen
2226

2327
ENV PATH="/app/.venv/bin:$PATH"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""
2+
You can execute this pipeline by:
3+
4+
python examples/01-tasks/python_tasks.py
5+
6+
The stdout of "Hello World!" would be captured as execution
7+
log and stored in the catalog.
8+
"""
9+
10+
from examples.common.functions import hello
11+
from runnable import PythonTask
12+
13+
14+
def main():
15+
# Create a tasks which calls the function "hello"
16+
# If this step executes successfully,
17+
# the pipeline will terminate with success
18+
pipeline = PythonTask(
19+
name="hello",
20+
function=hello,
21+
terminate_with_success=True,
22+
).as_pipeline()
23+
24+
pipeline.execute()
25+
return pipeline
26+
27+
28+
if __name__ == "__main__":
29+
main()

examples/02-sequential/when.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
from runnable import Conditional, Pipeline, PythonTask
2+
3+
4+
def when_heads_function():
5+
print("when_heads_function called")
6+
7+
8+
def when_tails_function():
9+
print("when_tails_function called")
10+
11+
12+
def toss_function():
13+
import random
14+
15+
# Simulate a coin toss
16+
toss = random.choice(["heads", "tails"])
17+
print(f"Toss result: {toss}")
18+
return toss
19+
20+
21+
def main():
22+
when_heads_pipeline = PythonTask(
23+
name="when_heads_task",
24+
function=when_heads_function,
25+
).as_pipeline()
26+
27+
when_tails_pipeline = PythonTask(
28+
name="when_tails_task",
29+
function=when_tails_function,
30+
).as_pipeline()
31+
32+
conditional = Conditional(
33+
name="conditional",
34+
branches={
35+
"heads": when_heads_pipeline,
36+
"tails": when_tails_pipeline,
37+
},
38+
parameter="toss",
39+
)
40+
41+
toss_task = PythonTask(
42+
name="toss_task",
43+
function=toss_function,
44+
returns=["toss"],
45+
)
46+
pipeline = Pipeline(steps=[toss_task, conditional])
47+
48+
pipeline.execute()
49+
50+
return pipeline
51+
52+
53+
if __name__ == "__main__":
54+
main()

examples/Dockerfile.39

Lines changed: 0 additions & 31 deletions
This file was deleted.

examples/configs/argo-config-az.yaml

Lines changed: 0 additions & 37 deletions
This file was deleted.

examples/configs/argo-config.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,6 @@ pipeline-executor:
1414
env:
1515
- name: argo_env
1616
value: "argo"
17-
overrides:
18-
smaller:
19-
image: $docker2
20-
resources:
21-
limits:
22-
cpu: "1"
23-
memory: 2Gi
24-
requests:
25-
cpu: "0.5"
26-
memory: 500Mi
2717
argoWorkflow:
2818
metadata:
2919
generateName: "argo-" # (2)

0 commit comments

Comments
 (0)