How to retrieve some pod ip ? #580
-
Consider the following workflow # Hera version 4.4.2
from hera import (Task, Workflow)
with Workflow("retrieve-deamon-pod-ip-", generate_name=True) as w:
daemon_t = Task(
"startpostgresdb",
daemon=True,
image="postgres:15.2",
)
consumer_t = Task(
"isdbready",
image="postgres:15.2",
command=["/bin/bash", "-c"],
# Following line will trigger an "Internal Server Error" on submission
# with error message
# templates.isdbready: failed to resolve {{tasks.startpostgresdb.ip}}
args=["exec pg_isready -U user -h " + daemon_t.ip + " -p 5432"],
)
daemon_t >> consumer_t
w.create() will trigger on submission the error Note: when using AW the syntax |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Thanks for the question @EricBoix! Any chance you looked at the daemon example? It has a sample usage of the task IP exposed via an env variable! |
Beta Was this translation helpful? Give feedback.
-
Thanks @flaviuvadan. Yes, I did encounter the deamon example that I could run smoothly while using the Indeed for the example I took in this discussion, flowing the But some of my use cases (arising from yaml AW e.g. this workflow) are a bit different. They do require that Is this possible in 4.4.2 or later ? |
Beta Was this translation helpful? Give feedback.
-
Thanks @flaviuvadan . That nails it. I just added an input parameter to the Task/container |
Beta Was this translation helpful? Give feedback.
Thanks for the question @EricBoix! Any chance you looked at the daemon example? It has a sample usage of the task IP exposed via an env variable!