elegant-sandwich-48375
08/21/2025, 4:12 AMjolly-florist-66728
08/21/2025, 4:12 AMjolly-florist-66728
08/21/2025, 4:13 AM@task
decorator and the Pod
configuration from flytekitplugins-pod
. You would define a V1PodSpec
and V1Container
using the Kubernetes Python client, then pass this to the Flyte task. Hereβs a minimal example based on your YAML:
from flytekit import task
from flytekitplugins.pod import Pod
from kubernetes.client.models import V1Container, V1PodSpec, V1EnvVar, V1SecurityContext
@task(
task_config=Pod(
pod_spec=V1PodSpec(
containers=[
V1Container(
name="njest-api",
image="<http://artifacts.swf.i.mercedes-benz.com/adasdai-docker/config_2/sil_njest:mpu_pipeline-11110069_njest|artifacts.swf.i.mercedes-benz.com/adasdai-docker/config_2/sil_njest:mpu_pipeline-11110069_njest>",
security_context=V1SecurityContext(privileged=True, run_as_user=0),
env=[
V1EnvVar(name="PYTHONUNBUFFERED", value="1"),
V1EnvVar(
name="TEST_SUITES",
value_from={
"config_map_key_ref": {
"name": "recompute-config-v4",
"key": "TEST_SUITES"
}
}
),
],
command=["/bin/bash"],
args=[
"-c",
"""
cat <<EOF > /home/initial_value_test.yml
TestSteps:
1:
WaitFor:
Timeout: 200
Variables:
dwVehicleIOQMState.ignitionStatus_in: 3
2:
Wait: 1200
EOF
echo $TEST_SUITES &&
cd /home/julia/shared_memory_app/ && touch /dev/shm/api_started && MBTestCaseParser --testcase /home/initial_value_test.yml &
until [ -f /dev/shm/recompute_ended ]; do
sleep 1
done
exit
"""
],
)
]
)
)
)
def njest_api_task():
pass
Note: The value_from
field for environment variables may require using the Kubernetes Python clientβs V1EnvVarSource
and V1ConfigMapKeySelector
for full compatibility. This code is a direct translation and may need minor adjustments for your Flyte and Kubernetes versions.
Would you like a step-by-step breakdown or more details on handling env.value_from
?
Sources:
- Flyte Pod Example π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.jolly-florist-66728
08/21/2025, 10:46 AMjolly-florist-66728
08/21/2025, 10:47 AMPod
configuration from flytekitplugins-pod
and the Kubernetes Python client. Hereβs a direct translation:
from flytekit import task
from flytekitplugins.pod import Pod
from kubernetes.client.models import V1Container, V1PodSpec, V1SecurityContext, V1VolumeMount
@task(
task_config=Pod(
pod_spec=V1PodSpec(
containers=[
V1Container(
name="aurix",
image="europe-west4-docker.pkg.dev/mb-adas-2005-p-673d/dtp-dev-digtest-base-layer-base-repo/recompute/aurix:v1",
security_context=V1SecurityContext(privileged=True, run_as_user=0),
volume_mounts=[
V1VolumeMount(
name="chopped-storage",
mount_path="/home/root/logs",
sub_path="logs"
)
],
command=["/bin/bash"],
args=[
"-c",
"""
echo '#!/bin/sh
cd /home/opensutloader
./opensutloaderd --logfile /home/root/logs/loader_trace.log' > /home/opensutloader/simulation.sh &&
cd /home/opensutloader && chmod -R 777 /home/root/logs &&
chmod -R a+rx /home/opensutloader/simulation.sh &&
sed -i 's/^PcapOutputFilePath=.*/PcapOutputFilePath=\\/home\\/root\\/logs\\/aurix_trace.pcap/' /home/opensutloader/opensutloader.ini &&
sed -i '/^SimulationTime=/d' /home/opensutloader/opensutloader.ini && sed -i '2i SimulationTime=1000' /home/opensutloader/opensutloader.ini &&
until [ -f /dev/shm/adaptive_started ]; do
sleep 1
done &
sudo taskset -c 0 /home/opensutloader/simulation.sh &
until [ -f /dev/shm/recompute_ended ]; do
sleep 1
done
exit
"""
],
)
]
)
)
)
def aurix_task():
pass
You may need to define the chopped-storage
volume in your Flyte workflow or deployment, as this code only mounts it. Would you like more detail on volume definitions or resource requests?
Sources:
- Flyte Pod Example π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.acoustic-parrot-22802
08/21/2025, 11:46 AMjolly-florist-66728
08/21/2025, 11:46 AMjolly-florist-66728
08/21/2025, 11:47 AM